Title: [134174] trunk/Source/WebCore
- Revision
- 134174
- Author
- [email protected]
- Date
- 2012-11-11 08:58:21 -0800 (Sun, 11 Nov 2012)
Log Message
Save one call to containerForRepaint() when updating layer positions
https://bugs.webkit.org/show_bug.cgi?id=101856
Reviewed by Dan Bernstein.
RenderLayer::updateLayerPositions() has already computed the repaint container,
but calls computeRepaintRects() which computes it again. Computing the repaint
container involves a walk back up the layer tree, so calling it during a tree
traversal is costly.
Fix by passing the repaint container down into computeRepaintRects().
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::computeRepaintRectsIncludingDescendants):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::setHasVisibleContent):
* rendering/RenderLayer.h:
(RenderLayer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (134173 => 134174)
--- trunk/Source/WebCore/ChangeLog 2012-11-11 14:17:46 UTC (rev 134173)
+++ trunk/Source/WebCore/ChangeLog 2012-11-11 16:58:21 UTC (rev 134174)
@@ -1,3 +1,26 @@
+2012-11-10 Simon Fraser <[email protected]>
+
+ Save one call to containerForRepaint() when updating layer positions
+ https://bugs.webkit.org/show_bug.cgi?id=101856
+
+ Reviewed by Dan Bernstein.
+
+ RenderLayer::updateLayerPositions() has already computed the repaint container,
+ but calls computeRepaintRects() which computes it again. Computing the repaint
+ container involves a walk back up the layer tree, so calling it during a tree
+ traversal is costly.
+
+ Fix by passing the repaint container down into computeRepaintRects().
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPositions):
+ (WebCore::RenderLayer::computeRepaintRects):
+ (WebCore::RenderLayer::computeRepaintRectsIncludingDescendants):
+ (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
+ (WebCore::RenderLayer::setHasVisibleContent):
+ * rendering/RenderLayer.h:
+ (RenderLayer):
+
2012-11-11 Kenichi Ishibashi <[email protected]>
WTFString::utf8() should have a mode of conversion to use replacement character
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (134173 => 134174)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-11-11 14:17:46 UTC (rev 134173)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-11-11 16:58:21 UTC (rev 134174)
@@ -401,7 +401,8 @@
RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint();
LayoutRect oldRepaintRect = m_repaintRect;
LayoutRect oldOutlineBox = m_outlineBox;
- computeRepaintRects(offsetFromRoot);
+ computeRepaintRects(repaintContainer, offsetFromRoot);
+
// FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
// as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
if (flags & CheckForRepaint) {
@@ -491,11 +492,10 @@
}
}
-void RenderLayer::computeRepaintRects(LayoutPoint* offsetFromRoot)
+void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintContainer, LayoutPoint* offsetFromRoot)
{
ASSERT(!m_visibleContentStatusDirty);
- RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint();
m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, offsetFromRoot);
}
@@ -505,7 +505,8 @@
{
// FIXME: computeRepaintRects() has to walk up the parent chain for every layer to compute the rects.
// We should make this more efficient.
- computeRepaintRects();
+ // FIXME: it's wrong to call this when layout is not up-to-date, which we do.
+ computeRepaintRects(renderer()->containerForRepaint());
for (RenderLayer* layer = firstChild(); layer; layer = layer->nextSibling())
layer->computeRepaintRectsIncludingDescendants();
@@ -536,12 +537,13 @@
if ((flags & HasSeenViewportConstrainedAncestor) || renderer()->style()->hasViewportConstrainedPosition()) {
// FIXME: Is it worth passing the offsetFromRoot around like in updateLayerPositions?
- computeRepaintRects();
+ // FIXME: We could track the repaint container as we walk down the tree.
+ computeRepaintRects(renderer()->containerForRepaint());
flags |= HasSeenViewportConstrainedAncestor;
} else if ((flags & HasSeenAncestorWithOverflowClip) && !m_canSkipRepaintRectsUpdateOnScroll) {
// If we have seen an overflow clip, we should update our repaint rects as clippedOverflowRectForRepaint
// intersects it with our ancestor overflow clip that may have moved.
- computeRepaintRects();
+ computeRepaintRects(renderer()->containerForRepaint());
}
if (renderer()->hasOverflowClip())
@@ -702,7 +704,7 @@
m_visibleContentStatusDirty = false;
m_hasVisibleContent = true;
- computeRepaintRects();
+ computeRepaintRects(renderer()->containerForRepaint());
if (!isNormalFlowOnly()) {
// We don't collect invisible layers in z-order lists if we are not in compositing mode.
// As we became visible, we need to dirty our stacking contexts ancestors to be properly
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (134173 => 134174)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2012-11-11 14:17:46 UTC (rev 134173)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2012-11-11 16:58:21 UTC (rev 134174)
@@ -699,7 +699,7 @@
void setAncestorChainHasSelfPaintingLayerDescendant();
void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
- void computeRepaintRects(LayoutPoint* offsetFromRoot = 0);
+ void computeRepaintRects(const RenderLayerModelObject* repaintContainer, LayoutPoint* offsetFromRoot = 0);
void computeRepaintRectsIncludingDescendants();
void clearRepaintRects();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes