| 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" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // 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, |
| 62 // mask, filter, ... etc. | 62 // mask, filter, ... etc. |
| 63 // 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. |
| 64 class PaintPropertyTreeBuilder { | 64 class PaintPropertyTreeBuilder { |
| 65 public: | 65 public: |
| 66 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 66 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
| 67 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); | 67 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
| 68 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); | 68 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // Result of computeXXX() functions to indicate which type of paint property
node is needed for the object. |
| 72 enum PaintPropertyNodeType { |
| 73 NoNode, |
| 74 NormalNode, |
| 75 // See isPaintPropertyIsolationBoundary() in PaintPropertyTreeBuilder.cp
p. |
| 76 IsolationNode, |
| 77 }; |
| 78 |
| 71 // Common logic to update a paint property. It tries to reuse the existing p
aint property node of | 79 // Common logic to update a paint property. It tries to reuse the existing p
aint property node of |
| 72 // the object if the value is not changed. Returns the existing or newly cre
ated paint property node, | 80 // the object if the value is not changed. Returns the existing or newly cre
ated paint property node, |
| 73 // or nullptr if no paint property node is needed. | 81 // or nullptr if no paint property node is needed. |
| 74 // It requires a ComputeProperty function which computes the paint property
node value if needed and | 82 // It requires a ComputeProperty function which computes the paint property
node value if needed and |
| 75 // returns true, or returns false if no paint property node value is needed. | 83 // returns PaintPropertyNodeType. |
| 76 template < | 84 template < |
| 77 typename PropertyNode, | 85 typename PropertyNode, |
| 78 PropertyNode* (ObjectPaintProperties::*Getter)() const, | 86 PropertyNode* (ObjectPaintProperties::*Getter)() const, |
| 79 void (ObjectPaintProperties::*Setter)(PassRefPtr<PropertyNode>), | 87 void (ObjectPaintProperties::*Setter)(PassRefPtr<PropertyNode>), |
| 80 bool (*ComputeProperty)(const LayoutObject&, PaintPropertyTreeBuilderCon
text&, typename PropertyNode::Value&)> | 88 PaintPropertyNodeType (*ComputeProperty)(const LayoutObject&, PaintPrope
rtyTreeBuilderContext&, typename PropertyNode::Value&)> |
| 81 static PropertyNode* updateObjectPaintProperty(const LayoutObject&, PaintPro
pertyTreeBuilderContext&, PropertyNode*& contextProperty); | 89 static PropertyNode* updateObjectPaintProperty(const LayoutObject&, PaintPro
pertyTreeBuilderContext&, PropertyNode*& contextProperty); |
| 82 | 90 |
| 83 static bool computePaintOffsetTranslation(const LayoutObject&, PaintProperty
TreeBuilderContext&, TransformPaintPropertyNode::Value&); | 91 static PaintPropertyNodeType computePaintOffsetTranslation(const LayoutObjec
t&, PaintPropertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 84 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT
reeBuilderContext&); | 92 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT
reeBuilderContext&); |
| 85 | 93 |
| 86 static bool computeTransform(const LayoutObject&, PaintPropertyTreeBuilderCo
ntext&, TransformPaintPropertyNode::Value&); | 94 static PaintPropertyNodeType computeTransform(const LayoutObject&, PaintProp
ertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 87 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon
text&); | 95 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon
text&); |
| 88 | 96 |
| 89 static bool computeEffect(const LayoutObject&, PaintPropertyTreeBuilderConte
xt&, EffectPaintPropertyNode::Value&); | 97 static PaintPropertyNodeType computeEffect(const LayoutObject&, PaintPropert
yTreeBuilderContext&, EffectPaintPropertyNode::Value&); |
| 90 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex
t&); | 98 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex
t&); |
| 91 | 99 |
| 92 static bool computeCssClip(const LayoutObject&, PaintPropertyTreeBuilderCont
ext&, ClipPaintPropertyNode::Value&); | 100 static PaintPropertyNodeType computeCssClip(const LayoutObject&, PaintProper
tyTreeBuilderContext&, ClipPaintPropertyNode::Value&); |
| 93 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte
xt&); | 101 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte
xt&); |
| 94 | 102 |
| 95 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&); | 103 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&); |
| 96 | 104 |
| 97 static bool computeScrollbarPaintOffset(const LayoutObject&, const PaintProp
ertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); | 105 static PaintPropertyNodeType computeScrollbarPaintOffset(const LayoutObject&
, const PaintPropertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 98 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope
rtyTreeBuilderContext&); | 106 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope
rtyTreeBuilderContext&); |
| 99 | 107 |
| 100 static bool computeOverflowClip(const LayoutObject&, PaintPropertyTreeBuilde
rContext&, ClipPaintPropertyNode::Value&); | 108 static PaintPropertyNodeType computeOverflowClip(const LayoutObject&, PaintP
ropertyTreeBuilderContext&, ClipPaintPropertyNode::Value&); |
| 101 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder
Context&); | 109 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder
Context&); |
| 102 | 110 |
| 103 static bool computePerspective(const LayoutObject&, PaintPropertyTreeBuilder
Context&, TransformPaintPropertyNode::Value&); | 111 static PaintPropertyNodeType computePerspective(const LayoutObject&, PaintPr
opertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 104 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC
ontext&); | 112 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC
ontext&); |
| 105 | 113 |
| 106 static bool computeSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPr
opertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); | 114 static PaintPropertyNodeType computeSvgLocalToBorderBoxTransform(const Layou
tObject&, PaintPropertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 107 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro
pertyTreeBuilderContext&); | 115 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro
pertyTreeBuilderContext&); |
| 108 | 116 |
| 109 static bool computeScrollTranslation(const LayoutObject&, PaintPropertyTreeB
uilderContext&, TransformPaintPropertyNode::Value&); | 117 static PaintPropertyNodeType computeScrollTranslation(const LayoutObject&, P
aintPropertyTreeBuilderContext&, TransformPaintPropertyNode::Value&); |
| 110 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu
ilderContext&); | 118 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu
ilderContext&); |
| 111 | 119 |
| 112 static bool computeOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBu
ilderContext&, ClipPaintPropertyNode::Value&); | 120 static PaintPropertyNodeType computeOutOfFlowContext(const LayoutObject&, Pa
intPropertyTreeBuilderContext&, ClipPaintPropertyNode::Value&); |
| 113 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui
lderContext&); | 121 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui
lderContext&); |
| 122 |
| 123 #if DCHECK_IS_ON() |
| 124 static void checkPropertyIsolationBoundaryForStackingContext(const LayoutObj
ect&); |
| 125 #endif |
| 114 }; | 126 }; |
| 115 | 127 |
| 116 } // namespace blink | 128 } // namespace blink |
| 117 | 129 |
| 118 #endif // PaintPropertyTreeBuilder_h | 130 #endif // PaintPropertyTreeBuilder_h |
| OLD | NEW |