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

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

Issue 2173363002: Improve code readibility of PaintPropertyTreeBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra "const" (might be a typo) 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/PropertyTreeState.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/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( 24 static PassRefPtr<TransformPaintPropertyNode> create(
25 PassRefPtr<TransformPaintPropertyNode> parent, 25 PassRefPtr<const TransformPaintPropertyNode> parent,
26 const TransformationMatrix& matrix, 26 const TransformationMatrix& matrix,
27 const FloatPoint3D& origin, 27 const FloatPoint3D& origin,
28 bool flattensInheritedTransform = false, 28 bool flattensInheritedTransform = false,
29 unsigned renderingContextID = 0) 29 unsigned renderingContextID = 0)
30 { 30 {
31 return adoptRef(new TransformPaintPropertyNode(matrix, origin, parent, f lattensInheritedTransform, renderingContextID)); 31 return adoptRef(new TransformPaintPropertyNode(matrix, origin, parent, f lattensInheritedTransform, renderingContextID));
32 } 32 }
33 33
34 void update(PassRefPtr<TransformPaintPropertyNode> parent, const Transformat ionMatrix& matrix, const FloatPoint3D& origin, bool flattensInheritedTransform = false, unsigned renderingContextID = 0) 34 void update(PassRefPtr<const TransformPaintPropertyNode> parent, const Trans formationMatrix& matrix, const FloatPoint3D& origin, bool flattensInheritedTrans form = false, unsigned renderingContextID = 0)
35 { 35 {
36 m_parent = parent; 36 m_parent = parent;
37 m_matrix = matrix; 37 m_matrix = matrix;
38 m_origin = origin; 38 m_origin = origin;
39 m_flattensInheritedTransform = flattensInheritedTransform; 39 m_flattensInheritedTransform = flattensInheritedTransform;
40 m_renderingContextID = renderingContextID; 40 m_renderingContextID = renderingContextID;
41 } 41 }
42 42
43 const TransformationMatrix& matrix() const { return m_matrix; } 43 const TransformationMatrix& matrix() const { return m_matrix; }
44 const FloatPoint3D& origin() const { return m_origin; } 44 const FloatPoint3D& origin() const { return m_origin; }
45 45
46 // 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
47 // is the root transform. 47 // is the root transform.
48 TransformPaintPropertyNode* parent() const { return m_parent.get(); } 48 const TransformPaintPropertyNode* parent() const { return m_parent.get(); }
49 49
50 // If true, content with this transform node (or its descendant) appears in 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 51 // the plane of its parent. This is implemented by flattening the total
52 // accumulated transform from its ancestors. 52 // accumulated transform from its ancestors.
53 bool flattensInheritedTransform() const { return m_flattensInheritedTransfor m; } 53 bool flattensInheritedTransform() const { return m_flattensInheritedTransfor m; }
54 54
55 // Content whose transform nodes have a common rendering context ID are 3D 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. 56 // sorted. If this is 0, content will not be 3D sorted.
57 unsigned renderingContextID() const { return m_renderingContextID; } 57 unsigned renderingContextID() const { return m_renderingContextID; }
58 bool hasRenderingContext() const { return m_renderingContextID; } 58 bool hasRenderingContext() const { return m_renderingContextID; }
59 59
60 private: 60 private:
61 TransformPaintPropertyNode( 61 TransformPaintPropertyNode(
62 const TransformationMatrix& matrix, 62 const TransformationMatrix& matrix,
63 const FloatPoint3D& origin, 63 const FloatPoint3D& origin,
64 PassRefPtr<TransformPaintPropertyNode> parent, 64 PassRefPtr<const TransformPaintPropertyNode> parent,
65 bool flattensInheritedTransform, 65 bool flattensInheritedTransform,
66 unsigned renderingContextID) 66 unsigned renderingContextID)
67 : m_matrix(matrix) 67 : m_matrix(matrix)
68 , m_origin(origin) 68 , m_origin(origin)
69 , m_parent(parent) 69 , m_parent(parent)
70 , m_flattensInheritedTransform(flattensInheritedTransform) 70 , m_flattensInheritedTransform(flattensInheritedTransform)
71 , m_renderingContextID(renderingContextID) 71 , m_renderingContextID(renderingContextID)
72 { 72 {
73 } 73 }
74 74
75 TransformationMatrix m_matrix; 75 TransformationMatrix m_matrix;
76 FloatPoint3D m_origin; 76 FloatPoint3D m_origin;
77 RefPtr<TransformPaintPropertyNode> m_parent; 77 RefPtr<const TransformPaintPropertyNode> m_parent;
78 bool m_flattensInheritedTransform; 78 bool m_flattensInheritedTransform;
79 unsigned m_renderingContextID; 79 unsigned m_renderingContextID;
80 }; 80 };
81 81
82 // Redeclared here to avoid ODR issues. 82 // Redeclared here to avoid ODR issues.
83 // See platform/testing/PaintPrinters.h. 83 // See platform/testing/PaintPrinters.h.
84 void PrintTo(const TransformPaintPropertyNode&, std::ostream*); 84 void PrintTo(const TransformPaintPropertyNode&, std::ostream*);
85 85
86 } // namespace blink 86 } // namespace blink
87 87
88 #endif // TransformPaintPropertyNode_h 88 #endif // TransformPaintPropertyNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698