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 LayoutObject; | 18 class LayoutObject; |
19 class ObjectPaintProperties; | 19 class ObjectPaintProperties; |
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 most recent | 22 // It's responsible for bookkeeping tree state in other order, for example, the most recent |
23 // position container seen. | 23 // position container seen. |
24 struct PaintPropertyTreeBuilderContext { | 24 struct PaintPropertyTreeBuilderContext { |
25 // State that propagates on the containing block chain (and so is adjusted | 25 // State that propagates on the container chain (and so is adjusted when an |
chrishtr
2016/10/06 16:22:32
What do mean by container? Calling container()? pa
Xianzhu
2016/10/06 16:47:48
container().
Previous "containing block" was not
chrishtr
2016/10/06 16:54:21
container() is actually containing block, as defin
Xianzhu
2016/10/06 17:33:00
I should have read Walter's doc more thoroughly. I
| |
26 // when an absolute or fixed position object is encountered). | 26 // absolute or fixed position object is encountered). |
27 struct ContainingBlockContext { | 27 struct ContainerContext { |
28 // The combination of a transform and paint offset describes a linear space. | 28 // 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 to refer | 29 // When a layout object recur to its children, the main context is expected to refer |
30 // the object's border box, then the callee will derive its own border box b y translating | 30 // the object's border box, then the callee will derive its own border box b y translating |
31 // the space with its own layout location. | 31 // the space with its own layout location. |
32 const TransformPaintPropertyNode* transform = nullptr; | 32 const TransformPaintPropertyNode* transform = nullptr; |
33 LayoutPoint paintOffset; | 33 LayoutPoint paintOffset; |
34 // Whether newly created children should flatten their inherited transform | 34 // Whether newly created children should flatten their inherited transform |
35 // (equivalently, draw into the plane of their parent). Should generally | 35 // (equivalently, draw into the plane of their parent). Should generally |
36 // be updated whenever |transform| is; flattening only needs to happen | 36 // be updated whenever |transform| is; flattening only needs to happen |
37 // to immediate children. | 37 // to immediate children. |
38 bool shouldFlattenInheritedTransform = false; | 38 bool shouldFlattenInheritedTransform = false; |
39 // Rendering context for 3D sorting. See | 39 // Rendering context for 3D sorting. See |
40 // TransformPaintPropertyNode::renderingContextID. | 40 // TransformPaintPropertyNode::renderingContextID. |
41 unsigned renderingContextID = 0; | 41 unsigned renderingContextID = 0; |
42 // The clip node describes the accumulated raster clip for the current subtr ee. | 42 // The clip node describes the accumulated raster clip for the current subtr ee. |
43 // Note that the computed raster region in canvas space for a clip node is i ndependent from | 43 // Note that the computed raster region in canvas space for a clip node is i ndependent from |
44 // the transform and paint offset above. Also the actual raster region may b e affected | 44 // the transform and paint offset above. Also the actual raster region may b e affected |
45 // by layerization and occlusion tracking. | 45 // by layerization and occlusion tracking. |
46 const ClipPaintPropertyNode* clip = nullptr; | 46 const ClipPaintPropertyNode* clip = nullptr; |
47 // The scroll node contains information for scrolling such as the parent scr oll space, the | 47 // The scroll node contains information for scrolling such as the parent scr oll space, the |
48 // extent that can be scrolled, etc. Because scroll nodes reference a scroll offset | 48 // extent that can be scrolled, etc. Because scroll nodes reference a scroll offset |
49 // transform, scroll nodes should be updated if the transform tree changes. | 49 // transform, scroll nodes should be updated if the transform tree changes. |
50 ScrollPaintPropertyNode* scroll = nullptr; | 50 ScrollPaintPropertyNode* scroll = nullptr; |
51 }; | 51 }; |
52 | 52 |
53 ContainingBlockContext current; | 53 ContainerContext current; |
54 | 54 |
55 // Separate context for out-of-flow positioned and fixed positioned elements a re needed | 55 // Separate context for out-of-flow positioned and fixed positioned elements |
56 // because they don't use DOM parent as their containing block. | 56 // are needed because they don't use DOM parent as their container. |
57 // These additional contexts normally pass through untouched, and are only cop ied from | 57 // These additional contexts normally pass through untouched, and are only |
58 // the main context when the current element serves as the containing block of corresponding | 58 // copied from the main context when the current element serves as the |
59 // positioned descendants. | 59 // container of corresponding positioned descendants. |
60 // Overflow clips are also inherited by containing block tree instead of DOM t ree, thus they | 60 // Overflow clips are also inherited by container tree instead of DOM tree, |
61 // are included in the additional context too. | 61 // thus they are included in the additional context too. |
62 ContainingBlockContext absolutePosition; | 62 ContainerContext absolutePosition; |
63 const LayoutObject* containerForAbsolutePosition = nullptr; | 63 const LayoutObject* containerForAbsolutePosition = nullptr; |
64 | 64 |
65 ContainingBlockContext fixedPosition; | 65 ContainerContext fixedPosition; |
66 | 66 |
67 // The effect hierarchy is applied by the stacking context tree. It is guarant eed that every | 67 // The effect hierarchy is applied by the stacking context tree. It is guarant eed that every |
68 // DOM descendant is also a stacking context descendant. Therefore, we don't n eed extra | 68 // DOM descendant is also a stacking context descendant. Therefore, we don't n eed extra |
69 // bookkeeping for effect nodes and can generate the effect tree from a DOM-or der traversal. | 69 // bookkeeping for effect nodes and can generate the effect tree from a DOM-or der traversal. |
70 const EffectPaintPropertyNode* currentEffect = nullptr; | 70 const EffectPaintPropertyNode* currentEffect = nullptr; |
71 | |
72 bool isUnderMultiColumnSpanner = false; | |
71 }; | 73 }; |
72 | 74 |
73 // Creates paint property tree nodes for special things in the layout tree. | 75 // Creates paint property tree nodes for special things in the layout tree. |
74 // Special things include but not limit to: overflow clip, transform, fixed-pos, animation, | 76 // Special things include but not limit to: overflow clip, transform, fixed-pos, animation, |
75 // mask, filter, ... etc. | 77 // mask, filter, ... etc. |
76 // It expects to be invoked for each layout tree node in DOM order during InPreP aint phase. | 78 // It expects to be invoked for each layout tree node in DOM order during InPreP aint phase. |
77 class PaintPropertyTreeBuilder { | 79 class PaintPropertyTreeBuilder { |
78 public: | 80 public: |
79 PaintPropertyTreeBuilderContext setupInitialContext(); | 81 PaintPropertyTreeBuilderContext setupInitialContext(); |
80 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 82 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
(...skipping 29 matching lines...) Expand all Loading... | |
110 static void updateScrollAndScrollTranslation( | 112 static void updateScrollAndScrollTranslation( |
111 const LayoutObject&, | 113 const LayoutObject&, |
112 PaintPropertyTreeBuilderContext&); | 114 PaintPropertyTreeBuilderContext&); |
113 static void updateOutOfFlowContext(const LayoutObject&, | 115 static void updateOutOfFlowContext(const LayoutObject&, |
114 PaintPropertyTreeBuilderContext&); | 116 PaintPropertyTreeBuilderContext&); |
115 }; | 117 }; |
116 | 118 |
117 } // namespace blink | 119 } // namespace blink |
118 | 120 |
119 #endif // PaintPropertyTreeBuilder_h | 121 #endif // PaintPropertyTreeBuilder_h |
OLD | NEW |