| 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 |
| 23 // position container seen. | 23 // most recent 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 containing block chain (and so is adjusted |
| 26 // when an absolute or fixed position object is encountered). | 26 // when an absolute or fixed position object is encountered). |
| 27 struct ContainingBlockContext { | 27 struct ContainingBlockContext { |
| 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 |
| 30 // the object's border box, then the callee will derive its own border box b
y translating | 30 // to refer the object's border box, then the callee will derive its own |
| 31 // the space with its own layout location. | 31 // border box by translating 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 |
| 43 // Note that the computed raster region in canvas space for a clip node is i
ndependent from | 43 // subtree. Note that the computed raster region in canvas space for a clip |
| 44 // the transform and paint offset above. Also the actual raster region may b
e affected | 44 // node is independent from the transform and paint offset above. Also the |
| 45 // by layerization and occlusion tracking. | 45 // actual raster region may be affected by layerization and occlusion |
| 46 // tracking. |
| 46 const ClipPaintPropertyNode* clip = nullptr; | 47 const ClipPaintPropertyNode* clip = nullptr; |
| 47 // The scroll node contains information for scrolling such as the parent scr
oll space, the | 48 // The scroll node contains information for scrolling such as the parent |
| 48 // extent that can be scrolled, etc. Because scroll nodes reference a scroll
offset | 49 // scroll space, the extent that can be scrolled, etc. Because scroll nodes |
| 49 // transform, scroll nodes should be updated if the transform tree changes. | 50 // reference a scroll offset transform, scroll nodes should be updated if |
| 51 // the transform tree changes. |
| 50 ScrollPaintPropertyNode* scroll = nullptr; | 52 ScrollPaintPropertyNode* scroll = nullptr; |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 ContainingBlockContext current; | 55 ContainingBlockContext current; |
| 54 | 56 |
| 55 // Separate context for out-of-flow positioned and fixed positioned elements a
re needed | 57 // Separate context for out-of-flow positioned and fixed positioned elements |
| 56 // because they don't use DOM parent as their containing block. | 58 // are needed because they don't use DOM parent as their containing block. |
| 57 // These additional contexts normally pass through untouched, and are only cop
ied from | 59 // 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 | 60 // copied from the main context when the current element serves as the |
| 59 // positioned descendants. | 61 // containing block of corresponding positioned descendants. Overflow clips |
| 60 // Overflow clips are also inherited by containing block tree instead of DOM t
ree, thus they | 62 // are also inherited by containing block tree instead of DOM tree, thus they |
| 61 // are included in the additional context too. | 63 // are included in the additional context too. |
| 62 ContainingBlockContext absolutePosition; | 64 ContainingBlockContext absolutePosition; |
| 63 const LayoutObject* containerForAbsolutePosition = nullptr; | 65 const LayoutObject* containerForAbsolutePosition = nullptr; |
| 64 | 66 |
| 65 ContainingBlockContext fixedPosition; | 67 ContainingBlockContext fixedPosition; |
| 66 | 68 |
| 67 // The effect hierarchy is applied by the stacking context tree. It is guarant
eed that every | 69 // The effect hierarchy is applied by the stacking context tree. It is |
| 68 // DOM descendant is also a stacking context descendant. Therefore, we don't n
eed extra | 70 // guaranteed that every DOM descendant is also a stacking context descendant. |
| 69 // bookkeeping for effect nodes and can generate the effect tree from a DOM-or
der traversal. | 71 // Therefore, we don't need extra bookkeeping for effect nodes and can |
| 72 // generate the effect tree from a DOM-order traversal. |
| 70 const EffectPaintPropertyNode* currentEffect = nullptr; | 73 const EffectPaintPropertyNode* currentEffect = nullptr; |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 // Creates paint property tree nodes for special things in the layout tree. | 76 // 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, | 77 // Special things include but not limit to: overflow clip, transform, fixed-pos, |
| 75 // mask, filter, ... etc. | 78 // animation, mask, filter, ... etc. |
| 76 // It expects to be invoked for each layout tree node in DOM order during InPreP
aint phase. | 79 // It expects to be invoked for each layout tree node in DOM order during |
| 80 // InPrePaint phase. |
| 77 class PaintPropertyTreeBuilder { | 81 class PaintPropertyTreeBuilder { |
| 78 public: | 82 public: |
| 79 PaintPropertyTreeBuilderContext setupInitialContext(); | 83 PaintPropertyTreeBuilderContext setupInitialContext(); |
| 80 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 84 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
| 81 void buildTreeNodesForSelf(const LayoutObject&, | 85 void buildTreeNodesForSelf(const LayoutObject&, |
| 82 PaintPropertyTreeBuilderContext&); | 86 PaintPropertyTreeBuilderContext&); |
| 83 void buildTreeNodesForChildren(const LayoutObject&, | 87 void buildTreeNodesForChildren(const LayoutObject&, |
| 84 PaintPropertyTreeBuilderContext&); | 88 PaintPropertyTreeBuilderContext&); |
| 85 | 89 |
| 86 private: | 90 private: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 110 static void updateScrollAndScrollTranslation( | 114 static void updateScrollAndScrollTranslation( |
| 111 const LayoutObject&, | 115 const LayoutObject&, |
| 112 PaintPropertyTreeBuilderContext&); | 116 PaintPropertyTreeBuilderContext&); |
| 113 static void updateOutOfFlowContext(const LayoutObject&, | 117 static void updateOutOfFlowContext(const LayoutObject&, |
| 114 PaintPropertyTreeBuilderContext&); | 118 PaintPropertyTreeBuilderContext&); |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace blink | 121 } // namespace blink |
| 118 | 122 |
| 119 #endif // PaintPropertyTreeBuilder_h | 123 #endif // PaintPropertyTreeBuilder_h |
| OLD | NEW |