summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-05-05 15:30:38 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2011-05-09 14:56:28 -0700
commitbb6c037d4178a0b35e964651e09323c8d714f435 (patch)
tree7b06395547e9d94d86059b4d22bbfa2138ed0e2f
parent7703c9980a33dc32db8120d1677478aca020ebbd (diff)
downloadexternal_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.zip
external_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.tar.gz
external_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.tar.bz2
Better support for exiting full screen
When exiting the full screen, we need to let the webkit know the status. bug:4312214 Change-Id: I4e475da3b426176fd232551e16fbe740994d8d36
-rw-r--r--JavaScriptCore/wtf/Platform.h4
-rw-r--r--WebCore/Android.derived.mk2
-rw-r--r--WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h1
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp11
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.h4
-rw-r--r--WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp18
6 files changed, 39 insertions, 1 deletions
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 221cda6..7924a28 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -610,6 +610,10 @@
#define ENABLE_SMOOTH_SCROLLING 1
#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
+#if PLATFORM(ANDROID)
+#define ENABLE_FULLSCREEN_API 1
+#endif
+
#if PLATFORM(MAC)
#define WTF_USE_CARBON_SECURE_INPUT_MODE 1
#endif
diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk
index ad77a12..7c26491 100644
--- a/WebCore/Android.derived.mk
+++ b/WebCore/Android.derived.mk
@@ -129,7 +129,7 @@ $(GEN): $(LOCAL_BISON)
LOCAL_GENERATED_SOURCES += $(GEN)
# user agent style sheets
-style_sheets := $(LOCAL_PATH)/css/html.css $(LOCAL_PATH)/css/quirks.css $(LOCAL_PATH)/css/view-source.css $(LOCAL_PATH)/css/mediaControls.css $(LOCAL_PATH)/css/mediaControlsAndroid.css
+style_sheets := $(LOCAL_PATH)/css/html.css $(LOCAL_PATH)/css/quirks.css $(LOCAL_PATH)/css/fullscreen.css $(LOCAL_PATH)/css/view-source.css $(LOCAL_PATH)/css/mediaControls.css $(LOCAL_PATH)/css/mediaControlsAndroid.css
ifeq ($(ENABLE_SVG), true)
style_sheets := $(style_sheets) $(LOCAL_PATH)/css/svg.css
endif
diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
index 20a5829..404ef08 100644
--- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
+++ b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
@@ -102,6 +102,7 @@ public:
{
return m_videoLayer;
}
+ void onStopFullscreen();
protected:
// Android-specific methods and fields.
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index 5cfa1b5..6f872b8 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -581,6 +581,7 @@ void ChromeClientAndroid::enterFullscreenForNode(Node* node)
FrameView* frameView = m_webFrame->page()->mainFrame()->view();
android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView);
+ m_webFrame->page()->mainFrame()->document()->webkitWillEnterFullScreenForElement(videoElement);
if (core)
core->enterFullscreenForVideoLayer(layer->uniqueId(), url);
}
@@ -590,5 +591,15 @@ void ChromeClientAndroid::exitFullscreenForNode(Node* node)
}
#endif
+#if ENABLE(FULLSCREEN_API)
+void ChromeClientAndroid::exitFullScreenForElement(Element* element)
+{
+ if (!element)
+ return;
+
+ HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(element);
+ videoElement->exitFullscreen();
+}
+#endif
}
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
index 2b6f68a..d49cec8 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
@@ -187,6 +187,10 @@ namespace android {
virtual void webAppCanBeInstalled();
#endif
+#if ENABLE(FULLSCREEN_API)
+ virtual void exitFullScreenForElement(Element*);
+#endif
+
#if ENABLE(VIDEO)
virtual bool supportsFullscreenForNode(const WebCore::Node*);
virtual void enterFullscreenForNode(WebCore::Node*);
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index 982e384..e6a2710 100644
--- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -180,6 +180,14 @@ void MediaPlayerPrivate::onTimeupdate(int position)
m_player->timeChanged();
}
+void MediaPlayerPrivate::onStopFullscreen()
+{
+ if (m_player && m_player->mediaPlayerClient()
+ && m_player->mediaPlayerClient()->mediaPlayerOwningDocument()) {
+ m_player->mediaPlayerClient()->mediaPlayerOwningDocument()->webkitCancelFullScreen();
+ }
+}
+
class MediaPlayerVideoPrivate : public MediaPlayerPrivate {
public:
void load(const String& url)
@@ -590,6 +598,14 @@ static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex,
return true;
}
+static void OnStopFullscreen(JNIEnv* env, jobject obj, int pointer)
+{
+ if (pointer) {
+ WebCore::MediaPlayerPrivate* player =
+ reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
+ player->onStopFullscreen();
+ }
+}
/*
* JNI registration
@@ -599,6 +615,8 @@ static JNINativeMethod g_MediaPlayerMethods[] = {
(void*) OnPrepared },
{ "nativeOnEnded", "(I)V",
(void*) OnEnded },
+ { "nativeOnStopFullscreen", "(I)V",
+ (void*) OnStopFullscreen },
{ "nativeOnPaused", "(I)V",
(void*) OnPaused },
{ "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V",