diff options
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 24 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 36 |
2 files changed, 30 insertions, 30 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 52aeb23..1607b0e 100644 --- a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -29,10 +29,6 @@ #if ENABLE(VIDEO) #include "BaseLayerAndroid.h" -#include "DocumentLoader.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" #include "GraphicsContext.h" #include "SkiaUtils.h" #include "TilesManager.h" @@ -168,6 +164,11 @@ void MediaPlayerPrivate::onEnded() m_networkState = MediaPlayer::Idle; } +void MediaPlayerPrivate::onRequestPlay() +{ + play(); +} + void MediaPlayerPrivate::onRestoreState() { if (!m_paused) { @@ -219,11 +220,6 @@ public: if (!env || !m_url.length() || !m_glue->m_javaProxy) return; - // We only play video fullscreen on Android, so stop sites playing fullscreen video in the onload handler. - Frame* frame = m_player->frameView()->frame(); - if (frame && !frame->loader()->documentLoader()->wasOnloadHandled()) - return; - m_paused = false; m_player->playbackStateChanged(); @@ -545,6 +541,14 @@ static void OnEnded(JNIEnv* env, jobject obj, int pointer) } } +static void OnRequestPlay(JNIEnv* env, jobject obj, int pointer) +{ + if (pointer) { + WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer); + player->onRequestPlay(); + } +} + static void OnPaused(JNIEnv* env, jobject obj, int pointer) { if (pointer) { @@ -662,6 +666,8 @@ static JNINativeMethod g_MediaAudioPlayerMethods[] = { (void*) OnEnded }, { "nativeOnPrepared", "(IIII)V", (void*) OnPrepared }, + { "nativeOnRequestPlay", "(I)V", + (void*) OnRequestPlay }, { "nativeOnTimeupdate", "(II)V", (void*) OnTimeupdate }, }; diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index a730907..ad69042 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -486,28 +486,23 @@ void postInvalidateDelayed(int64_t delay, const WebCore::IntRect& bounds) } #if ENABLE(ANDROID_OVERFLOW_SCROLL) -static void copyScrollPositionRecursive(const LayerAndroid* from, - LayerAndroid* root) +static void copyScrollPosition(const LayerAndroid* fromRoot, + LayerAndroid* toRoot, int layerId) { - if (!from || !root) + if (!fromRoot || !toRoot) return; - for (int i = 0; i < from->countChildren(); i++) { - const LayerAndroid* l = from->getChild(i); - if (l->contentIsScrollable()) { - const SkPoint& pos = l->getPosition(); - LayerAndroid* match = root->findById(l->uniqueId()); - if (match && match->contentIsScrollable()) - match->setPosition(pos.fX, pos.fY); - } - copyScrollPositionRecursive(l, root); - } + const LayerAndroid* from = fromRoot->findById(layerId); + LayerAndroid* to = toRoot->findById(layerId); + if (!from || !to || !from->contentIsScrollable() || !to->contentIsScrollable()) + return; + to->setScrollOffset(from->getScrollOffset()); } #endif BaseLayerAndroid* getBaseLayer() const { return m_baseLayer; } bool setBaseLayer(BaseLayerAndroid* newBaseLayer, bool showVisualIndicator, - bool isPictureAfterFirstLayout) + bool isPictureAfterFirstLayout, int scrollingLayer) { bool queueFull = false; #if USE(ACCELERATED_COMPOSITING) @@ -517,10 +512,7 @@ bool setBaseLayer(BaseLayerAndroid* newBaseLayer, bool showVisualIndicator, #endif #if ENABLE(ANDROID_OVERFLOW_SCROLL) - if (newBaseLayer) { - // TODO: the below tree position copies are only necessary in software rendering - copyScrollPositionRecursive(m_baseLayer, newBaseLayer); - } + copyScrollPosition(m_baseLayer, newBaseLayer, scrollingLayer); #endif SkSafeUnref(m_baseLayer); m_baseLayer = newBaseLayer; @@ -949,11 +941,13 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj, jint native static bool nativeSetBaseLayer(JNIEnv *env, jobject obj, jint nativeView, jint layer, jboolean showVisualIndicator, - jboolean isPictureAfterFirstLayout) + jboolean isPictureAfterFirstLayout, + jint scrollingLayer) { BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer); return reinterpret_cast<WebView*>(nativeView)->setBaseLayer(layerImpl, showVisualIndicator, - isPictureAfterFirstLayout); + isPictureAfterFirstLayout, + scrollingLayer); } static BaseLayerAndroid* nativeGetBaseLayer(JNIEnv *env, jobject obj, jint nativeView) @@ -1306,7 +1300,7 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeGetSelection }, { "nativeSetHeightCanMeasure", "(Z)V", (void*) nativeSetHeightCanMeasure }, - { "nativeSetBaseLayer", "(IIZZ)Z", + { "nativeSetBaseLayer", "(IIZZI)Z", (void*) nativeSetBaseLayer }, { "nativeGetBaseLayer", "(I)I", (void*) nativeGetBaseLayer }, |