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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // 1. The set of property nodes created locally by this LayoutObject. | 26 // 1. The set of property nodes created locally by this LayoutObject. |
27 // 2. The set of property nodes (inherited, or created locally) and paint offset | 27 // 2. The set of property nodes (inherited, or created locally) and paint offset |
28 // that can be used to paint the border box of this LayoutObject (see: | 28 // that can be used to paint the border box of this LayoutObject (see: |
29 // localBorderBoxProperties). | 29 // localBorderBoxProperties). |
30 class CORE_EXPORT ObjectPaintProperties { | 30 class CORE_EXPORT ObjectPaintProperties { |
31 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 31 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
32 USING_FAST_MALLOC(ObjectPaintProperties); | 32 USING_FAST_MALLOC(ObjectPaintProperties); |
33 | 33 |
34 public: | 34 public: |
35 static std::unique_ptr<ObjectPaintProperties> create() { | 35 static std::unique_ptr<ObjectPaintProperties> create() { |
36 return wrapUnique(new ObjectPaintProperties()); | 36 return WTF::wrapUnique(new ObjectPaintProperties()); |
37 } | 37 } |
38 | 38 |
39 // The hierarchy of the transform subtree created by a LayoutObject is as | 39 // The hierarchy of the transform subtree created by a LayoutObject is as |
40 // follows: | 40 // follows: |
41 // [ paintOffsetTranslation ] Normally paint offset is accumulated | 41 // [ paintOffsetTranslation ] Normally paint offset is accumulated |
42 // | without creating a node until we see, | 42 // | without creating a node until we see, |
43 // | for example, transform or | 43 // | for example, transform or |
44 // | position:fixed. | 44 // | position:fixed. |
45 // +---[ transform ] The space created by CSS transform. | 45 // +---[ transform ] The space created by CSS transform. |
46 // | This is the local border box space, | 46 // | This is the local border box space, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const ClipPaintPropertyNode* clip, | 130 const ClipPaintPropertyNode* clip, |
131 const EffectPaintPropertyNode* effect, | 131 const EffectPaintPropertyNode* effect, |
132 const ScrollPaintPropertyNode* scroll) { | 132 const ScrollPaintPropertyNode* scroll) { |
133 if (m_localBorderBoxProperties) { | 133 if (m_localBorderBoxProperties) { |
134 m_localBorderBoxProperties->paintOffset = paintOffset; | 134 m_localBorderBoxProperties->paintOffset = paintOffset; |
135 m_localBorderBoxProperties->propertyTreeState.setTransform(transform); | 135 m_localBorderBoxProperties->propertyTreeState.setTransform(transform); |
136 m_localBorderBoxProperties->propertyTreeState.setClip(clip); | 136 m_localBorderBoxProperties->propertyTreeState.setClip(clip); |
137 m_localBorderBoxProperties->propertyTreeState.setEffect(effect); | 137 m_localBorderBoxProperties->propertyTreeState.setEffect(effect); |
138 m_localBorderBoxProperties->propertyTreeState.setScroll(scroll); | 138 m_localBorderBoxProperties->propertyTreeState.setScroll(scroll); |
139 } else { | 139 } else { |
140 m_localBorderBoxProperties = | 140 m_localBorderBoxProperties = WTF::wrapUnique( |
141 wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset( | 141 new ObjectPaintProperties::PropertyTreeStateWithOffset( |
142 paintOffset, PropertyTreeState(transform, clip, effect, scroll))); | 142 paintOffset, PropertyTreeState(transform, clip, effect, scroll))); |
143 } | 143 } |
144 } | 144 } |
145 void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; } | 145 void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; } |
146 | 146 |
147 // This is the complete set of property nodes and paint offset that can be | 147 // This is the complete set of property nodes and paint offset that can be |
148 // used to paint the contents of this object. It is similar to | 148 // used to paint the contents of this object. It is similar to |
149 // localBorderBoxProperties but includes properties (e.g., overflow clip, | 149 // localBorderBoxProperties but includes properties (e.g., overflow clip, |
150 // scroll translation) that apply to contents. This is suitable for paint | 150 // scroll translation) that apply to contents. This is suitable for paint |
151 // invalidation. | 151 // invalidation. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 if (m_scrollTranslation) | 272 if (m_scrollTranslation) |
273 cloned->m_scrollTranslation = m_scrollTranslation->clone(); | 273 cloned->m_scrollTranslation = m_scrollTranslation->clone(); |
274 if (m_scrollbarPaintOffset) | 274 if (m_scrollbarPaintOffset) |
275 cloned->m_scrollbarPaintOffset = m_scrollbarPaintOffset->clone(); | 275 cloned->m_scrollbarPaintOffset = m_scrollbarPaintOffset->clone(); |
276 if (m_scroll) | 276 if (m_scroll) |
277 cloned->m_scroll = m_scroll->clone(); | 277 cloned->m_scroll = m_scroll->clone(); |
278 if (m_localBorderBoxProperties) { | 278 if (m_localBorderBoxProperties) { |
279 auto& state = m_localBorderBoxProperties->propertyTreeState; | 279 auto& state = m_localBorderBoxProperties->propertyTreeState; |
280 cloned->m_localBorderBoxProperties = | 280 cloned->m_localBorderBoxProperties = |
281 wrapUnique(new PropertyTreeStateWithOffset( | 281 WTF::wrapUnique(new PropertyTreeStateWithOffset( |
282 m_localBorderBoxProperties->paintOffset, | 282 m_localBorderBoxProperties->paintOffset, |
283 PropertyTreeState(state.transform(), state.clip(), state.effect(), | 283 PropertyTreeState(state.transform(), state.clip(), state.effect(), |
284 state.scroll()))); | 284 state.scroll()))); |
285 } | 285 } |
286 return cloned; | 286 return cloned; |
287 } | 287 } |
288 #endif | 288 #endif |
289 | 289 |
290 private: | 290 private: |
291 ObjectPaintProperties() {} | 291 ObjectPaintProperties() {} |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 324 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
325 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 325 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
326 RefPtr<ScrollPaintPropertyNode> m_scroll; | 326 RefPtr<ScrollPaintPropertyNode> m_scroll; |
327 | 327 |
328 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; | 328 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; |
329 }; | 329 }; |
330 | 330 |
331 } // namespace blink | 331 } // namespace blink |
332 | 332 |
333 #endif // ObjectPaintProperties_h | 333 #endif // ObjectPaintProperties_h |
OLD | NEW |