Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 204843002: Reduce invalidation on children-needs-layout containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: And more and more... Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderTable.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 55681d3691f076fcc3d9efc666168a5f22bcb681..bd9ac117091a897d6ec93eb00354419e3e3ccda5 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -612,6 +612,19 @@ RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
return 0;
}
+bool RenderObject::skipInvalidationWhenLaidOutChildren() const
+{
+ if (!neededLayoutBecauseOfChildren())
+ return false;
+
+ // SVG renderers need to be invalidated when their children are laid out.
+ // RenderBlocks with line boxes are responsible to invalidate them so we can't ignore them.
+ if (isSVG() || (isRenderBlock() && toRenderBlock(this)->firstLineBox()))
+ return false;
+
+ return rendererHasNoBoxEffect();
+}
+
RenderBlock* RenderObject::firstLineBlock() const
{
return 0;
@@ -1665,6 +1678,13 @@ InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
if (oldBounds.size().isZero() || newBounds.size().isZero())
return InvalidationBoundsChange;
+ // This covers the case where we mark containing blocks for layout
+ // and they change size but don't have anything to paint. This is
+ // a pretty common case for <body> as we add / remove children
+ // (and the default background is done by FrameView).
+ if (skipInvalidationWhenLaidOutChildren() && !mayNeedPaintInvalidation())
+ return InvalidationNone;
+
return InvalidationIncremental;
}
@@ -3385,6 +3405,7 @@ void RenderObject::clearPaintInvalidationState()
setShouldDoFullPaintInvalidationAfterLayout(false);
setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false);
setOnlyNeededPositionedMovementLayout(false);
+ setNeededLayoutBecauseOfChildren(false);
setShouldInvalidateOverflowForPaint(false);
setLayoutDidGetCalled(false);
setMayNeedPaintInvalidation(false);
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698