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 ClipPaintPropertyNode_h | 5 #ifndef ClipPaintPropertyNode_h |
6 #define ClipPaintPropertyNode_h | 6 #define ClipPaintPropertyNode_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/geometry/FloatRoundedRect.h" | 9 #include "platform/geometry/FloatRoundedRect.h" |
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
11 #include "wtf/PassRefPtr.h" | 11 #include "wtf/PassRefPtr.h" |
12 #include "wtf/RefCounted.h" | 12 #include "wtf/RefCounted.h" |
13 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
14 | 14 |
15 #include <iosfwd> | 15 #include <iosfwd> |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 // A clip rect created by a css property such as "overflow" or "clip". | 19 // A clip rect created by a css property such as "overflow" or "clip". |
20 // Along with a reference to the transform space the clip rect is based on, | 20 // Along with a reference to the transform space the clip rect is based on, |
21 // and an (optional) parent ClipPaintPropertyNode for inherited clips. | 21 // and an (optional) parent ClipPaintPropertyNode for inherited clips. |
22 class PLATFORM_EXPORT ClipPaintPropertyNode : public RefCounted<ClipPaintPropert
yNode> { | 22 class PLATFORM_EXPORT ClipPaintPropertyNode : public RefCounted<ClipPaintPropert
yNode> { |
23 public: | 23 public: |
24 static PassRefPtr<ClipPaintPropertyNode> create( | 24 static PassRefPtr<ClipPaintPropertyNode> create( |
25 PassRefPtr<ClipPaintPropertyNode> parent, | 25 PassRefPtr<const ClipPaintPropertyNode> parent, |
26 PassRefPtr<TransformPaintPropertyNode> localTransformSpace, | 26 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
27 const FloatRoundedRect& clipRect) | 27 const FloatRoundedRect& clipRect) |
28 { | 28 { |
29 return adoptRef(new ClipPaintPropertyNode(parent, localTransformSpace, c
lipRect)); | 29 return adoptRef(new ClipPaintPropertyNode(parent, localTransformSpace, c
lipRect)); |
30 } | 30 } |
31 | 31 |
32 void update(PassRefPtr<ClipPaintPropertyNode> parent, PassRefPtr<TransformPa
intPropertyNode> localTransformSpace, const FloatRoundedRect& clipRect) | 32 void update(PassRefPtr<const ClipPaintPropertyNode> parent, PassRefPtr<const
TransformPaintPropertyNode> localTransformSpace, const FloatRoundedRect& clipRe
ct) |
33 { | 33 { |
34 m_parent = parent; | 34 m_parent = parent; |
35 m_localTransformSpace = localTransformSpace; | 35 m_localTransformSpace = localTransformSpace; |
36 m_clipRect = clipRect; | 36 m_clipRect = clipRect; |
37 } | 37 } |
38 | 38 |
39 const TransformPaintPropertyNode* localTransformSpace() const { return m_loc
alTransformSpace.get(); } | 39 const TransformPaintPropertyNode* localTransformSpace() const { return m_loc
alTransformSpace.get(); } |
40 const FloatRoundedRect& clipRect() const { return m_clipRect; } | 40 const FloatRoundedRect& clipRect() const { return m_clipRect; } |
41 | 41 |
42 // Reference to inherited clips, or nullptr if this is the only clip. | 42 // Reference to inherited clips, or nullptr if this is the only clip. |
43 const ClipPaintPropertyNode* parent() const { return m_parent.get(); } | 43 const ClipPaintPropertyNode* parent() const { return m_parent.get(); } |
44 | 44 |
45 private: | 45 private: |
46 ClipPaintPropertyNode(PassRefPtr<ClipPaintPropertyNode> parent, PassRefPtr<T
ransformPaintPropertyNode> localTransformSpace, const FloatRoundedRect& clipRect
) | 46 ClipPaintPropertyNode(PassRefPtr<const ClipPaintPropertyNode> parent, PassRe
fPtr<const TransformPaintPropertyNode> localTransformSpace, const FloatRoundedRe
ct& clipRect) |
47 : m_parent(parent), m_localTransformSpace(localTransformSpace), m_clipRe
ct(clipRect) { } | 47 : m_parent(parent), m_localTransformSpace(localTransformSpace), m_clipRe
ct(clipRect) { } |
48 | 48 |
49 RefPtr<ClipPaintPropertyNode> m_parent; | 49 RefPtr<const ClipPaintPropertyNode> m_parent; |
50 RefPtr<TransformPaintPropertyNode> m_localTransformSpace; | 50 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; |
51 FloatRoundedRect m_clipRect; | 51 FloatRoundedRect m_clipRect; |
52 }; | 52 }; |
53 | 53 |
54 // Redeclared here to avoid ODR issues. | 54 // Redeclared here to avoid ODR issues. |
55 // See platform/testing/PaintPrinters.h. | 55 // See platform/testing/PaintPrinters.h. |
56 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); | 56 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
59 | 59 |
60 #endif // ClipPaintPropertyNode_h | 60 #endif // ClipPaintPropertyNode_h |
OLD | NEW |