summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-10-04 18:01:40 -0700
committerNicolas Roard <nicolasroard@google.com>2011-10-04 18:03:21 -0700
commit3adbe453816c9282bfe1d212e813661ce2590955 (patch)
tree3f2cb5fd1646f1f246629bfd0abf652ef2f3fc41 /Source/WebKit/android
parent89829a24e4efac83486ad878de3438e272aeeddf (diff)
downloadexternal_webkit-3adbe453816c9282bfe1d212e813661ce2590955.zip
external_webkit-3adbe453816c9282bfe1d212e813661ce2590955.tar.gz
external_webkit-3adbe453816c9282bfe1d212e813661ce2590955.tar.bz2
Streamline the layers update codepath.
Directly update the layers transform and position. This makes updates faster and less dependent on other webkit work. counterpart java CL: https://android-git.corp.google.com/g/#/c/139853/ bug:5218173 Change-Id: I03a76ab853e81f0f12177fb785707ffb8dace330
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp33
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h1
2 files changed, 22 insertions, 12 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 26c73b2..6d6b81c 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -919,6 +919,19 @@ void WebViewCore::rebuildPictureSet(PictureSet* pictureSet)
#endif
}
+bool WebViewCore::updateLayers(LayerAndroid* layers)
+{
+ // We update the 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;
+}
+
BaseLayerAndroid* WebViewCore::createBaseLayer()
{
BaseLayerAndroid* base = new BaseLayerAndroid();
@@ -4119,20 +4132,16 @@ void WebViewCore::addVisitedLink(const UChar* string, int length)
m_groupForVisitedLinks->addVisitedLink(string, length);
}
-static jint UpdateLayers(JNIEnv *env, jobject obj, jobject region)
+static bool UpdateLayers(JNIEnv *env, jobject obj, jint jbaseLayer)
{
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- BaseLayerAndroid* result = viewImpl->createBaseLayer();
- SkRegion* nativeRegion = GraphicsJNI::getNativeRegion(env, region);
- if (result) {
- SkIRect bounds;
- LayerAndroid* root = static_cast<LayerAndroid*>(result->getChild(0));
- if (root) {
- root->bounds().roundOut(&bounds);
- nativeRegion->setRect(bounds);
- }
+ BaseLayerAndroid* baseLayer = (BaseLayerAndroid*) jbaseLayer;
+ if (baseLayer) {
+ LayerAndroid* root = static_cast<LayerAndroid*>(baseLayer->getChild(0));
+ if (root)
+ return viewImpl->updateLayers(root);
}
- return reinterpret_cast<jint>(result);
+ return true;
}
static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt)
@@ -4707,7 +4716,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) UpdateFrameCache },
{ "nativeGetContentMinPrefWidth", "()I",
(void*) GetContentMinPrefWidth },
- { "nativeUpdateLayers", "(Landroid/graphics/Region;)I",
+ { "nativeUpdateLayers", "(I)Z",
(void*) UpdateLayers },
{ "nativeRecordContent", "(Landroid/graphics/Region;Landroid/graphics/Point;)I",
(void*) RecordContent },
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 877f716..a25c5bb 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -525,6 +525,7 @@ namespace android {
// and doing a copy of the layers. The layers' content may be updated
// as we are calling layersSync().
BaseLayerAndroid* createBaseLayer();
+ bool updateLayers(LayerAndroid*);
int textWrapWidth() const { return m_textWrapWidth; }
float scale() const { return m_scale; }