| 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 CSSScale_h | 5 #ifndef CSSScale_h |
| 6 #define CSSScale_h | 6 #define CSSScale_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 CSSScale final : public TransformComponent { | 13 class CORE_EXPORT CSSScale final : public TransformComponent { |
| 14 WTF_MAKE_NONCOPYABLE(CSSScale); | 14 WTF_MAKE_NONCOPYABLE(CSSScale); |
| 15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
| 16 public: | 16 public: |
| 17 static CSSScale* create(double x, double y) | 17 static CSSScale* create(double x, double y) |
| 18 { | 18 { |
| 19 return new CSSScale(x, y); | 19 return new CSSScale(x, y); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static CSSScale* create(double x, double y, double z) | 22 static CSSScale* create(double x, double y, double z) |
| 23 { | 23 { |
| 24 return new CSSScale(x, y, z); | 24 return new CSSScale(x, y, z); |
| 25 } | 25 } |
| 26 | 26 |
| 27 double x() const { return m_x; } | 27 double x() const { return m_x; } |
| 28 double y() const { return m_y; } | 28 double y() const { return m_y; } |
| 29 double z() const { return m_z; } | 29 double z() const { return m_z; } |
| 30 | 30 |
| 31 TransformComponentType type() const override { return m_is2D ? ScaleType : S
cale3DType; } | 31 TransformComponentType type() const override { return m_is2D ? ScaleType : S
cale3DType; } |
| 32 | 32 |
| 33 MatrixTransformComponent* asMatrix() const override | 33 CSSMatrixTransformComponent* asMatrix() const override |
| 34 { | 34 { |
| 35 return m_is2D ? MatrixTransformComponent::scale(m_x, m_y) | 35 return m_is2D ? CSSMatrixTransformComponent::scale(m_x, m_y) |
| 36 : MatrixTransformComponent::scale3d(m_x, m_y, m_z); | 36 : CSSMatrixTransformComponent::scale3d(m_x, m_y, m_z); |
| 37 } | 37 } |
| 38 | 38 |
| 39 CSSFunctionValue* toCSSValue() const override; | 39 CSSFunctionValue* toCSSValue() const override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 CSSScale(double x, double y) : m_x(x), m_y(y), m_z(1), m_is2D(true) { } | 42 CSSScale(double x, double y) : m_x(x), m_y(y), m_z(1), m_is2D(true) { } |
| 43 CSSScale(double x, double y, double z) : m_x(x), m_y(y), m_z(z), m_is2D(fals
e) { } | 43 CSSScale(double x, double y, double z) : m_x(x), m_y(y), m_z(z), m_is2D(fals
e) { } |
| 44 | 44 |
| 45 double m_x; | 45 double m_x; |
| 46 double m_y; | 46 double m_y; |
| 47 double m_z; | 47 double m_z; |
| 48 bool m_is2D; | 48 bool m_is2D; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace blink | 51 } // namespace blink |
| 52 | 52 |
| 53 #endif | 53 #endif |
| OLD | NEW |