summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2011-02-16 13:35:37 -0500
committerPatrick Scott <phanna@android.com>2011-02-16 13:35:37 -0500
commit7dfcd11a5bb620c10f2f1c9f35b01004fed51507 (patch)
tree345b99be087a21408aad6a980dfc3783ebf7ea2c
parent944d70ebdb065af6f4c2438f418c7defb18a3aee (diff)
downloadexternal_webkit-7dfcd11a5bb620c10f2f1c9f35b01004fed51507.zip
external_webkit-7dfcd11a5bb620c10f2f1c9f35b01004fed51507.tar.gz
external_webkit-7dfcd11a5bb620c10f2f1c9f35b01004fed51507.tar.bz2
Clip nodes to the visible rect.
Do not build scrollable layers if the layer does not draw. No need to ask for a sync since the rebuild happens during a sync. Bug: 3429982 Change-Id: I7740cd4de4e1658e760da7391de708cbdf05cd44
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp4
-rw-r--r--WebKit/android/nav/CachedLayer.cpp27
2 files changed, 28 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 49f20ab..ccc872a 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -467,7 +467,7 @@ void GraphicsLayerAndroid::updateScrollingLayers()
{
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
RenderLayer* layer = renderLayerFromClient(m_client);
- if (!layer)
+ if (!layer || !m_haveContents)
return;
bool hasOverflowScroll = m_foregroundLayer || m_contentLayer->contentIsScrollable();
bool layerNeedsOverflow = layer->hasOverflowScroll();
@@ -508,7 +508,6 @@ void GraphicsLayerAndroid::updateScrollingLayers()
}
// Need to rebuild our children based on the new structure.
m_needsSyncChildren = true;
- askForSync();
} else {
ASSERT(hasOverflowScroll && !layerNeedsOverflow && !iframeNeedsOverflow);
ASSERT(m_contentLayer);
@@ -531,7 +530,6 @@ void GraphicsLayerAndroid::updateScrollingLayers()
}
// Children are all re-parented.
m_needsSyncChildren = true;
- askForSync();
}
#endif
}
diff --git a/WebKit/android/nav/CachedLayer.cpp b/WebKit/android/nav/CachedLayer.cpp
index d5385bd..3321797 100644
--- a/WebKit/android/nav/CachedLayer.cpp
+++ b/WebKit/android/nav/CachedLayer.cpp
@@ -55,9 +55,36 @@ IntRect CachedLayer::adjustBounds(const LayerAndroid* root,
temp.move(position.x(), position.y());
// Add in any layer translation.
+ // FIXME: Should use bounds() and apply the entire transformation matrix.
const FloatPoint& translation = aLayer->translation();
temp.move(translation.x(), translation.y());
+ SkRect clip;
+ aLayer->bounds(&clip);
+
+ // Do not try to traverse the parent chain if this is the root as the parent
+ // will not be a LayerAndroid.
+ if (aLayer != root) {
+ LayerAndroid* parent = static_cast<LayerAndroid*>(aLayer->getParent());
+ while (parent) {
+ SkRect pClip;
+ parent->bounds(&pClip);
+
+ // Move our position into our parent's coordinate space.
+ clip.offset(pClip.fLeft, pClip.fTop);
+ // Clip our visible rectangle to the parent.
+ clip.intersect(pClip);
+
+ // Stop at the root.
+ if (parent == root)
+ break;
+ parent = static_cast<LayerAndroid*>(parent->getParent());
+ }
+ }
+
+ // Intersect the result with the visible clip.
+ temp.intersect(clip);
+
IntRect result = enclosingIntRect(temp);
DBG_NAV_LOGV("root=%p aLayer=%p [%d]"