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/TransformPaintPropertyNode.h" | 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class FrameView; | 16 class FrameView; |
17 class LayoutObject; | 17 class LayoutObject; |
| 18 class ObjectPaintProperties; |
18 | 19 |
19 // The context for PaintPropertyTreeBuilder. | 20 // The context for PaintPropertyTreeBuilder. |
20 // It's responsible for bookkeeping tree state in other order, for example, the
most recent | 21 // It's responsible for bookkeeping tree state in other order, for example, the
most recent |
21 // position container seen. | 22 // position container seen. |
22 struct PaintPropertyTreeBuilderContext { | 23 struct PaintPropertyTreeBuilderContext { |
23 // State that propagates on the containing block chain (and so is adjusted | 24 // State that propagates on the containing block chain (and so is adjusted |
24 // when an absolute or fixed position object is encountered). | 25 // when an absolute or fixed position object is encountered). |
25 struct ContainingBlockContext { | 26 struct ContainingBlockContext { |
26 // The combination of a transform and paint offset describes a linear sp
ace. | 27 // The combination of a transform and paint offset describes a linear sp
ace. |
27 // When a layout object recur to its children, the main context is expec
ted to refer | 28 // When a layout object recur to its children, the main context is expec
ted to refer |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Special things include but not limit to: overflow clip, transform, fixed-pos,
animation, | 61 // Special things include but not limit to: overflow clip, transform, fixed-pos,
animation, |
61 // mask, filter, ... etc. | 62 // mask, filter, ... etc. |
62 // It expects to be invoked for each layout tree node in DOM order during InPreP
aint phase. | 63 // It expects to be invoked for each layout tree node in DOM order during InPreP
aint phase. |
63 class PaintPropertyTreeBuilder { | 64 class PaintPropertyTreeBuilder { |
64 public: | 65 public: |
65 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 66 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
66 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 67 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
67 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); | 68 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
68 | 69 |
69 private: | 70 private: |
| 71 template <typename PropertyNode, void (ObjectPaintProperties::*Setter)(PassR
efPtr<PropertyNode>)> |
| 72 static void clearPaintProperty(const LayoutObject&); |
| 73 |
| 74 template < |
| 75 typename PropertyNode, |
| 76 PropertyNode* (ObjectPaintProperties::*Getter)() const, |
| 77 void (ObjectPaintProperties::*Setter)(PassRefPtr<PropertyNode>), |
| 78 typename... Args> |
| 79 static void updateOrCreatePaintProperty(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&, PropertyNode*& contextProperty, const Args&...); |
| 80 |
70 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT
reeBuilderContext&); | 81 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT
reeBuilderContext&); |
71 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon
text&); | 82 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon
text&); |
72 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex
t&); | 83 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex
t&); |
73 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte
xt&); | 84 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte
xt&); |
74 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&); | 85 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&); |
75 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope
rtyTreeBuilderContext&); | 86 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope
rtyTreeBuilderContext&); |
76 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder
Context&); | 87 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder
Context&); |
77 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC
ontext&); | 88 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC
ontext&); |
78 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro
pertyTreeBuilderContext&); | 89 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro
pertyTreeBuilderContext&); |
79 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu
ilderContext&); | 90 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu
ilderContext&); |
80 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui
lderContext&); | 91 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui
lderContext&); |
81 }; | 92 }; |
82 | 93 |
83 } // namespace blink | 94 } // namespace blink |
84 | 95 |
85 #endif // PaintPropertyTreeBuilder_h | 96 #endif // PaintPropertyTreeBuilder_h |
OLD | NEW |