diff options
author | Chris Craik <ccraik@google.com> | 2011-11-29 13:39:24 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-11-29 16:04:54 -0800 |
commit | aeca53d3fee2e94ce013c1dc12648f0335284fbb (patch) | |
tree | 1266a41af9814431faff681061f573987afda7ac /Source/WebKit/android/jni/WebViewCore.cpp | |
parent | 9c0e7d80ade0cc9bbe087838232cd0877fa01a98 (diff) | |
download | external_webkit-aeca53d3fee2e94ce013c1dc12648f0335284fbb.zip external_webkit-aeca53d3fee2e94ce013c1dc12648f0335284fbb.tar.gz external_webkit-aeca53d3fee2e94ce013c1dc12648f0335284fbb.tar.bz2 |
synchronize animation starts with webkit
bug:5239801
this better supports animations not synchronous with webkit
Relies on the frameworks/base CL: https://android-git.corp.google.com/g/#/c/152533/
Change-Id: Ia79a475065b3891db8fc4014559062ab1ac95ebe
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 27 |
1 files changed, 22 insertions, 5 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", |