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/CSSMatrixComponent.h" | 8 #include "core/css/cssom/CSSMatrixComponent.h" |
9 #include "core/css/cssom/CSSTransformComponent.h" | 9 #include "core/css/cssom/CSSTransformComponent.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT CSSScale final : public CSSTransformComponent { | 13 class CORE_EXPORT CSSScale final : public CSSTransformComponent { |
14 WTF_MAKE_NONCOPYABLE(CSSScale); | 14 WTF_MAKE_NONCOPYABLE(CSSScale); |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 | 16 |
17 public: | 17 public: |
18 static CSSScale* Create(double x, double y) { return new CSSScale(x, y); } | 18 static CSSScale* Create(double x, double y) { return new CSSScale(x, y); } |
19 | 19 |
20 static CSSScale* Create(double x, double y, double z) { | 20 static CSSScale* Create(double x, double y, double z) { |
21 return new CSSScale(x, y, z); | 21 return new CSSScale(x, y, z); |
22 } | 22 } |
23 | 23 |
24 static CSSScale* FromCSSValue(const CSSFunctionValue&); | 24 static CSSScale* FromCSSValue(const CSSFunctionValue&); |
25 | 25 |
26 double x() const { return x_; } | 26 double x() const { return x_; } |
27 double y() const { return y_; } | 27 double y() const { return y_; } |
28 double z() const { return z_; } | 28 double z() const { return z_; } |
29 | 29 |
| 30 void setX(double x) { x_ = x; } |
| 31 void setY(double y) { y_ = y; } |
| 32 void setZ(double z) { z_ = z; } |
| 33 |
30 TransformComponentType GetType() const override { | 34 TransformComponentType GetType() const override { |
31 return is2d_ ? kScaleType : kScale3DType; | 35 return is2d_ ? kScaleType : kScale3DType; |
32 } | 36 } |
33 | 37 |
34 CSSMatrixComponent* asMatrix() const override { | 38 CSSMatrixComponent* asMatrix() const override { |
35 return is2d_ ? CSSMatrixComponent::Scale(x_, y_) | 39 return is2d_ ? CSSMatrixComponent::Scale(x_, y_) |
36 : CSSMatrixComponent::Scale3d(x_, y_, z_); | 40 : CSSMatrixComponent::Scale3d(x_, y_, z_); |
37 } | 41 } |
38 | 42 |
39 CSSFunctionValue* ToCSSValue() const override; | 43 CSSFunctionValue* ToCSSValue() const override; |
40 | 44 |
41 private: | 45 private: |
42 CSSScale(double x, double y) : x_(x), y_(y), z_(1), is2d_(true) {} | 46 CSSScale(double x, double y) : x_(x), y_(y), z_(1), is2d_(true) {} |
43 CSSScale(double x, double y, double z) : x_(x), y_(y), z_(z), is2d_(false) {} | 47 CSSScale(double x, double y, double z) : x_(x), y_(y), z_(z), is2d_(false) {} |
44 | 48 |
45 double x_; | 49 double x_; |
46 double y_; | 50 double y_; |
47 double z_; | 51 double z_; |
48 bool is2d_; | 52 bool is2d_; |
49 }; | 53 }; |
50 | 54 |
51 } // namespace blink | 55 } // namespace blink |
52 | 56 |
53 #endif | 57 #endif |
OLD | NEW |