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

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

Issue 2161523002: Isolation of subtrees of stacking contexts and out-of-flow positioned objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CachePaintProperties
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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 TransformPaintPropertyNode_h 5 #ifndef TransformPaintPropertyNode_h
6 #define TransformPaintPropertyNode_h 6 #define TransformPaintPropertyNode_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/geometry/FloatPoint3D.h" 9 #include "platform/geometry/FloatPoint3D.h"
10 #include "platform/graphics/paint/PaintPropertyNode.h"
10 #include "platform/transforms/TransformationMatrix.h" 11 #include "platform/transforms/TransformationMatrix.h"
11 #include "wtf/PassRefPtr.h"
12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h"
14 12
15 #include <iosfwd> 13 #include <iosfwd>
16 14
17 namespace blink { 15 namespace blink {
18 16
19 // A transform created by a css property such as "transform" or "perspective" 17 // A transform created by a css property such as "transform" or "perspective"
20 // along with a reference to the parent TransformPaintPropertyNode, or nullptr 18 // along with a reference to the parent TransformPaintPropertyNode, or nullptr
21 // for the root. 19 // for the root.
22 class PLATFORM_EXPORT TransformPaintPropertyNode : public RefCounted<TransformPa intPropertyNode> { 20 class PLATFORM_EXPORT TransformPaintPropertyNode : public PaintPropertyNode<Tran sformPaintPropertyNode> {
23 public: 21 public:
24 struct Value { 22 struct Value {
25 Value() { } 23 Value() { }
26 Value(const TransformationMatrix& matrix, const FloatPoint3D& origin) : matrix(matrix), origin(origin) { } 24 Value(const TransformationMatrix& matrix, const FloatPoint3D& origin) : matrix(matrix), origin(origin) { }
27 bool operator ==(const Value& other) const { return matrix == other.matr ix && origin == other.origin; } 25 bool operator ==(const Value& other) const { return matrix == other.matr ix && origin == other.origin; }
28 26
29 TransformationMatrix matrix; 27 TransformationMatrix matrix;
30 FloatPoint3D origin; 28 FloatPoint3D origin;
31 }; 29 };
32 30
33 static PassRefPtr<TransformPaintPropertyNode> create(const TransformationMat rix& matrix, const FloatPoint3D& origin, PassRefPtr<TransformPaintPropertyNode> parent = nullptr) 31 static PassRefPtr<TransformPaintPropertyNode> create(const TransformationMat rix& matrix, const FloatPoint3D& origin, PassRefPtr<TransformPaintPropertyNode> parent = nullptr)
34 { 32 {
35 return adoptRef(new TransformPaintPropertyNode(Value(matrix, origin), pa rent)); 33 return adoptRef(new TransformPaintPropertyNode(Value(matrix, origin), pa rent));
36 } 34 }
37 35
38 // This form is required by PaintPropertyTreeBuilder::updateObjectPaintPrope rties(). 36 // This form is required by PaintPropertyTreeBuilder::updateObjectPaintPrope rties().
39 static PassRefPtr<TransformPaintPropertyNode> create(const Value& value, Pas sRefPtr<TransformPaintPropertyNode> parent) 37 static PassRefPtr<TransformPaintPropertyNode> create(const Value& value, Pas sRefPtr<TransformPaintPropertyNode> parent)
40 { 38 {
41 return adoptRef(new TransformPaintPropertyNode(value, parent)); 39 return adoptRef(new TransformPaintPropertyNode(value, parent));
42 } 40 }
43 41
44 const Value& value() const { return m_value; } 42 const Value& value() const { return m_value; }
45 const TransformationMatrix& matrix() const { return m_value.matrix; } 43 const TransformationMatrix& matrix() const { return m_value.matrix; }
46 const FloatPoint3D& origin() const { return m_value.origin; } 44 const FloatPoint3D& origin() const { return m_value.origin; }
47 45
48 // Parent transform that this transform is relative to, or nullptr if this
49 // is the root transform.
50 TransformPaintPropertyNode* parent() const { return m_parent.get(); }
51
52 // Moves this node and its subtrees under another parent.
53 void setParent(PassRefPtr<TransformPaintPropertyNode> parent) { m_parent = p arent; }
54
55 private: 46 private:
56 TransformPaintPropertyNode(const Value& value, PassRefPtr<TransformPaintProp ertyNode> parent) 47 TransformPaintPropertyNode(const Value& value, PassRefPtr<TransformPaintProp ertyNode> parent)
57 : m_value(value), m_parent(parent) { } 48 : PaintPropertyNode(parent), m_value(value) { }
58 49
59 Value m_value; 50 Value m_value;
60 RefPtr<TransformPaintPropertyNode> m_parent;
61 }; 51 };
62 52
63 // Redeclared here to avoid ODR issues. 53 // Redeclared here to avoid ODR issues.
64 // See platform/testing/PaintPrinters.h. 54 // See platform/testing/PaintPrinters.h.
65 void PrintTo(const TransformPaintPropertyNode&, std::ostream*); 55 void PrintTo(const TransformPaintPropertyNode&, std::ostream*);
66 56
67 } // namespace blink 57 } // namespace blink
68 58
69 #endif // TransformPaintPropertyNode_h 59 #endif // TransformPaintPropertyNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698