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/GeometryMapperClipCache.h" | |
11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
12 #include "wtf/PassRefPtr.h" | 11 #include "wtf/PassRefPtr.h" |
13 #include "wtf/RefCounted.h" | 12 #include "wtf/RefCounted.h" |
14 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
15 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
16 | 15 |
17 #include <iosfwd> | 16 #include <iosfwd> |
18 | 17 |
19 namespace blink { | 18 namespace blink { |
20 | 19 |
21 class GeometryMapperClipCache; | |
22 | |
23 // A clip rect created by a css property such as "overflow" or "clip". | 20 // A clip rect created by a css property such as "overflow" or "clip". |
24 // Along with a reference to the transform space the clip rect is based on, | 21 // Along with a reference to the transform space the clip rect is based on, |
25 // and a parent ClipPaintPropertyNode for inherited clips. | 22 // and a parent ClipPaintPropertyNode for inherited clips. |
26 // | 23 // |
27 // The clip tree is rooted at a node with no parent. This root node should | 24 // The clip tree is rooted at a node with no parent. This root node should |
28 // not be modified. | 25 // not be modified. |
29 class PLATFORM_EXPORT ClipPaintPropertyNode | 26 class PLATFORM_EXPORT ClipPaintPropertyNode |
30 : public RefCounted<ClipPaintPropertyNode> { | 27 : public RefCounted<ClipPaintPropertyNode> { |
31 public: | 28 public: |
32 // This node is really a sentinel, and does not represent a real clip | 29 // This node is really a sentinel, and does not represent a real clip |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 ClipPaintPropertyNode( | 90 ClipPaintPropertyNode( |
94 PassRefPtr<const ClipPaintPropertyNode> parent, | 91 PassRefPtr<const ClipPaintPropertyNode> parent, |
95 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, | 92 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
96 const FloatRoundedRect& clipRect, | 93 const FloatRoundedRect& clipRect, |
97 CompositingReasons directCompositingReasons) | 94 CompositingReasons directCompositingReasons) |
98 : m_parent(parent), | 95 : m_parent(parent), |
99 m_localTransformSpace(localTransformSpace), | 96 m_localTransformSpace(localTransformSpace), |
100 m_clipRect(clipRect), | 97 m_clipRect(clipRect), |
101 m_directCompositingReasons(directCompositingReasons) {} | 98 m_directCompositingReasons(directCompositingReasons) {} |
102 | 99 |
103 // For access to getClipCache(); | |
104 friend class GeometryMapper; | |
105 friend class GeometryMapperTest; | |
106 | |
107 GeometryMapperClipCache& getClipCache() const { | |
108 return const_cast<ClipPaintPropertyNode*>(this)->getClipCache(); | |
109 } | |
110 | |
111 GeometryMapperClipCache& getClipCache() { | |
112 if (!m_geometryMapperClipCache) | |
113 m_geometryMapperClipCache.reset(new GeometryMapperClipCache()); | |
114 return *m_geometryMapperClipCache.get(); | |
115 } | |
116 | |
117 RefPtr<const ClipPaintPropertyNode> m_parent; | 100 RefPtr<const ClipPaintPropertyNode> m_parent; |
118 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; | 101 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; |
119 FloatRoundedRect m_clipRect; | 102 FloatRoundedRect m_clipRect; |
120 CompositingReasons m_directCompositingReasons; | 103 CompositingReasons m_directCompositingReasons; |
121 | |
122 std::unique_ptr<GeometryMapperClipCache> m_geometryMapperClipCache; | |
123 }; | 104 }; |
124 | 105 |
125 // Redeclared here to avoid ODR issues. | 106 // Redeclared here to avoid ODR issues. |
126 // See platform/testing/PaintPrinters.h. | 107 // See platform/testing/PaintPrinters.h. |
127 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); | 108 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); |
128 | 109 |
129 } // namespace blink | 110 } // namespace blink |
130 | 111 |
131 #endif // ClipPaintPropertyNode_h | 112 #endif // ClipPaintPropertyNode_h |
OLD | NEW |