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 fec8cba6013db4eae08b7764975ab388f8cd88b8..fda2ff3a132260c2eaaa4c177ef67091b1c25c06 100644 |
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp |
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp |
@@ -166,14 +166,34 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
!paint_layer.GetLayoutObject().HasClipRelatedProperty()) |
return; |
+ FragmentData* fragment_data = object.GetMutableForPainting().FirstFragment(); |
+ for (auto& fragment : context.tree_builder_context->fragments) { |
+ DCHECK(fragment_data); |
+ if (InvalidatePaintLayerOptimizationsForFragment( |
+ object, context.ancestor_transformed_or_root_paint_layer, fragment, |
wkorman
2017/05/01 20:29:24
I wondered why this member data name was so long a
chrishtr
2017/05/01 21:43:54
Removed.
chrishtr
2017/05/01 21:54:39
I was wrong, it is needed. It is set on PaintLayer
|
+ *fragment_data)) { |
+ context.paint_invalidator_context.forced_subtree_invalidation_flags |= |
+ PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate; |
+ } |
+ fragment_data = fragment_data->NextFragment(); |
+ } |
+} |
+ |
+bool PrePaintTreeWalk::InvalidatePaintLayerOptimizationsForFragment( |
+ const LayoutObject& object, |
+ const PaintLayer* ancestor_transformed_or_root_paint_layer, |
+ const PaintPropertyTreeBuilderFragmentContext& context, |
+ FragmentData& fragment_data) { |
+ PaintLayer& paint_layer = *ToLayoutBoxModelObject(object).Layer(); |
+ |
const auto& ancestor = |
- context.ancestor_transformed_or_root_paint_layer->GetLayoutObject(); |
+ ancestor_transformed_or_root_paint_layer->GetLayoutObject(); |
PropertyTreeState ancestor_state = *ancestor.LocalBorderBoxProperties(); |
#ifdef CHECK_CLIP_RECTS |
auto respect_overflow_clip = kRespectOverflowClip; |
#endif |
- if (context.ancestor_transformed_or_root_paint_layer->GetCompositingState() == |
+ if (ancestor_transformed_or_root_paint_layer->GetCompositingState() == |
kPaintsIntoOwnBacking) { |
const auto* ancestor_properties = ancestor.PaintProperties(); |
if (ancestor_properties && ancestor_properties->OverflowClip()) { |
@@ -187,20 +207,17 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
#ifdef CHECK_CLIP_RECTS |
const auto& old_clip_rects = |
paint_layer.Clipper(PaintLayer::kDoNotUseGeometryMapper) |
- .PaintingClipRects(context.ancestor_transformed_or_root_paint_layer, |
+ .PaintingClipRects(ancestor_transformed_or_root_paint_layer, |
respect_overflow_clip, LayoutSize()); |
#endif |
const LayoutPoint& ancestor_paint_offset = |
- context.ancestor_transformed_or_root_paint_layer->GetLayoutObject() |
- .PaintOffset(); |
+ ancestor_transformed_or_root_paint_layer->GetLayoutObject().PaintOffset(); |
// TODO(chrishtr): generalize this for multicol. |
- const auto* effect = |
- context.tree_builder_context->fragments[0].current_effect; |
+ const auto* effect = context.current_effect; |
auto overflow_clip_rect = ComputeClipRectForContext( |
- context.tree_builder_context->fragments[0].current, effect, |
- ancestor_state, ancestor_paint_offset); |
+ context.current, effect, ancestor_state, ancestor_paint_offset); |
#ifdef CHECK_CLIP_RECTS |
CHECK(overflow_clip_rect == old_clip_rects.OverflowClipRect().Rect()) |
<< " new=" << overflow_clip_rect.ToString() |
@@ -208,8 +225,7 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
#endif |
auto fixed_clip_rect = ComputeClipRectForContext( |
- context.tree_builder_context->fragments[0].fixed_position, effect, |
- ancestor_state, ancestor_paint_offset); |
+ context.fixed_position, effect, ancestor_state, ancestor_paint_offset); |
#ifdef CHECK_CLIP_RECTS |
CHECK(fixed_clip_rect == old_clip_rects.FixedClipRect().Rect()) |
<< " new=" << fixed_clip_rect.ToString() |
@@ -217,15 +233,14 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
#endif |
auto pos_clip_rect = ComputeClipRectForContext( |
- context.tree_builder_context->fragments[0].absolute_position, effect, |
- ancestor_state, ancestor_paint_offset); |
+ context.absolute_position, effect, ancestor_state, ancestor_paint_offset); |
#ifdef CHECK_CLIP_RECTS |
CHECK(pos_clip_rect == old_clip_rects.PosClipRect().Rect()) |
<< " new=" << pos_clip_rect.ToString() |
<< " old=" << old_clip_rects.PosClipRect().Rect().ToString(); |
#endif |
- const auto* previous_clip_rects = paint_layer.PreviousPaintingClipRects(); |
+ const auto* previous_clip_rects = fragment_data.PreviousPaintingClipRects(); |
if (!previous_clip_rects || |
overflow_clip_rect != previous_clip_rects->OverflowClipRect().Rect() || |
fixed_clip_rect != previous_clip_rects->FixedClipRect().Rect() || |
@@ -234,7 +249,7 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
clip_rects->SetOverflowClipRect(overflow_clip_rect); |
clip_rects->SetFixedClipRect(fixed_clip_rect); |
clip_rects->SetPosClipRect(pos_clip_rect); |
- paint_layer.SetPreviousPaintingClipRects(*clip_rects); |
+ fragment_data.SetPreviousPaintingClipRects(*clip_rects); |
paint_layer.SetNeedsRepaint(); |
paint_layer.SetPreviousPaintPhaseDescendantOutlinesEmpty(false); |
@@ -242,9 +257,9 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded( |
paint_layer.SetPreviousPaintPhaseDescendantBlockBackgroundsEmpty(false); |
// All subsequences which are contained below this paintLayer must also |
// be checked. |
- context.paint_invalidator_context.forced_subtree_invalidation_flags |= |
- PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate; |
+ return true; |
} |
+ return false; |
} |
bool PrePaintTreeWalk::NeedsTreeBuilderContextUpdate( |
@@ -267,6 +282,13 @@ bool PrePaintTreeWalk::NeedsTreeBuilderContextUpdate( |
parent_context.paint_invalidator_context.NeedsVisualRectUpdate(object); |
} |
+void PrePaintTreeWalk::ClearPreviousPaintingClipRectsForTesting( |
+ const LayoutObject& object) { |
+ object.GetMutableForPainting() |
+ .FirstFragment() |
+ ->ClearPreviousPaintingClipRects(); |
+} |
+ |
void PrePaintTreeWalk::Walk(const LayoutObject& object, |
const PrePaintTreeWalkContext& parent_context) { |
// Early out from the tree walk if possible. |