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

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

Issue 535633002: Common invalidateTreeIfNeeded() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove the ASSERT Created 6 years, 3 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/RenderText.h » ('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 7c7a927b2e69365484122abad4d332f73df97f1c..22e61fe91c68a887f01f5c48568a65fb8cb49af9 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1594,13 +1594,20 @@ const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInvalidationState)
{
+ ASSERT(!needsLayout());
+
// If we didn't need paint invalidation then our children don't need as well.
// Skip walking down the tree as everything should be fine below us.
if (!shouldCheckForPaintInvalidation(paintInvalidationState))
return;
+ invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paintInvalidationContainer());
clearPaintInvalidationState(paintInvalidationState);
+ invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
+}
+void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState& paintInvalidationState)
+{
for (RenderObject* child = slowFirstChild(); child; child = child->nextSibling()) {
if (!child->isOutOfFlowPositioned())
child->invalidateTreeIfNeeded(paintInvalidationState);
@@ -1615,19 +1622,24 @@ static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
return value;
}
-InvalidationReason RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const PaintInvalidationState& paintInvalidationState)
+InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidationContainer)
{
RenderView* v = view();
if (v->document().printing())
return InvalidationNone; // Don't invalidate paints if we're printing.
- const LayoutRect& newBounds = previousPaintInvalidationRect();
- const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContainer();
-
- // FIXME: PaintInvalidationState should not be required here, but the call to flipForWritingMode
- // in mapRectToPaintInvalidationBacking will give us the wrong results with it disabled.
- // crbug.com/393762
- ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContainer, &paintInvalidationState));
+ const LayoutRect oldBounds = previousPaintInvalidationRect();
+ const LayoutPoint oldLocation = previousPositionFromPaintInvalidationContainer();
+ const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidationContainer, &paintInvalidationState);
+ const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationContainer(this, &paintInvalidationContainer, &paintInvalidationState);
+ setPreviousPaintInvalidationRect(newBounds);
+ setPreviousPositionFromPaintInvalidationContainer(newLocation);
+
+ // If we are set to do a full paint invalidation that means the RenderView will issue
+ // paint invalidations. We can then skip issuing of paint invalidations for the child
+ // renderers as they'll be covered by the RenderView.
+ if (view()->doingFullPaintInvalidation())
+ return InvalidationNone;
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject::invalidatePaintIfNeeded()",
"object", this->debugName().ascii(),
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698