diff options
author | John Reck <jreck@google.com> | 2012-04-26 12:27:58 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-26 12:27:58 -0700 |
commit | 73d1421e660c29750c1d41cb24ab56f47e1c6c32 (patch) | |
tree | b7b1bdc7193503d55bc6f564fcff90a0f74c9960 /Source | |
parent | 242a9f31091c6167126ed1cbba87415ceb8ad7a2 (diff) | |
parent | 09bfbe67a95764c51124d12ac88a548e6238bdd1 (diff) | |
download | external_webkit-73d1421e660c29750c1d41cb24ab56f47e1c6c32.zip external_webkit-73d1421e660c29750c1d41cb24ab56f47e1c6c32.tar.gz external_webkit-73d1421e660c29750c1d41cb24ab56f47e1c6c32.tar.bz2 |
Merge "On new content, attach functor directly" into jb-dev
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebKit/android/jni/ViewStateSerializer.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 26 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 6 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 18 |
4 files changed, 24 insertions, 30 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(); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 804a479..c1d6a88 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -515,18 +515,14 @@ static void copyScrollPositionRecursive(const LayerAndroid* from, BaseLayerAndroid* getBaseLayer() const { return m_baseLayer; } -bool setBaseLayer(BaseLayerAndroid* newBaseLayer, SkRegion& inval, bool showVisualIndicator, +bool setBaseLayer(BaseLayerAndroid* newBaseLayer, bool showVisualIndicator, bool isPictureAfterFirstLayout) { bool queueFull = false; #if USE(ACCELERATED_COMPOSITING) - if (m_glWebViewState) { - // TODO: mark as inval on webkit side - if (newBaseLayer) - newBaseLayer->markAsDirty(inval); + if (m_glWebViewState) queueFull = m_glWebViewState->setBaseLayer(newBaseLayer, showVisualIndicator, isPictureAfterFirstLayout); - } #endif #if ENABLE(ANDROID_OVERFLOW_SCROLL) @@ -701,6 +697,7 @@ class GLDrawFunctor : Functor { scale = _scale; extras = _extras; }; + status_t operator()(int messageId, void* data) { TRACE_METHOD(); @@ -871,15 +868,12 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj, jint native return false; } -static bool nativeSetBaseLayer(JNIEnv *env, jobject obj, jint nativeView, jint layer, jobject inval, +static bool nativeSetBaseLayer(JNIEnv *env, jobject obj, jint nativeView, jint layer, jboolean showVisualIndicator, jboolean isPictureAfterFirstLayout) { BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer); - SkRegion invalRegion; - if (inval) - invalRegion = *GraphicsJNI::getNativeRegion(env, inval); - return ((WebView*)nativeView)->setBaseLayer(layerImpl, invalRegion, showVisualIndicator, + return ((WebView*)nativeView)->setBaseLayer(layerImpl, showVisualIndicator, isPictureAfterFirstLayout); } @@ -1257,7 +1251,7 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeLayerBounds }, { "nativeSetHeightCanMeasure", "(Z)V", (void*) nativeSetHeightCanMeasure }, - { "nativeSetBaseLayer", "(IILandroid/graphics/Region;ZZ)Z", + { "nativeSetBaseLayer", "(IIZZ)Z", (void*) nativeSetBaseLayer }, { "nativeGetBaseLayer", "()I", (void*) nativeGetBaseLayer }, |