Chromium Code Reviews| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // invalidation. | 136 // invalidation. |
| 137 ObjectPaintProperties::PropertyTreeStateWithOffset contentsProperties() const; | 137 ObjectPaintProperties::PropertyTreeStateWithOffset contentsProperties() const; |
| 138 | 138 |
| 139 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } | 139 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } |
| 140 void clearTransform() { m_transform = nullptr; } | 140 void clearTransform() { m_transform = nullptr; } |
| 141 void clearEffect() { m_effect = nullptr; } | 141 void clearEffect() { m_effect = nullptr; } |
| 142 void clearCssClip() { m_cssClip = nullptr; } | 142 void clearCssClip() { m_cssClip = nullptr; } |
| 143 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } | 143 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } |
| 144 void clearInnerBorderRadiusClip() { m_innerBorderRadiusClip = nullptr; } | 144 void clearInnerBorderRadiusClip() { m_innerBorderRadiusClip = nullptr; } |
| 145 void clearOverflowClip() { m_overflowClip = nullptr; } | 145 void clearOverflowClip() { m_overflowClip = nullptr; } |
| 146 void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; } | |
| 146 void clearPerspective() { m_perspective = nullptr; } | 147 void clearPerspective() { m_perspective = nullptr; } |
| 147 void clearSvgLocalToBorderBoxTransform() { | 148 void clearSvgLocalToBorderBoxTransform() { |
| 148 m_svgLocalToBorderBoxTransform = nullptr; | 149 m_svgLocalToBorderBoxTransform = nullptr; |
| 149 } | 150 } |
| 150 void clearScrollTranslation() { m_scrollTranslation = nullptr; } | 151 void clearScrollTranslation() { m_scrollTranslation = nullptr; } |
| 151 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } | 152 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } |
| 152 void clearScroll() { m_scroll = nullptr; } | 153 void clearScroll() { m_scroll = nullptr; } |
| 153 | 154 |
| 154 template <typename... Args> | 155 template <typename... Args> |
| 155 TransformPaintPropertyNode* updatePaintOffsetTranslation(Args&&... args) { | 156 TransformPaintPropertyNode* updatePaintOffsetTranslation(Args&&... args) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 } | 203 } |
| 203 template <typename... Args> | 204 template <typename... Args> |
| 204 ClipPaintPropertyNode* updateInnerBorderRadiusClip(Args&&... args) { | 205 ClipPaintPropertyNode* updateInnerBorderRadiusClip(Args&&... args) { |
| 205 return updateProperty(m_innerBorderRadiusClip, std::forward<Args>(args)...); | 206 return updateProperty(m_innerBorderRadiusClip, std::forward<Args>(args)...); |
| 206 } | 207 } |
| 207 template <typename... Args> | 208 template <typename... Args> |
| 208 ClipPaintPropertyNode* updateOverflowClip(Args&&... args) { | 209 ClipPaintPropertyNode* updateOverflowClip(Args&&... args) { |
| 209 return updateProperty(m_overflowClip, std::forward<Args>(args)...); | 210 return updateProperty(m_overflowClip, std::forward<Args>(args)...); |
| 210 } | 211 } |
| 211 | 212 |
| 213 std::unique_ptr<ObjectPaintProperties> clone() const { | |
|
chrishtr
2016/10/21 22:03:09
It would be cool to make this with copy constructo
pdr.
2016/10/26 03:10:48
I played with this for a while but couldn't find a
| |
| 214 std::unique_ptr<ObjectPaintProperties> cloned = create(); | |
| 215 if (m_paintOffsetTranslation) | |
| 216 cloned->m_paintOffsetTranslation = m_paintOffsetTranslation->clone(); | |
| 217 if (m_transform) | |
| 218 cloned->m_transform = m_transform->clone(); | |
| 219 if (m_effect) | |
| 220 cloned->m_effect = m_effect->clone(); | |
| 221 if (m_cssClip) | |
| 222 cloned->m_cssClip = m_cssClip->clone(); | |
| 223 if (m_cssClipFixedPosition) | |
| 224 cloned->m_cssClipFixedPosition = m_cssClipFixedPosition->clone(); | |
| 225 if (m_innerBorderRadiusClip) | |
| 226 cloned->m_innerBorderRadiusClip = m_innerBorderRadiusClip->clone(); | |
| 227 if (m_overflowClip) | |
| 228 cloned->m_overflowClip = m_overflowClip->clone(); | |
| 229 if (m_perspective) | |
| 230 cloned->m_perspective = m_perspective->clone(); | |
| 231 if (m_svgLocalToBorderBoxTransform) { | |
| 232 cloned->m_svgLocalToBorderBoxTransform = | |
| 233 m_svgLocalToBorderBoxTransform->clone(); | |
| 234 } | |
| 235 if (m_scrollTranslation) | |
| 236 cloned->m_scrollTranslation = m_scrollTranslation->clone(); | |
| 237 if (m_scrollbarPaintOffset) | |
| 238 cloned->m_scrollbarPaintOffset = m_scrollbarPaintOffset->clone(); | |
| 239 if (m_scroll) | |
| 240 cloned->m_scroll = m_scroll->clone(); | |
| 241 if (m_localBorderBoxProperties) { | |
| 242 auto& state = m_localBorderBoxProperties->propertyTreeState; | |
| 243 cloned->m_localBorderBoxProperties = | |
| 244 wrapUnique(new PropertyTreeStateWithOffset( | |
| 245 m_localBorderBoxProperties->paintOffset, | |
| 246 PropertyTreeState(state.transform(), state.clip(), state.effect(), | |
| 247 state.scroll()))); | |
| 248 } | |
| 249 return cloned; | |
| 250 } | |
| 251 | |
| 212 private: | 252 private: |
| 213 ObjectPaintProperties() {} | 253 ObjectPaintProperties() {} |
| 214 | 254 |
| 215 template <typename PaintPropertyNode, typename... Args> | 255 template <typename PaintPropertyNode, typename... Args> |
| 216 PaintPropertyNode* updateProperty(RefPtr<PaintPropertyNode>& field, | 256 PaintPropertyNode* updateProperty(RefPtr<PaintPropertyNode>& field, |
| 217 Args&&... args) { | 257 Args&&... args) { |
| 218 if (field) | 258 if (field) |
| 219 field->update(std::forward<Args>(args)...); | 259 field->update(std::forward<Args>(args)...); |
| 220 else | 260 else |
| 221 field = PaintPropertyNode::create(std::forward<Args>(args)...); | 261 field = PaintPropertyNode::create(std::forward<Args>(args)...); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 235 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 275 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 236 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 276 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
| 237 RefPtr<ScrollPaintPropertyNode> m_scroll; | 277 RefPtr<ScrollPaintPropertyNode> m_scroll; |
| 238 | 278 |
| 239 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; | 279 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; |
| 240 }; | 280 }; |
| 241 | 281 |
| 242 } // namespace blink | 282 } // namespace blink |
| 243 | 283 |
| 244 #endif // ObjectPaintProperties_h | 284 #endif // ObjectPaintProperties_h |
| OLD | NEW |