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

Unified Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2515113002: WIP: Prune the prepaint tree walk (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
index bc59d57869f2f1cd2c9e5df2f5555e721242fad7..e617cb16368927db90ca409c5640c6e06dfe0653 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -60,12 +60,15 @@ void PrePaintTreeWalk::walk(FrameView& frameView,
if (localContext.needToUpdatePaintPropertySubtree)
frameView.setNeedsPaintPropertyUpdate();
- m_propertyTreeBuilder.updateProperties(frameView,
- localContext.treeBuilderContext);
+ auto propertyTreeStructureChanged = m_propertyTreeBuilder.updateProperties(
+ frameView, localContext.treeBuilderContext);
m_paintInvalidator.invalidatePaintIfNeeded(
frameView, localContext.paintInvalidatorContext);
+ if (propertyTreeStructureChanged)
+ localContext.needToUpdatePaintPropertySubtree = true;
+
if (LayoutView* layoutView = frameView.layoutView())
walk(*layoutView, localContext);
@@ -99,6 +102,17 @@ void PrePaintTreeWalk::walk(const LayoutObject& object,
}
}
+ // Early out from the treewalk if possible.
+ if (!object.descendantNeedsPaintPropertyUpdate() &&
+ !localContext.needToUpdatePaintPropertySubtree &&
+ !context.paintInvalidatorContext.forcedSubtreeInvalidationFlags &&
+ !object.shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()) {
+ object.getMutableForPainting().clearPaintInvalidationFlags();
+ object.getMutableForPainting().clearNeedsPaintPropertyUpdate();
+ object.getMutableForPainting().clearDescendantNeedsPaintPropertyUpdate();
+ return;
+ }
+
// Paint properties can depend on their ancestor properties so ensure the
// entire subtree is rebuilt on any changes.
// TODO(pdr): Add additional granularity to the needs update approach such as
@@ -114,19 +128,25 @@ void PrePaintTreeWalk::walk(const LayoutObject& object,
// positioned descendants if their containers are between the multi-column
// container and the spanner. See PaintPropertyTreeBuilder for details.
localContext.treeBuilderContext.isUnderMultiColumnSpanner = true;
- walk(*toLayoutMultiColumnSpannerPlaceholder(object)
- .layoutObjectInFlowThread(),
- localContext);
+ const auto& placeholder = toLayoutMultiColumnSpannerPlaceholder(object);
+ walk(*placeholder.layoutObjectInFlowThread(), localContext);
object.getMutableForPainting().clearPaintInvalidationFlags();
+ object.getMutableForPainting().clearNeedsPaintPropertyUpdate();
+ object.getMutableForPainting().clearDescendantNeedsPaintPropertyUpdate();
return;
}
- m_propertyTreeBuilder.updatePropertiesForSelf(
+ bool propertyTreeStructureChanged = false;
+ propertyTreeStructureChanged |= m_propertyTreeBuilder.updatePropertiesForSelf(
object, localContext.treeBuilderContext);
m_paintInvalidator.invalidatePaintIfNeeded(
object, localContext.paintInvalidatorContext);
- m_propertyTreeBuilder.updatePropertiesForChildren(
- object, localContext.treeBuilderContext);
+ propertyTreeStructureChanged |=
+ m_propertyTreeBuilder.updatePropertiesForChildren(
+ object, localContext.treeBuilderContext);
+
+ if (propertyTreeStructureChanged)
+ localContext.needToUpdatePaintPropertySubtree = true;
for (const LayoutObject* child = object.slowFirstChild(); child;
child = child->nextSibling()) {
@@ -152,6 +172,7 @@ void PrePaintTreeWalk::walk(const LayoutObject& object,
object.getMutableForPainting().clearPaintInvalidationFlags();
object.getMutableForPainting().clearNeedsPaintPropertyUpdate();
+ object.getMutableForPainting().clearDescendantNeedsPaintPropertyUpdate();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698