Chromium Code Reviews| 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 83ebd785bdce76b3621a14e01a18a264c8db71fe..501c04fbf3fd9941371fc18c7b551d15c3bdbe49 100644 |
| --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp |
| @@ -20,6 +20,7 @@ struct PrePaintTreeWalkContext { |
| paintInvalidatorContext(treeBuilderContext, |
| parentContext.paintInvalidatorContext) {} |
| + bool needToRebuildPaintPropertyTrees = false; |
| PaintPropertyTreeBuilderContext treeBuilderContext; |
| PaintInvalidatorContext paintInvalidatorContext; |
| }; |
| @@ -41,8 +42,18 @@ void PrePaintTreeWalk::walk(FrameView& frameView, |
| return; |
| PrePaintTreeWalkContext localContext(context); |
| - m_propertyTreeBuilder.buildTreeNodes(frameView, |
| - localContext.treeBuilderContext); |
| + |
| + // Check whether we need to rebuild the paint property trees. |
| + if (!localContext.needToRebuildPaintPropertyTrees) { |
| + if (context.paintInvalidatorContext.forcedSubtreeInvalidationFlags || |
| + !frameView.paintPropertiesValid()) |
| + localContext.needToRebuildPaintPropertyTrees = true; |
| + } |
| + if (localContext.needToRebuildPaintPropertyTrees) |
| + frameView.setPaintPropertiesInvalid(); |
| + |
| + m_propertyTreeBuilder.updateProperties(frameView, |
| + localContext.treeBuilderContext); |
| if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
| m_paintInvalidator.invalidatePaintIfNeeded( |
| @@ -56,12 +67,27 @@ void PrePaintTreeWalk::walk(FrameView& frameView, |
| if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| frameView.layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
| #endif |
| + |
| + frameView.setPaintPropertiesValid(); |
| } |
| void PrePaintTreeWalk::walk(const LayoutObject& object, |
| const PrePaintTreeWalkContext& context) { |
| PrePaintTreeWalkContext localContext(context); |
| + // Check whether we need to rebuild the paint property trees. |
| + if (!localContext.needToRebuildPaintPropertyTrees) { |
|
chrishtr
2016/10/21 22:03:09
Perhaps add a TODO somewhere about unifying the pa
|
| + if (context.paintInvalidatorContext.forcedSubtreeInvalidationFlags || |
| + !object.paintPropertiesValid() || |
| + object |
| + .shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()) |
| + localContext.needToRebuildPaintPropertyTrees = true; |
| + } |
| + if (localContext.needToRebuildPaintPropertyTrees) |
| + object.getMutableForPainting().setPaintPropertiesInvalid(); |
| + |
| + // TODO(pdr): Ensure multi column works with incremental property tree |
| + // construction. |
| if (object.isLayoutMultiColumnSpannerPlaceholder()) { |
| // Walk multi-column spanner as if it replaces the placeholder. |
| // Set the flag so that the tree builder can specially handle out-of-flow |
| @@ -75,12 +101,14 @@ void PrePaintTreeWalk::walk(const LayoutObject& object, |
| return; |
| } |
| - m_propertyTreeBuilder.buildTreeNodesForSelf(object, |
| - localContext.treeBuilderContext); |
| + m_propertyTreeBuilder.updatePropertiesForSelf( |
| + object, localContext.treeBuilderContext); |
| + |
| if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| m_paintInvalidator.invalidatePaintIfNeeded( |
| object, localContext.paintInvalidatorContext); |
| - m_propertyTreeBuilder.buildTreeNodesForChildren( |
| + |
| + m_propertyTreeBuilder.updatePropertiesForChildren( |
| object, localContext.treeBuilderContext); |
| for (const LayoutObject* child = object.slowFirstChild(); child; |
| @@ -104,6 +132,8 @@ void PrePaintTreeWalk::walk(const LayoutObject& object, |
| } |
| // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| } |
| + |
| + object.getMutableForPainting().setPaintPropertiesValid(); |
| } |
| } // namespace blink |