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 #ifndef PaintPropertyTreeBuilder_h | 5 #ifndef PaintPropertyTreeBuilder_h |
6 #define PaintPropertyTreeBuilder_h | 6 #define PaintPropertyTreeBuilder_h |
7 | 7 |
8 #include "platform/geometry/LayoutPoint.h" | 8 #include "platform/geometry/LayoutPoint.h" |
9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | 11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
13 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class FrameView; | 17 class FrameView; |
18 class LayoutBoxModelObject; | 18 class LayoutBoxModelObject; |
19 class LayoutObject; | 19 class LayoutObject; |
20 | 20 |
21 // The context for PaintPropertyTreeBuilder. | 21 // The context for PaintPropertyTreeBuilder. |
22 // It's responsible for bookkeeping tree state in other order, for example, the | 22 // It's responsible for bookkeeping tree state in other order, for example, the |
23 // most recent position container seen. | 23 // most recent position container seen. |
24 struct PaintPropertyTreeBuilderContext { | 24 struct PaintPropertyTreeBuilderContext { |
| 25 #if DCHECK_IS_ON() |
| 26 PaintPropertyTreeBuilderContext() {} |
| 27 PaintPropertyTreeBuilderContext( |
| 28 const PaintPropertyTreeBuilderContext& parent) { |
| 29 *this = parent; |
| 30 parentUpdated = parent.updatedForSelf && parent.updatedForChildren; |
| 31 updatedForSelf = false; |
| 32 updatedForChildren = false; |
| 33 } |
| 34 #endif |
| 35 |
25 // State that propagates on the containing block chain (and so is adjusted | 36 // State that propagates on the containing block chain (and so is adjusted |
26 // when an absolute or fixed position object is encountered). | 37 // when an absolute or fixed position object is encountered). |
27 struct ContainingBlockContext { | 38 struct ContainingBlockContext { |
28 // The combination of a transform and paint offset describes a linear space. | 39 // The combination of a transform and paint offset describes a linear space. |
29 // When a layout object recur to its children, the main context is expected | 40 // When a layout object recur to its children, the main context is expected |
30 // to refer the object's border box, then the callee will derive its own | 41 // to refer the object's border box, then the callee will derive its own |
31 // border box by translating the space with its own layout location. | 42 // border box by translating the space with its own layout location. |
32 const TransformPaintPropertyNode* transform = nullptr; | 43 const TransformPaintPropertyNode* transform = nullptr; |
33 LayoutPoint paintOffset; | 44 LayoutPoint paintOffset; |
34 // Whether newly created children should flatten their inherited transform | 45 // Whether newly created children should flatten their inherited transform |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Some effects are spatial, i.e. may refer to input pixels outside of output | 90 // Some effects are spatial, i.e. may refer to input pixels outside of output |
80 // clip. The cull rect for its input shall be derived from its output clip. | 91 // clip. The cull rect for its input shall be derived from its output clip. |
81 // This variable represents the input cull of current effect, also serves as | 92 // This variable represents the input cull of current effect, also serves as |
82 // output clip of child effects that don't have a hard clip. | 93 // output clip of child effects that don't have a hard clip. |
83 const ClipPaintPropertyNode* inputClipOfCurrentEffect = nullptr; | 94 const ClipPaintPropertyNode* inputClipOfCurrentEffect = nullptr; |
84 | 95 |
85 // True if a change has forced all properties in a subtree to be updated. This | 96 // True if a change has forced all properties in a subtree to be updated. This |
86 // can be set due to paint offset changes or when the structure of the | 97 // can be set due to paint offset changes or when the structure of the |
87 // property tree changes (i.e., a node is added or removed). | 98 // property tree changes (i.e., a node is added or removed). |
88 bool forceSubtreeUpdate = false; | 99 bool forceSubtreeUpdate = false; |
| 100 |
| 101 #if DCHECK_IS_ON() |
| 102 bool parentUpdated = false; |
| 103 bool updatedForSelf = false; |
| 104 bool updatedForChildren = false; |
| 105 #endif |
89 }; | 106 }; |
90 | 107 |
91 // Creates paint property tree nodes for special things in the layout tree. | 108 // Creates paint property tree nodes for special things in the layout tree. |
92 // Special things include but not limit to: overflow clip, transform, fixed-pos, | 109 // Special things include but not limit to: overflow clip, transform, fixed-pos, |
93 // animation, mask, filter, ... etc. | 110 // animation, mask, filter, ... etc. |
94 // It expects to be invoked for each layout tree node in DOM order during | 111 // It expects to be invoked for each layout tree node in DOM order during |
95 // InPrePaint phase. | 112 // InPrePaint phase. |
96 class PaintPropertyTreeBuilder { | 113 class PaintPropertyTreeBuilder { |
97 public: | 114 public: |
98 PaintPropertyTreeBuilderContext setupInitialContext(); | 115 PaintPropertyTreeBuilderContext setupInitialContext(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const LayoutObject&, | 165 const LayoutObject&, |
149 PaintPropertyTreeBuilderContext&); | 166 PaintPropertyTreeBuilderContext&); |
150 ALWAYS_INLINE static void updateOutOfFlowContext( | 167 ALWAYS_INLINE static void updateOutOfFlowContext( |
151 const LayoutObject&, | 168 const LayoutObject&, |
152 PaintPropertyTreeBuilderContext&); | 169 PaintPropertyTreeBuilderContext&); |
153 }; | 170 }; |
154 | 171 |
155 } // namespace blink | 172 } // namespace blink |
156 | 173 |
157 #endif // PaintPropertyTreeBuilder_h | 174 #endif // PaintPropertyTreeBuilder_h |
OLD | NEW |