diff options
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 27 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 1 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 11 |
3 files changed, 29 insertions, 10 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 6cc15d7..839c352 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -885,13 +885,23 @@ bool WebViewCore::updateLayers(LayerAndroid* layers) ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client()); GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync()); if (root) { - root->notifyClientAnimationStarted(); LayerAndroid* updatedLayer = root->contentLayer(); return layers->updateWithTree(updatedLayer); } return true; } +void WebViewCore::notifyAnimationStarted() +{ + // We notify webkit that the animations have begun + // TODO: handle case where not all have begun + ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client()); + GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync()); + if (root) + root->notifyClientAnimationStarted(); + +} + BaseLayerAndroid* WebViewCore::createBaseLayer(SkRegion* region) { BaseLayerAndroid* base = new BaseLayerAndroid(); @@ -920,7 +930,6 @@ BaseLayerAndroid* WebViewCore::createBaseLayer(SkRegion* region) ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client()); GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync()); if (root) { - root->notifyClientAnimationStarted(); LayerAndroid* copyLayer = new LayerAndroid(*root->contentLayer()); base->addChild(copyLayer); copyLayer->unref(); @@ -4104,9 +4113,9 @@ void WebViewCore::addVisitedLink(const UChar* string, int length) m_groupForVisitedLinks->addVisitedLink(string, length); } -static bool UpdateLayers(JNIEnv *env, jobject obj, jint jbaseLayer) +static bool UpdateLayers(JNIEnv *env, jobject obj, jint nativeClass, jint jbaseLayer) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = (WebViewCore*) nativeClass; BaseLayerAndroid* baseLayer = (BaseLayerAndroid*) jbaseLayer; if (baseLayer) { LayerAndroid* root = static_cast<LayerAndroid*>(baseLayer->getChild(0)); @@ -4116,6 +4125,12 @@ static bool UpdateLayers(JNIEnv *env, jobject obj, jint jbaseLayer) return true; } +static void NotifyAnimationStarted(JNIEnv *env, jobject obj, jint nativeClass) +{ + WebViewCore* viewImpl = (WebViewCore*) nativeClass; + viewImpl->notifyAnimationStarted(); +} + static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt) { #ifdef ANDROID_INSTRUMENT @@ -4695,8 +4710,10 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) UpdateFrameCache }, { "nativeGetContentMinPrefWidth", "()I", (void*) GetContentMinPrefWidth }, - { "nativeUpdateLayers", "(I)Z", + { "nativeUpdateLayers", "(II)Z", (void*) UpdateLayers }, + { "nativeNotifyAnimationStarted", "(I)V", + (void*) NotifyAnimationStarted }, { "nativeRecordContent", "(Landroid/graphics/Region;Landroid/graphics/Point;)I", (void*) RecordContent }, { "setViewportSettingsFromNative", "()V", diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index acde590..a05c3ea 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -529,6 +529,7 @@ namespace android { // as we are calling layersSync(). BaseLayerAndroid* createBaseLayer(SkRegion*); bool updateLayers(LayerAndroid*); + void notifyAnimationStarted(); int textWrapWidth() const { return m_textWrapWidth; } float scale() const { return m_scale; } diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 1dfa385..2be01dc 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -172,7 +172,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir, m_javaGlue.m_viewInvalidateRect = GetJMethod(env, clazz, "viewInvalidate", "(IIII)V"); m_javaGlue.m_postInvalidateDelayed = GetJMethod(env, clazz, "viewInvalidateDelayed", "(JIIII)V"); - m_javaGlue.m_pageSwapCallback = GetJMethod(env, clazz, "pageSwapCallback", "()V"); + m_javaGlue.m_pageSwapCallback = GetJMethod(env, clazz, "pageSwapCallback", "(Z)V"); m_javaGlue.m_inFullScreenMode = GetJMethod(env, clazz, "inFullScreenMode", "()Z"); m_javaGlue.m_getTextHandleScale = GetJMethod(env, clazz, "getTextHandleScale", "()F"); env->DeleteLocalRef(clazz); @@ -505,17 +505,18 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, // once the correct scale is set if (!m_visibleRect.hasValidCoordinates()) return false; - bool pagesSwapped = false; + bool treesSwapped = false; + bool newTreeHasAnim = false; bool ret = m_glWebViewState->drawGL(viewRect, m_visibleRect, invalRect, webViewRect, titleBarHeight, clip, scale, - &pagesSwapped); - if (m_pageSwapCallbackRegistered && pagesSwapped) { + &treesSwapped, &newTreeHasAnim); + if (treesSwapped && (m_pageSwapCallbackRegistered || newTreeHasAnim)) { m_pageSwapCallbackRegistered = false; LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!"); JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject javaObject = m_javaGlue.object(env); if (javaObject.get()) { - env->CallVoidMethod(javaObject.get(), m_javaGlue.m_pageSwapCallback); + env->CallVoidMethod(javaObject.get(), m_javaGlue.m_pageSwapCallback, newTreeHasAnim); checkException(env); } } |