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

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

Issue 2137173002: [SPv2] Respect transform-style in the Blink and cc property trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: large merge (with https://codereview.chromium.org/2144823006) Created 4 years, 4 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/README.md ('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/transforms/TransformationMatrix.h" 10 #include "platform/transforms/TransformationMatrix.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 transform created by a css property such as "transform" or "perspective" 19 // A transform created by a css property such as "transform" or "perspective"
20 // along with a reference to the parent TransformPaintPropertyNode, or nullptr 20 // along with a reference to the parent TransformPaintPropertyNode, or nullptr
21 // for the root. 21 // for the root.
22 class PLATFORM_EXPORT TransformPaintPropertyNode : public RefCounted<TransformPa intPropertyNode> { 22 class PLATFORM_EXPORT TransformPaintPropertyNode : public RefCounted<TransformPa intPropertyNode> {
23 public: 23 public:
24 static PassRefPtr<TransformPaintPropertyNode> create(PassRefPtr<TransformPai ntPropertyNode> parent, const TransformationMatrix& matrix, const FloatPoint3D& origin) 24 static PassRefPtr<TransformPaintPropertyNode> create(
25 PassRefPtr<TransformPaintPropertyNode> parent,
26 const TransformationMatrix& matrix,
27 const FloatPoint3D& origin,
28 bool flattensInheritedTransform = false,
29 unsigned renderingContextID = 0)
25 { 30 {
26 return adoptRef(new TransformPaintPropertyNode(parent, matrix, origin)); 31 return adoptRef(new TransformPaintPropertyNode(matrix, origin, parent, f lattensInheritedTransform, renderingContextID));
27 } 32 }
28 33
29 void update(PassRefPtr<TransformPaintPropertyNode> parent, const Transformat ionMatrix& matrix, const FloatPoint3D& origin) 34 void update(PassRefPtr<TransformPaintPropertyNode> parent, const Transformat ionMatrix& matrix, const FloatPoint3D& origin, bool flattensInheritedTransform = false, unsigned renderingContextID = 0)
30 { 35 {
31 m_parent = parent; 36 m_parent = parent;
32 m_matrix = matrix; 37 m_matrix = matrix;
33 m_origin = origin; 38 m_origin = origin;
39 m_flattensInheritedTransform = flattensInheritedTransform;
40 m_renderingContextID = renderingContextID;
34 } 41 }
35 42
36 const TransformationMatrix& matrix() const { return m_matrix; } 43 const TransformationMatrix& matrix() const { return m_matrix; }
37 const FloatPoint3D& origin() const { return m_origin; } 44 const FloatPoint3D& origin() const { return m_origin; }
38 45
39 // Parent transform that this transform is relative to, or nullptr if this 46 // Parent transform that this transform is relative to, or nullptr if this
40 // is the root transform. 47 // is the root transform.
41 TransformPaintPropertyNode* parent() const { return m_parent.get(); } 48 TransformPaintPropertyNode* parent() const { return m_parent.get(); }
42 49
50 // If true, content with this transform node (or its descendant) appears in
51 // the plane of its parent. This is implemented by flattening the total
52 // accumulated transform from its ancestors.
53 bool flattensInheritedTransform() const { return m_flattensInheritedTransfor m; }
54
55 // Content whose transform nodes have a common rendering context ID are 3D
56 // sorted. If this is 0, content will not be 3D sorted.
57 unsigned renderingContextID() const { return m_renderingContextID; }
58 bool hasRenderingContext() const { return m_renderingContextID; }
59
43 private: 60 private:
44 TransformPaintPropertyNode(PassRefPtr<TransformPaintPropertyNode> parent, co nst TransformationMatrix& matrix, const FloatPoint3D& origin) 61 TransformPaintPropertyNode(
45 : m_parent(parent), m_matrix(matrix), m_origin(origin) { } 62 const TransformationMatrix& matrix,
63 const FloatPoint3D& origin,
64 PassRefPtr<TransformPaintPropertyNode> parent,
65 bool flattensInheritedTransform,
66 unsigned renderingContextID)
67 : m_matrix(matrix)
68 , m_origin(origin)
69 , m_parent(parent)
70 , m_flattensInheritedTransform(flattensInheritedTransform)
71 , m_renderingContextID(renderingContextID)
72 {
73 }
46 74
47 RefPtr<TransformPaintPropertyNode> m_parent;
48 TransformationMatrix m_matrix; 75 TransformationMatrix m_matrix;
49 FloatPoint3D m_origin; 76 FloatPoint3D m_origin;
77 RefPtr<TransformPaintPropertyNode> m_parent;
78 bool m_flattensInheritedTransform;
79 unsigned m_renderingContextID;
50 }; 80 };
51 81
52 // Redeclared here to avoid ODR issues. 82 // Redeclared here to avoid ODR issues.
53 // See platform/testing/PaintPrinters.h. 83 // See platform/testing/PaintPrinters.h.
54 void PrintTo(const TransformPaintPropertyNode&, std::ostream*); 84 void PrintTo(const TransformPaintPropertyNode&, std::ostream*);
55 85
56 } // namespace blink 86 } // namespace blink
57 87
58 #endif // TransformPaintPropertyNode_h 88 #endif // TransformPaintPropertyNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698