| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PrePaintTreeWalk.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 | 6 |
| 7 #include "core/dom/DocumentLifecycle.h" | 7 #include "core/dom/DocumentLifecycle.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| 11 #include "core/layout/LayoutPart.h" | 11 #include "core/layout/LayoutPart.h" |
| 12 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
| 13 #include "core/paint/PaintLayer.h" | 13 #include "core/paint/PaintLayer.h" |
| 14 #include "platform/graphics/paint/GeometryMapper.h" | 14 #include "platform/graphics/paint/GeometryMapper.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 struct PrePaintTreeWalkContext { | 18 struct PrePaintTreeWalkContext { |
| 19 PrePaintTreeWalkContext() | 19 PrePaintTreeWalkContext() |
| 20 : tree_builder_context( | 20 : tree_builder_context( |
| 21 WTF::WrapUnique(new PaintPropertyTreeBuilderContext)), | 21 WTF::WrapUnique(new PaintPropertyTreeBuilderContext)), |
| 22 paint_invalidator_context(tree_builder_context.get()), | |
| 23 ancestor_overflow_paint_layer(nullptr), | 22 ancestor_overflow_paint_layer(nullptr), |
| 24 ancestor_transformed_or_root_paint_layer(nullptr) {} | 23 ancestor_transformed_or_root_paint_layer(nullptr) {} |
| 25 | 24 |
| 26 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parent_context, | 25 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parent_context, |
| 27 bool needs_tree_builder_context) | 26 bool needs_tree_builder_context) |
| 28 : tree_builder_context( | 27 : tree_builder_context( |
| 29 WTF::WrapUnique(needs_tree_builder_context || DCHECK_IS_ON() | 28 WTF::WrapUnique(needs_tree_builder_context || DCHECK_IS_ON() |
| 30 ? new PaintPropertyTreeBuilderContext( | 29 ? new PaintPropertyTreeBuilderContext( |
| 31 *parent_context.tree_builder_context) | 30 *parent_context.tree_builder_context) |
| 32 : nullptr)), | 31 : nullptr)), |
| 33 paint_invalidator_context(tree_builder_context.get(), | 32 paint_invalidator_context(parent_context.paint_invalidator_context), |
| 34 parent_context.paint_invalidator_context), | |
| 35 ancestor_overflow_paint_layer( | 33 ancestor_overflow_paint_layer( |
| 36 parent_context.ancestor_overflow_paint_layer), | 34 parent_context.ancestor_overflow_paint_layer), |
| 37 ancestor_transformed_or_root_paint_layer( | 35 ancestor_transformed_or_root_paint_layer( |
| 38 parent_context.ancestor_transformed_or_root_paint_layer) { | 36 parent_context.ancestor_transformed_or_root_paint_layer) { |
| 39 #if DCHECK_IS_ON() | 37 #if DCHECK_IS_ON() |
| 40 if (needs_tree_builder_context) | 38 if (needs_tree_builder_context) |
| 41 DCHECK(parent_context.tree_builder_context->is_actually_needed); | 39 DCHECK(parent_context.tree_builder_context->is_actually_needed); |
| 42 tree_builder_context->is_actually_needed = needs_tree_builder_context; | 40 tree_builder_context->is_actually_needed = needs_tree_builder_context; |
| 43 #endif | 41 #endif |
| 44 } | 42 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 this->NeedsTreeBuilderContextUpdate(frame_view, parent_context); | 85 this->NeedsTreeBuilderContextUpdate(frame_view, parent_context); |
| 88 PrePaintTreeWalkContext context(parent_context, | 86 PrePaintTreeWalkContext context(parent_context, |
| 89 needs_tree_builder_context_update); | 87 needs_tree_builder_context_update); |
| 90 // ancestorOverflowLayer does not cross frame boundaries. | 88 // ancestorOverflowLayer does not cross frame boundaries. |
| 91 context.ancestor_overflow_paint_layer = nullptr; | 89 context.ancestor_overflow_paint_layer = nullptr; |
| 92 if (context.tree_builder_context) { | 90 if (context.tree_builder_context) { |
| 93 property_tree_builder_.UpdateProperties(frame_view, | 91 property_tree_builder_.UpdateProperties(frame_view, |
| 94 *context.tree_builder_context); | 92 *context.tree_builder_context); |
| 95 } | 93 } |
| 96 paint_invalidator_.InvalidatePaint(frame_view, | 94 paint_invalidator_.InvalidatePaint(frame_view, |
| 95 context.tree_builder_context.get(), |
| 97 context.paint_invalidator_context); | 96 context.paint_invalidator_context); |
| 98 | 97 |
| 99 if (LayoutView* view = frame_view.GetLayoutView()) { | 98 if (LayoutView* view = frame_view.GetLayoutView()) { |
| 100 Walk(*view, context); | 99 Walk(*view, context); |
| 101 #if DCHECK_IS_ON() | 100 #if DCHECK_IS_ON() |
| 102 view->AssertSubtreeClearedPaintInvalidationFlags(); | 101 view->AssertSubtreeClearedPaintInvalidationFlags(); |
| 103 #endif | 102 #endif |
| 104 } | 103 } |
| 105 frame_view.ClearNeedsPaintPropertyUpdate(); | 104 frame_view.ClearNeedsPaintPropertyUpdate(); |
| 106 } | 105 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // This must happen before updatePropertiesForSelf, because the latter reads | 304 // This must happen before updatePropertiesForSelf, because the latter reads |
| 306 // some of the state computed here. | 305 // some of the state computed here. |
| 307 UpdateAuxiliaryObjectProperties(object, context); | 306 UpdateAuxiliaryObjectProperties(object, context); |
| 308 | 307 |
| 309 if (context.tree_builder_context) { | 308 if (context.tree_builder_context) { |
| 310 DCHECK(context.tree_builder_context); | 309 DCHECK(context.tree_builder_context); |
| 311 property_tree_builder_.UpdatePropertiesForSelf( | 310 property_tree_builder_.UpdatePropertiesForSelf( |
| 312 object, *context.tree_builder_context); | 311 object, *context.tree_builder_context); |
| 313 } | 312 } |
| 314 | 313 |
| 315 paint_invalidator_.InvalidatePaint(object, context.paint_invalidator_context); | 314 paint_invalidator_.InvalidatePaint(object, context.tree_builder_context.get(), |
| 315 context.paint_invalidator_context); |
| 316 | 316 |
| 317 if (context.tree_builder_context) { | 317 if (context.tree_builder_context) { |
| 318 property_tree_builder_.UpdatePropertiesForChildren( | 318 property_tree_builder_.UpdatePropertiesForChildren( |
| 319 object, *context.tree_builder_context); | 319 object, *context.tree_builder_context); |
| 320 InvalidatePaintLayerOptimizationsIfNeeded(object, context); | 320 InvalidatePaintLayerOptimizationsIfNeeded(object, context); |
| 321 } | 321 } |
| 322 | 322 |
| 323 for (const LayoutObject* child = object.SlowFirstChild(); child; | 323 for (const LayoutObject* child = object.SlowFirstChild(); child; |
| 324 child = child->NextSibling()) { | 324 child = child->NextSibling()) { |
| 325 if (child->IsLayoutMultiColumnSpannerPlaceholder()) { | 325 if (child->IsLayoutMultiColumnSpannerPlaceholder()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 343 } | 343 } |
| 344 Walk(*frame_view, context); | 344 Walk(*frame_view, context); |
| 345 } | 345 } |
| 346 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 346 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 347 } | 347 } |
| 348 | 348 |
| 349 object.GetMutableForPainting().ClearPaintFlags(); | 349 object.GetMutableForPainting().ClearPaintFlags(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |