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 USING_FAST_MALLOC(PaintPropertyTreeBuilderContext); | 25 USING_FAST_MALLOC(PaintPropertyTreeBuilderContext); |
26 | 26 |
27 public: | 27 public: |
28 // Initializes all property tree nodes to the roots. | |
29 PaintPropertyTreeBuilderContext(); | |
30 | |
31 // State that propagates on the containing block chain (and so is adjusted | 28 // State that propagates on the containing block chain (and so is adjusted |
32 // when an absolute or fixed position object is encountered). | 29 // when an absolute or fixed position object is encountered). |
33 struct ContainingBlockContext { | 30 struct ContainingBlockContext { |
34 // The combination of a transform and paint offset describes a linear space. | 31 // The combination of a transform and paint offset describes a linear space. |
35 // When a layout object recur to its children, the main context is expected | 32 // When a layout object recur to its children, the main context is expected |
36 // to refer the object's border box, then the callee will derive its own | 33 // to refer the object's border box, then the callee will derive its own |
37 // border box by translating the space with its own layout location. | 34 // border box by translating the space with its own layout location. |
38 const TransformPaintPropertyNode* transform = nullptr; | 35 const TransformPaintPropertyNode* transform = nullptr; |
39 LayoutPoint paintOffset; | 36 LayoutPoint paintOffset; |
40 // Whether newly created children should flatten their inherited transform | 37 // Whether newly created children should flatten their inherited transform |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // clip. The cull rect for its input shall be derived from its output clip. | 83 // clip. The cull rect for its input shall be derived from its output clip. |
87 // This variable represents the input cull of current effect, also serves as | 84 // This variable represents the input cull of current effect, also serves as |
88 // output clip of child effects that don't have a hard clip. | 85 // output clip of child effects that don't have a hard clip. |
89 const ClipPaintPropertyNode* inputClipOfCurrentEffect; | 86 const ClipPaintPropertyNode* inputClipOfCurrentEffect; |
90 | 87 |
91 // True if a change has forced all properties in a subtree to be updated. This | 88 // True if a change has forced all properties in a subtree to be updated. This |
92 // can be set due to paint offset changes or when the structure of the | 89 // can be set due to paint offset changes or when the structure of the |
93 // property tree changes (i.e., a node is added or removed). | 90 // property tree changes (i.e., a node is added or removed). |
94 bool forceSubtreeUpdate; | 91 bool forceSubtreeUpdate; |
95 | 92 |
96 #if DCHECK_IS_ON() | 93 // Initializes all property tree nodes to the roots. |
97 // When DCHECK_IS_ON() we create PaintPropertyTreeBuilderContext even if not | 94 PaintPropertyTreeBuilderContext(); |
98 // needed. See FindPaintOffsetAndVisualRectNeedingUpdate.h. | |
99 bool isActuallyNeeded = true; | |
100 #endif | |
101 }; | 95 }; |
102 | 96 |
103 // Creates paint property tree nodes for special things in the layout tree. | 97 // Creates paint property tree nodes for special things in the layout tree. |
104 // Special things include but not limit to: overflow clip, transform, fixed-pos, | 98 // Special things include but not limit to: overflow clip, transform, fixed-pos, |
105 // animation, mask, filter, ... etc. | 99 // animation, mask, filter, ... etc. |
106 // It expects to be invoked for each layout tree node in DOM order during | 100 // It expects to be invoked for each layout tree node in DOM order during |
107 // InPrePaint phase. | 101 // InPrePaint phase. |
108 class PaintPropertyTreeBuilder { | 102 class PaintPropertyTreeBuilder { |
109 public: | 103 public: |
110 // Update the paint properties for a frame and ensure the context is up to | 104 // Update the paint properties for a frame and ensure the context is up to |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const LayoutObject&, | 153 const LayoutObject&, |
160 PaintPropertyTreeBuilderContext&); | 154 PaintPropertyTreeBuilderContext&); |
161 ALWAYS_INLINE static void updateOutOfFlowContext( | 155 ALWAYS_INLINE static void updateOutOfFlowContext( |
162 const LayoutObject&, | 156 const LayoutObject&, |
163 PaintPropertyTreeBuilderContext&); | 157 PaintPropertyTreeBuilderContext&); |
164 }; | 158 }; |
165 | 159 |
166 } // namespace blink | 160 } // namespace blink |
167 | 161 |
168 #endif // PaintPropertyTreeBuilder_h | 162 #endif // PaintPropertyTreeBuilder_h |
OLD | NEW |