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