Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h

Issue 2144823006: Reuse existing paint property node is possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 refernce 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<TransformPaintPropertyNode> localTransformSpace, 26 PassRefPtr<TransformPaintPropertyNode> localTransformSpace,
26 const FloatRoundedRect& clipRect, 27 const FloatRoundedRect& clipRect)
27 PassRefPtr<ClipPaintPropertyNode> parent = nullptr)
28 { 28 {
29 return adoptRef(new ClipPaintPropertyNode(localTransformSpace, clipRect, parent)); 29 return adoptRef(new ClipPaintPropertyNode(parent, localTransformSpace, c lipRect));
30 }
31
32 void update(PassRefPtr<ClipPaintPropertyNode> parent, PassRefPtr<TransformPa intPropertyNode> localTransformSpace, const FloatRoundedRect& clipRect)
33 {
34 m_parent = parent;
35 m_localTransformSpace = localTransformSpace;
36 m_clipRect = clipRect;
30 } 37 }
31 38
32 const TransformPaintPropertyNode* localTransformSpace() const { return m_loc alTransformSpace.get(); } 39 const TransformPaintPropertyNode* localTransformSpace() const { return m_loc alTransformSpace.get(); }
33 const FloatRoundedRect& clipRect() const { return m_clipRect; } 40 const FloatRoundedRect& clipRect() const { return m_clipRect; }
34 41
35 // 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.
36 const ClipPaintPropertyNode* parent() const { return m_parent.get(); } 43 const ClipPaintPropertyNode* parent() const { return m_parent.get(); }
37 44
38 private: 45 private:
39 ClipPaintPropertyNode(PassRefPtr<TransformPaintPropertyNode> localTransformS pace, const FloatRoundedRect& clipRect, PassRefPtr<ClipPaintPropertyNode> parent ) 46 ClipPaintPropertyNode(PassRefPtr<ClipPaintPropertyNode> parent, PassRefPtr<T ransformPaintPropertyNode> localTransformSpace, const FloatRoundedRect& clipRect )
40 : m_localTransformSpace(localTransformSpace), m_clipRect(clipRect), m_pa rent(parent) { } 47 : m_parent(parent), m_localTransformSpace(localTransformSpace), m_clipRe ct(clipRect) { }
41 48
49 RefPtr<ClipPaintPropertyNode> m_parent;
42 RefPtr<TransformPaintPropertyNode> m_localTransformSpace; 50 RefPtr<TransformPaintPropertyNode> m_localTransformSpace;
43 const FloatRoundedRect m_clipRect; 51 FloatRoundedRect m_clipRect;
44 RefPtr<ClipPaintPropertyNode> m_parent;
45 }; 52 };
46 53
47 // Redeclared here to avoid ODR issues. 54 // Redeclared here to avoid ODR issues.
48 // See platform/testing/PaintPrinters.h. 55 // See platform/testing/PaintPrinters.h.
49 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); 56 void PrintTo(const ClipPaintPropertyNode&, std::ostream*);
50 57
51 } // namespace blink 58 } // namespace blink
52 59
53 #endif // ClipPaintPropertyNode_h 60 #endif // ClipPaintPropertyNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698