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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h

Issue 2711473005: Rename CSSMatrixTransformComponent -> CSSMatrixComponent (Closed)
Patch Set: Rename cssMatrixTransformComponent.html => cssMatrixComponent.html Created 3 years, 10 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CSSMatrixTransformComponent_h
6 #define CSSMatrixTransformComponent_h
7
8 #include "core/css/cssom/CSSTransformComponent.h"
9 #include "platform/transforms/TransformationMatrix.h"
10 #include <memory>
11
12 namespace blink {
13
14 class CORE_EXPORT CSSMatrixTransformComponent final
15 : public CSSTransformComponent {
16 WTF_MAKE_NONCOPYABLE(CSSMatrixTransformComponent);
17 DEFINE_WRAPPERTYPEINFO();
18
19 public:
20 static CSSMatrixTransformComponent* create(double a,
21 double b,
22 double c,
23 double d,
24 double e,
25 double f) {
26 return new CSSMatrixTransformComponent(a, b, c, d, e, f);
27 }
28
29 static CSSMatrixTransformComponent* create(double m11,
30 double m12,
31 double m13,
32 double m14,
33 double m21,
34 double m22,
35 double m23,
36 double m24,
37 double m31,
38 double m32,
39 double m33,
40 double m34,
41 double m41,
42 double m42,
43 double m43,
44 double m44) {
45 return new CSSMatrixTransformComponent(m11, m12, m13, m14, m21, m22, m23,
46 m24, m31, m32, m33, m34, m41, m42,
47 m43, m44);
48 }
49
50 static CSSMatrixTransformComponent* fromCSSValue(
51 const CSSFunctionValue& value) {
52 return nullptr;
53 }
54
55 // 2D matrix attributes
56 double a() const { return m_matrix->a(); }
57 double b() const { return m_matrix->b(); }
58 double c() const { return m_matrix->c(); }
59 double d() const { return m_matrix->d(); }
60 double e() const { return m_matrix->e(); }
61 double f() const { return m_matrix->f(); }
62
63 // 3D matrix attributes
64 double m11() const { return m_matrix->m11(); }
65 double m12() const { return m_matrix->m12(); }
66 double m13() const { return m_matrix->m13(); }
67 double m14() const { return m_matrix->m14(); }
68 double m21() const { return m_matrix->m21(); }
69 double m22() const { return m_matrix->m22(); }
70 double m23() const { return m_matrix->m23(); }
71 double m24() const { return m_matrix->m24(); }
72 double m31() const { return m_matrix->m31(); }
73 double m32() const { return m_matrix->m32(); }
74 double m33() const { return m_matrix->m33(); }
75 double m34() const { return m_matrix->m34(); }
76 double m41() const { return m_matrix->m41(); }
77 double m42() const { return m_matrix->m42(); }
78 double m43() const { return m_matrix->m43(); }
79 double m44() const { return m_matrix->m44(); }
80
81 TransformComponentType type() const override {
82 return m_is2D ? MatrixType : Matrix3DType;
83 }
84
85 // Bindings require a non const return value.
86 CSSMatrixTransformComponent* asMatrix() const override {
87 return const_cast<CSSMatrixTransformComponent*>(this);
88 }
89
90 CSSFunctionValue* toCSSValue() const override;
91
92 static CSSMatrixTransformComponent* perspective(double length);
93
94 static CSSMatrixTransformComponent* rotate(double angle);
95 static CSSMatrixTransformComponent* rotate3d(double angle,
96 double x,
97 double y,
98 double z);
99
100 static CSSMatrixTransformComponent* scale(double x, double y);
101 static CSSMatrixTransformComponent* scale3d(double x, double y, double z);
102
103 static CSSMatrixTransformComponent* skew(double x, double y);
104
105 static CSSMatrixTransformComponent* translate(double x, double y);
106 static CSSMatrixTransformComponent* translate3d(double x, double y, double z);
107
108 private:
109 CSSMatrixTransformComponent(double a,
110 double b,
111 double c,
112 double d,
113 double e,
114 double f)
115 : CSSTransformComponent(),
116 m_matrix(TransformationMatrix::create(a, b, c, d, e, f)),
117 m_is2D(true) {}
118
119 CSSMatrixTransformComponent(double m11,
120 double m12,
121 double m13,
122 double m14,
123 double m21,
124 double m22,
125 double m23,
126 double m24,
127 double m31,
128 double m32,
129 double m33,
130 double m34,
131 double m41,
132 double m42,
133 double m43,
134 double m44)
135 : CSSTransformComponent(),
136 m_matrix(TransformationMatrix::create(m11,
137 m12,
138 m13,
139 m14,
140 m21,
141 m22,
142 m23,
143 m24,
144 m31,
145 m32,
146 m33,
147 m34,
148 m41,
149 m42,
150 m43,
151 m44)),
152 m_is2D(false) {}
153
154 CSSMatrixTransformComponent(
155 std::unique_ptr<const TransformationMatrix> matrix,
156 TransformComponentType fromType)
157 : CSSTransformComponent(),
158 m_matrix(std::move(matrix)),
159 m_is2D(is2DComponentType(fromType)) {}
160
161 // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc
162 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr
163 // to allocate TransformationMatrix on PartitionAlloc.
164 // TODO(oilpan): Oilpan should support 16-byte aligned allocations.
165 std::unique_ptr<const TransformationMatrix> m_matrix;
166 bool m_is2D;
167 };
168
169 } // namespace blink
170
171 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698