| 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/CSSAngleValue.h" | 8 #include "core/css/cssom/CSSAngleValue.h" |
| 9 #include "core/css/cssom/CSSMatrixTransformComponent.h" | 9 #include "core/css/cssom/CSSMatrixComponent.h" |
| 10 #include "core/css/cssom/CSSTransformComponent.h" | 10 #include "core/css/cssom/CSSTransformComponent.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class CORE_EXPORT CSSRotation final : public CSSTransformComponent { | 14 class CORE_EXPORT CSSRotation final : public CSSTransformComponent { |
| 15 WTF_MAKE_NONCOPYABLE(CSSRotation); | 15 WTF_MAKE_NONCOPYABLE(CSSRotation); |
| 16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
| 17 | 17 |
| 18 public: | 18 public: |
| 19 static CSSRotation* create(const CSSAngleValue* angleValue) { | 19 static CSSRotation* create(const CSSAngleValue* angleValue) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 return const_cast<CSSAngleValue*>(m_angle.get()); | 35 return const_cast<CSSAngleValue*>(m_angle.get()); |
| 36 } | 36 } |
| 37 double x() const { return m_x; } | 37 double x() const { return m_x; } |
| 38 double y() const { return m_y; } | 38 double y() const { return m_y; } |
| 39 double z() const { return m_z; } | 39 double z() const { return m_z; } |
| 40 | 40 |
| 41 TransformComponentType type() const override { | 41 TransformComponentType type() const override { |
| 42 return m_is2D ? RotationType : Rotation3DType; | 42 return m_is2D ? RotationType : Rotation3DType; |
| 43 } | 43 } |
| 44 | 44 |
| 45 CSSMatrixTransformComponent* asMatrix() const override { | 45 CSSMatrixComponent* asMatrix() const override { |
| 46 return m_is2D ? CSSMatrixTransformComponent::rotate(m_angle->degrees()) | 46 return m_is2D ? CSSMatrixComponent::rotate(m_angle->degrees()) |
| 47 : CSSMatrixTransformComponent::rotate3d(m_angle->degrees(), | 47 : CSSMatrixComponent::rotate3d(m_angle->degrees(), m_x, m_y, |
| 48 m_x, m_y, m_z); | 48 m_z); |
| 49 } | 49 } |
| 50 | 50 |
| 51 CSSFunctionValue* toCSSValue() const override; | 51 CSSFunctionValue* toCSSValue() const override; |
| 52 | 52 |
| 53 DEFINE_INLINE_VIRTUAL_TRACE() { | 53 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 54 visitor->trace(m_angle); | 54 visitor->trace(m_angle); |
| 55 CSSTransformComponent::trace(visitor); | 55 CSSTransformComponent::trace(visitor); |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 CSSRotation(const CSSAngleValue* angle) | 59 CSSRotation(const CSSAngleValue* angle) |
| 60 : m_angle(angle), m_x(0), m_y(0), m_z(1), m_is2D(true) {} | 60 : m_angle(angle), m_x(0), m_y(0), m_z(1), m_is2D(true) {} |
| 61 | 61 |
| 62 CSSRotation(double x, double y, double z, const CSSAngleValue* angle) | 62 CSSRotation(double x, double y, double z, const CSSAngleValue* angle) |
| 63 : m_angle(angle), m_x(x), m_y(y), m_z(z), m_is2D(false) {} | 63 : m_angle(angle), m_x(x), m_y(y), m_z(z), m_is2D(false) {} |
| 64 | 64 |
| 65 Member<const CSSAngleValue> m_angle; | 65 Member<const CSSAngleValue> m_angle; |
| 66 double m_x; | 66 double m_x; |
| 67 double m_y; | 67 double m_y; |
| 68 double m_z; | 68 double m_z; |
| 69 bool m_is2D; | 69 bool m_is2D; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace blink | 72 } // namespace blink |
| 73 | 73 |
| 74 #endif | 74 #endif |
| OLD | NEW |