OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 CSSRotation_h | 5 #ifndef CSSRotation_h |
6 #define CSSRotation_h | 6 #define CSSRotation_h |
7 | 7 |
8 #include "core/css/cssom/MatrixTransformComponent.h" | 8 #include "core/css/cssom/CSSMatrixTransformComponent.h" |
9 #include "core/css/cssom/TransformComponent.h" | 9 #include "core/css/cssom/TransformComponent.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT CSSRotation final : public TransformComponent { | 13 class CORE_EXPORT CSSRotation final : public TransformComponent { |
14 WTF_MAKE_NONCOPYABLE(CSSRotation); | 14 WTF_MAKE_NONCOPYABLE(CSSRotation); |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 public: | 16 public: |
17 static CSSRotation* create(double angle) | 17 static CSSRotation* create(double angle) |
18 { | 18 { |
19 return new CSSRotation(angle); | 19 return new CSSRotation(angle); |
20 } | 20 } |
21 | 21 |
22 static CSSRotation* create(double angle, double x, double y, double z) | 22 static CSSRotation* create(double angle, double x, double y, double z) |
23 { | 23 { |
24 return new CSSRotation(angle, x, y, z); | 24 return new CSSRotation(angle, x, y, z); |
25 } | 25 } |
26 | 26 |
27 double angle() const { return m_angle; } | 27 double angle() const { return m_angle; } |
28 double x() const { return m_x; } | 28 double x() const { return m_x; } |
29 double y() const { return m_y; } | 29 double y() const { return m_y; } |
30 double z() const { return m_z; } | 30 double z() const { return m_z; } |
31 | 31 |
32 TransformComponentType type() const override { return m_is2D ? RotationType
: Rotation3DType; } | 32 TransformComponentType type() const override { return m_is2D ? RotationType
: Rotation3DType; } |
33 | 33 |
34 MatrixTransformComponent* asMatrix() const override | 34 CSSMatrixTransformComponent* asMatrix() const override |
35 { | 35 { |
36 return m_is2D ? MatrixTransformComponent::rotate(m_angle) | 36 return m_is2D ? CSSMatrixTransformComponent::rotate(m_angle) |
37 : MatrixTransformComponent::rotate3d(m_angle, m_x, m_y, m_z); | 37 : CSSMatrixTransformComponent::rotate3d(m_angle, m_x, m_y, m_z); |
38 } | 38 } |
39 | 39 |
40 CSSFunctionValue* toCSSValue() const override; | 40 CSSFunctionValue* toCSSValue() const override; |
41 | 41 |
42 private: | 42 private: |
43 CSSRotation(double angle) | 43 CSSRotation(double angle) |
44 : m_angle(angle) | 44 : m_angle(angle) |
45 , m_x(0) | 45 , m_x(0) |
46 , m_y(0) | 46 , m_y(0) |
47 , m_z(1) | 47 , m_z(1) |
(...skipping 11 matching lines...) Expand all Loading... |
59 double m_angle; | 59 double m_angle; |
60 double m_x; | 60 double m_x; |
61 double m_y; | 61 double m_y; |
62 double m_z; | 62 double m_z; |
63 bool m_is2D; | 63 bool m_is2D; |
64 }; | 64 }; |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
67 | 67 |
68 #endif | 68 #endif |
OLD | NEW |