diff options
| author | Patrick Scott <phanna@android.com> | 2010-12-03 10:00:15 -0500 |
|---|---|---|
| committer | Patrick Scott <phanna@android.com> | 2010-12-03 10:34:07 -0500 |
| commit | 8598c9fb9f861f25ab14efde9efb19cb91d7df1c (patch) | |
| tree | efd772c4ece32369665f5af68c217c5e600d5b8b /WebKit/android/nav | |
| parent | 82f247bdbb98dd80c44209d87692c650c3704617 (diff) | |
| download | external_webkit-8598c9fb9f861f25ab14efde9efb19cb91d7df1c.zip external_webkit-8598c9fb9f861f25ab14efde9efb19cb91d7df1c.tar.gz external_webkit-8598c9fb9f861f25ab14efde9efb19cb91d7df1c.tar.bz2 | |
Attempt to scroll layers everytime the user drags.
This is part of a frameworks/base change.
Use the composite root bounds for the inval region when updating the UI picture.
This fixes several drawing issues with outdated pictures.
Bug: 3022562
Change-Id: Ic28cfbbe381fdd59368a6d83bb73b01df912b530
Diffstat (limited to 'WebKit/android/nav')
| -rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 23 | ||||
| -rw-r--r-- | WebKit/android/nav/WebView.cpp | 30 |
2 files changed, 20 insertions, 33 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index f0333f2..cbc580d 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -1177,10 +1177,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, originalAbsBounds = absBounds; absBounds.move(globalOffsetX, globalOffsetY); hasClip = nodeRenderer->hasOverflowClip(); -#if ENABLE(ANDROID_OVERFLOW_SCROLL) - if (nodeRenderer->enclosingLayer() && nodeRenderer->enclosingLayer()->hasOverflowParent()) - hasClip = false; -#endif if (node->hasTagName(HTMLNames::canvasTag)) mPictureSetDisabled = true; @@ -1392,12 +1388,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, clip.intersect(parentClip); hasClip = true; } - if (hasClip) { - if (clip.isEmpty()) - continue; // skip this node if clip prevents all drawing - else if (cachedNode.clip(clip) == false) - continue; // skip this node if outside of the clip - } bool isInLayer = false; #if USE(ACCELERATED_COMPOSITING) // If this renderer has a composited parent layer (including itself), @@ -1414,11 +1404,18 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, } isInLayer = true; isUnclipped = true; // assume that layers do not have occluded nodes + hasClip = false; AddLayer(cachedFrame, cachedFrame->size(), layerClip.location(), layer->uniqueId()); } } #endif + if (hasClip) { + if (clip.isEmpty()) + continue; // skip this node if clip prevents all drawing + else if (cachedNode.clip(clip) == false) + continue; // skip this node if outside of the clip + } cachedNode.setNavableRects(); cachedNode.setColorIndex(colorIndex); cachedNode.setExport(exported); @@ -2935,7 +2932,7 @@ void CacheBuilder::TrackLayer(WTF::Vector<LayerTracker>& layerTracker, IntPoint scroll(layer->scrollXOffset(), layer->scrollYOffset()); #if ENABLE(ANDROID_OVERFLOW_SCROLL) // If this is an overflow element, track the content layer. - if (layer->hasOverflowParent() && aLayer->getChild(0)) + if (layer->hasOverflowScroll()) aLayer = aLayer->getChild(0)->getChild(0); if (!aLayer) return; @@ -2945,7 +2942,7 @@ void CacheBuilder::TrackLayer(WTF::Vector<LayerTracker>& layerTracker, LayerTracker& indexTracker = layerTracker.last(); indexTracker.mLayer = aLayer; indexTracker.mRenderLayer = layer; - indexTracker.mBounds = IntRect(FloatRect(aLayer->bounds())); + indexTracker.mBounds = enclosingIntRect(aLayer->bounds()); // Use the absolute location of the layer as the bounds location. This // provides the original offset of nodes in the layer so that we can // translate nodes between their original location and the layer's new @@ -3094,7 +3091,7 @@ bool CacheBuilder::ConstructPartRects(Node* node, const IntRect& bounds, return false; continue; } - if (renderer->hasOverflowClip() == false) { + if (hasClip == false) { if (nodeIsAnchor && test->hasTagName(HTMLNames::divTag)) { IntRect bounds = renderer->absoluteBoundingBoxRect(); // x, y fixup done by AddPartRect int left = bounds.x() + ((RenderBox*)renderer)->paddingLeft() diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 4d92ce8..09a5c74 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -995,14 +995,15 @@ static const LayerAndroid* findScrollableLayer(const LayerAndroid* parent, int x } #endif -const LayerAndroid* scrollableLayer(int x, int y) +int scrollableLayer(int x, int y) { #if USE(ACCELERATED_COMPOSITING) const LayerAndroid* layerRoot = compositeRoot(); if (!layerRoot) return 0; const LayerAndroid* result = findScrollableLayer(layerRoot, x, y); - return result; + if (result) + return result->uniqueId(); #endif return 0; } @@ -2213,31 +2214,20 @@ static int nativeScrollableLayer(JNIEnv* env, jobject jwebview, jint x, jint y) { WebView* view = GET_NATIVE_VIEW(env, jwebview); LOG_ASSERT(view, "view not set in %s", __FUNCTION__); - return (int) view->scrollableLayer(x, y); + return view->scrollableLayer(x, y); } -static bool validLayer(const LayerAndroid* root, const LayerAndroid* layer) { - if (root == layer) - return true; - for (int i = 0; i < root->countChildren(); i++) { - const LayerAndroid* l = root->getChild(i); - if (validLayer(l, layer)) - return true; - } - return false; -} - -static bool nativeScrollLayer(JNIEnv* env, jobject obj, jint pLayer, jint dx, +static bool nativeScrollLayer(JNIEnv* env, jobject obj, jint layerId, jint dx, jint dy) { #if ENABLE(ANDROID_OVERFLOW_SCROLL) WebView* view = GET_NATIVE_VIEW(env, obj); - const LayerAndroid* root = view->compositeRoot(); - LayerAndroid* layer = (LayerAndroid*) pLayer; - if (!validLayer(root, layer)) { + LayerAndroid* root = view->compositeRoot(); + if (!root) + return false; + LayerAndroid* layer = root->findById(layerId); + if (!layer) return false; - } - LOG_ASSERT(layer, "layer not set in %s", __FUNCTION__); return layer->scrollBy(dx, dy); #endif return false; |
