| 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 ObjectPaintProperties_h | 5 #ifndef ObjectPaintProperties_h |
| 6 #define ObjectPaintProperties_h | 6 #define ObjectPaintProperties_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/geometry/LayoutPoint.h" | 9 #include "platform/geometry/LayoutPoint.h" |
| 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 11 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 11 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 12 #include "platform/graphics/paint/GeometryPropertyTreeState.h" | 12 #include "platform/graphics/paint/GeometryPropertyTreeState.h" |
| 13 #include "platform/graphics/paint/PaintChunkProperties.h" | 13 #include "platform/graphics/paint/PaintChunkProperties.h" |
| 14 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | 14 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
| 15 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 15 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 16 #include "wtf/PassRefPtr.h" | 16 #include "wtf/PassRefPtr.h" |
| 17 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
| 18 #include "wtf/RefPtr.h" | 18 #include "wtf/RefPtr.h" |
| 19 #include <memory> | 19 #include <memory> |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 // A complete set of paint properties including those that are inherited from ot
her objects. |
| 24 struct PropertyTreeState { |
| 25 PropertyTreeState(const TransformPaintPropertyNode* transformState, |
| 26 const ClipPaintPropertyNode* clipState, const EffectPaintPropertyNode* e
ffectState, |
| 27 const ScrollPaintPropertyNode* scrollState) |
| 28 : transform(transformState), clip(clipState), effect(effectState), scrol
l(scrollState) |
| 29 { |
| 30 DCHECK(transform && clip && effect && scroll); |
| 31 } |
| 32 const TransformPaintPropertyNode* transform; |
| 33 const ClipPaintPropertyNode* clip; |
| 34 const EffectPaintPropertyNode* effect; |
| 35 const ScrollPaintPropertyNode* scroll; |
| 36 }; |
| 37 |
| 23 // This class stores property tree related information associated with a LayoutO
bject. | 38 // This class stores property tree related information associated with a LayoutO
bject. |
| 24 // Currently there are two groups of information: | 39 // Currently there are two groups of information: |
| 25 // 1. The set of property nodes created locally by this LayoutObject. | 40 // 1. The set of property nodes created locally by this LayoutObject. |
| 26 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et | 41 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et |
| 27 // that can be used to paint the border box of this LayoutObject. | 42 // that can be used to paint the border box of this LayoutObject. |
| 28 class CORE_EXPORT ObjectPaintProperties { | 43 class CORE_EXPORT ObjectPaintProperties { |
| 29 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 44 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
| 30 USING_FAST_MALLOC(ObjectPaintProperties); | 45 USING_FAST_MALLOC(ObjectPaintProperties); |
| 31 public: | 46 public: |
| 32 struct LocalBorderBoxProperties; | 47 struct LocalBorderBoxProperties; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip
FixedPosition.get(); } | 87 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip
FixedPosition.get(); } |
| 73 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge
t(); } | 88 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge
t(); } |
| 74 | 89 |
| 75 // This is a complete set of property nodes that should be used as a startin
g point to paint | 90 // This is a complete set of property nodes that should be used as a startin
g point to paint |
| 76 // this layout object. It is needed becauase some property inherits from the
containing block, | 91 // this layout object. It is needed becauase some property inherits from the
containing block, |
| 77 // not painting parent, thus can't be derived in O(1) during paint walk. | 92 // not painting parent, thus can't be derived in O(1) during paint walk. |
| 78 // Note: If this layout object has transform or stacking-context effects, th
ose are already | 93 // Note: If this layout object has transform or stacking-context effects, th
ose are already |
| 79 // baked into in the context here. However for properties that affects only
children, | 94 // baked into in the context here. However for properties that affects only
children, |
| 80 // for example, perspective and overflow clip, those should be applied by th
e painter | 95 // for example, perspective and overflow clip, those should be applied by th
e painter |
| 81 // at the right painting step. | 96 // at the right painting step. |
| 97 // TODO(pdr): Refactor this to use PropertyTreeState. |
| 82 struct LocalBorderBoxProperties { | 98 struct LocalBorderBoxProperties { |
| 83 LayoutPoint paintOffset; | 99 LayoutPoint paintOffset; |
| 84 GeometryPropertyTreeState geometryPropertyTreeState; | 100 GeometryPropertyTreeState geometryPropertyTreeState; |
| 85 const ScrollPaintPropertyNode* scroll; | 101 const ScrollPaintPropertyNode* scroll; |
| 86 }; | 102 }; |
| 87 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_
localBorderBoxProperties.get(); } | 103 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_
localBorderBoxProperties.get(); } |
| 88 // ContentsProperties is the GeometryPropertyTreeState that is the same as i
n | 104 // ContentsProperties is the GeometryPropertyTreeState that is the same as i
n |
| 89 // localBorderBoxProperties, except that it is inside any clips and scrolls
caused by this | 105 // localBorderBoxProperties, except that it is inside any clips and scrolls
caused by this |
| 90 // object. This GeometryPropertyTreeState is suitable as the destination for
paint invalidation. | 106 // object. This GeometryPropertyTreeState is suitable as the destination for
paint invalidation. |
| 91 void getContentsProperties(GeometryPropertyTreeState&) const; | 107 void getContentsProperties(GeometryPropertyTreeState&) const; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 165 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 150 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 166 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
| 151 RefPtr<ScrollPaintPropertyNode> m_scroll; | 167 RefPtr<ScrollPaintPropertyNode> m_scroll; |
| 152 | 168 |
| 153 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; | 169 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; |
| 154 }; | 170 }; |
| 155 | 171 |
| 156 } // namespace blink | 172 } // namespace blink |
| 157 | 173 |
| 158 #endif // ObjectPaintProperties_h | 174 #endif // ObjectPaintProperties_h |
| OLD | NEW |