diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-03-11 14:25:43 -0800 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2011-03-11 14:25:43 -0800 |
commit | cc2679391d89b57997f78365d54d99c9ae062db3 (patch) | |
tree | 1aab21756b3105096db14a9fd99de51558dcccb9 /WebKit | |
parent | 418d5bb2d2861f58a456e803f2e4246376585185 (diff) | |
download | external_webkit-cc2679391d89b57997f78365d54d99c9ae062db3.zip external_webkit-cc2679391d89b57997f78365d54d99c9ae062db3.tar.gz external_webkit-cc2679391d89b57997f78365d54d99c9ae062db3.tar.bz2 |
HTML5 Video improvements
- remove the seek buttons on the control bar
- make the control bar translucent
- add a fullscreen button passing the layer id to the java side
bug:2126902
Change-Id: Id9638f6b01f968839eaf4b0bd8cf1603957753af
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/RenderSkinMediaButton.cpp | 3 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 31 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.h | 6 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 1 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 14 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 5 |
6 files changed, 59 insertions, 1 deletions
diff --git a/WebKit/android/RenderSkinMediaButton.cpp b/WebKit/android/RenderSkinMediaButton.cpp index a04f36c..34f2a1a 100644 --- a/WebKit/android/RenderSkinMediaButton.cpp +++ b/WebKit/android/RenderSkinMediaButton.cpp @@ -99,7 +99,7 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT SkRect bounds(r); SkScalar imageMargin = 8; SkPaint paint; - SkColor backgroundColor = SkColorSetARGB(255, 34, 34, 34); + SkColor backgroundColor = SkColorSetARGB(190, 34, 34, 34); paint.setColor(backgroundColor); switch (buttonType) { @@ -115,6 +115,7 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT } case BACKGROUND_SLIDER: { + drawsBackgroundColor = false; drawsImage = false; break; } diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 980c03e..ca28932 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -37,7 +37,10 @@ #include "FrameLoader.h" #include "FrameView.h" #include "Geolocation.h" +#include "HTMLMediaElement.h" +#include "HTMLNames.h" #include "Icon.h" +#include "LayerAndroid.h" #include "Page.h" #include "PopupMenuAndroid.h" #include "ScriptController.h" @@ -557,4 +560,32 @@ void ChromeClientAndroid::webAppCanBeInstalled() } #endif +#if ENABLE(VIDEO) +bool ChromeClientAndroid::supportsFullscreenForNode(const Node* node) +{ + return node->hasTagName(HTMLNames::videoTag); +} + +void ChromeClientAndroid::enterFullscreenForNode(Node* node) +{ + if (!node->hasTagName(HTMLNames::videoTag)) + return; + + HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node); + LayerAndroid* layer = videoElement->platformLayer(); + if (!layer) + return; + + FrameView* frameView = m_webFrame->page()->mainFrame()->view(); + android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView); + if (core) + core->enterFullscreenForVideoLayer(layer->uniqueId()); +} + +void ChromeClientAndroid::exitFullscreenForNode(Node* node) +{ +} +#endif + + } diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 6c8aef1..2b6f68a 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -187,6 +187,12 @@ namespace android { virtual void webAppCanBeInstalled(); #endif +#if ENABLE(VIDEO) + virtual bool supportsFullscreenForNode(const WebCore::Node*); + virtual void enterFullscreenForNode(WebCore::Node*); + virtual void exitFullscreenForNode(WebCore::Node*); +#endif + private: android::WebFrame* m_webFrame; // The Geolocation permissions manager. diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 3abb813..2203ae2 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -283,6 +283,7 @@ public: bool hasAudio() { return false; } // do not display the audio UI bool hasVideo() { return m_hasVideo; } + bool suppportsFullscreen() { return true; } MediaPlayerVideoPrivate(MediaPlayer* player) : MediaPlayerPrivate(player) { diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 34179f2..c956b39 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -299,6 +299,7 @@ struct WebViewCore::JavaGlue { jmethodID m_centerFitRect; jmethodID m_setScrollbarModes; jmethodID m_setInstallableWebApp; + jmethodID m_enterFullscreenForVideoLayer; jmethodID m_setWebTextViewAutoFillable; jmethodID m_selectAt; AutoJObject object(JNIEnv* env) { @@ -396,6 +397,9 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_centerFitRect = GetJMethod(env, clazz, "centerFitRect", "(IIII)V"); m_javaGlue->m_setScrollbarModes = GetJMethod(env, clazz, "setScrollbarModes", "(II)V"); m_javaGlue->m_setInstallableWebApp = GetJMethod(env, clazz, "setInstallableWebApp", "()V"); +#if ENABLE(VIDEO) + m_javaGlue->m_enterFullscreenForVideoLayer = GetJMethod(env, clazz, "enterFullscreenForVideoLayer", "(I)V"); +#endif m_javaGlue->m_setWebTextViewAutoFillable = GetJMethod(env, clazz, "setWebTextViewAutoFillable", "(ILjava/lang/String;)V"); m_javaGlue->m_selectAt = GetJMethod(env, clazz, "selectAt", "(II)V"); env->DeleteLocalRef(clazz); @@ -3608,6 +3612,16 @@ void WebViewCore::notifyWebAppCanBeInstalled() checkException(env); } +#if ENABLE(VIDEO) +void WebViewCore::enterFullscreenForVideoLayer(int layerId) +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + env->CallVoidMethod(m_javaGlue->object(env).get(), + m_javaGlue->m_enterFullscreenForVideoLayer, layerId); + checkException(env); +} +#endif + void WebViewCore::setWebTextViewAutoFillable(int queryId, const string16& previewSummary) { #if ENABLE(WEB_AUTOFILL) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index df7169d..74f4064 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -539,6 +539,11 @@ namespace android { void splitContent(PictureSet*); void notifyWebAppCanBeInstalled(); + +#if ENABLE(VIDEO) + void enterFullscreenForVideoLayer(int layerId); +#endif + void setWebTextViewAutoFillable(int queryId, const string16& previewSummary); DeviceMotionAndOrientationManager* deviceMotionAndOrientationManager() { return &m_deviceMotionAndOrientationManager; } |