summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-04-25 15:18:29 -0700
committerChris Craik <ccraik@google.com>2012-04-25 15:44:43 -0700
commit09bfbe67a95764c51124d12ac88a548e6238bdd1 (patch)
tree1a0c1404c6a9367ac767c7e0e1f481c486473539 /Source/WebKit/android/jni
parent2ad54828a335c8e7337ab1f1077253689630a6d2 (diff)
downloadexternal_webkit-09bfbe67a95764c51124d12ac88a548e6238bdd1.zip
external_webkit-09bfbe67a95764c51124d12ac88a548e6238bdd1.tar.gz
external_webkit-09bfbe67a95764c51124d12ac88a548e6238bdd1.tar.bz2
On new content, attach functor directly
bug:6323847 depends on frameworks/base change: https://android-git.corp.google.com/g/#/c/184313/ Change-Id: I8f21317af746d501c92e338ce678434a2479576c
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r--Source/WebKit/android/jni/ViewStateSerializer.cpp4
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp26
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h6
3 files changed, 18 insertions, 18 deletions
diff --git a/Source/WebKit/android/jni/ViewStateSerializer.cpp b/Source/WebKit/android/jni/ViewStateSerializer.cpp
index 3fdc3e6..5f2480a 100644
--- a/Source/WebKit/android/jni/ViewStateSerializer.cpp
+++ b/Source/WebKit/android/jni/ViewStateSerializer.cpp
@@ -100,6 +100,10 @@ static BaseLayerAndroid* nativeDeserializeViewState(JNIEnv* env, jobject, jint v
BaseLayerAndroid* layer = new BaseLayerAndroid(content);
layer->setBackgroundColor(color);
+ SkRegion dirtyRegion;
+ dirtyRegion.setRect(0, 0, content->width(), content->height());
+ layer->markAsDirty(dirtyRegion);
+
SkSafeUnref(content);
SkSafeUnref(picture);
int childCount = stream->readS32();
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 726a225..e0379a8 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -871,7 +871,7 @@ void WebViewCore::notifyAnimationStarted()
}
-BaseLayerAndroid* WebViewCore::createBaseLayer(SkRegion* region)
+BaseLayerAndroid* WebViewCore::createBaseLayer()
{
// We set the background color
Color background = Color::white;
@@ -950,9 +950,8 @@ BaseLayerAndroid* WebViewCore::createBaseLayer(SkRegion* region)
return realBase;
}
-BaseLayerAndroid* WebViewCore::recordContent(SkRegion* region, SkIPoint* point)
+BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)
{
- DBG_SET_LOG("start");
// If there is a pending style recalculation, just return.
if (m_mainFrame->document()->isPendingStyleRecalc()) {
DBG_SET_LOG("recordContent: pending style recalc, ignoring.");
@@ -965,21 +964,20 @@ BaseLayerAndroid* WebViewCore::recordContent(SkRegion* region, SkIPoint* point)
DBG_SET_LOGD("empty (progress=%g)", progress);
return 0;
}
- region->set(m_addInval);
+
+ BaseLayerAndroid* baseLayer = createBaseLayer();
+
+ baseLayer->markAsDirty(m_addInval);
m_addInval.setEmpty();
#if USE(ACCELERATED_COMPOSITING)
#else
- region->op(m_rebuildInval, SkRegion::kUnion_Op);
+ baseLayer->markAsDirty(m_rebuildInval);
#endif
m_rebuildInval.setEmpty();
point->fX = m_content.width();
point->fY = m_content.height();
- DBG_SET_LOGD("region={%d,%d,r=%d,b=%d}", region->getBounds().fLeft,
- region->getBounds().fTop, region->getBounds().fRight,
- region->getBounds().fBottom);
- DBG_SET_LOG("end");
- return createBaseLayer(region);
+ return baseLayer;
}
void WebViewCore::splitContent(PictureSet* content)
@@ -4553,13 +4551,11 @@ static void NotifyAnimationStarted(JNIEnv* env, jobject obj, jint nativeClass)
viewImpl->notifyAnimationStarted();
}
-static jint RecordContent(JNIEnv* env, jobject obj, jint nativeClass,
- jobject region, jobject pt)
+static jint RecordContent(JNIEnv* env, jobject obj, jint nativeClass, jobject pt)
{
WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass);
- SkRegion* nativeRegion = GraphicsJNI::getNativeRegion(env, region);
SkIPoint nativePt;
- BaseLayerAndroid* result = viewImpl->recordContent(nativeRegion, &nativePt);
+ BaseLayerAndroid* result = viewImpl->recordContent(&nativePt);
GraphicsJNI::ipoint_to_jpoint(nativePt, env, pt);
return reinterpret_cast<jint>(result);
}
@@ -5074,7 +5070,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) GetContentMinPrefWidth },
{ "nativeNotifyAnimationStarted", "(I)V",
(void*) NotifyAnimationStarted },
- { "nativeRecordContent", "(ILandroid/graphics/Region;Landroid/graphics/Point;)I",
+ { "nativeRecordContent", "(ILandroid/graphics/Point;)I",
(void*) RecordContent },
{ "setViewportSettingsFromNative", "(I)V",
(void*) SetViewportSettingsFromNative },
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index eec98b0..3e1dbab 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -510,13 +510,13 @@ namespace android {
bool focusBoundsChanged();
- // record the inval area, and the picture size
- WebCore::BaseLayerAndroid* recordContent(SkRegion* , SkIPoint* );
+ // record content in a new BaseLayerAndroid, copying the layer tree as well
+ WebCore::BaseLayerAndroid* recordContent(SkIPoint* );
// This creates a new BaseLayerAndroid by copying the current m_content
// and doing a copy of the layers. The layers' content may be updated
// as we are calling layersSync().
- WebCore::BaseLayerAndroid* createBaseLayer(SkRegion*);
+ WebCore::BaseLayerAndroid* createBaseLayer();
bool updateLayers(WebCore::LayerAndroid*);
void notifyAnimationStarted();