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

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

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

Powered by Google App Engine
This is Rietveld 408576698