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 CSSSkew_h | 5 #ifndef CSSSkew_h |
6 #define CSSSkew_h | 6 #define CSSSkew_h |
7 | 7 |
8 #include "core/css/cssom/CSSMatrixComponent.h" | |
9 #include "core/css/cssom/CSSNumericValue.h" | 8 #include "core/css/cssom/CSSNumericValue.h" |
10 #include "core/css/cssom/CSSTransformComponent.h" | 9 #include "core/css/cssom/CSSTransformComponent.h" |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
| 13 class ExceptionState; |
| 14 |
14 // Represents a skew value in a CSSTransformValue used for properties like | 15 // Represents a skew value in a CSSTransformValue used for properties like |
15 // "transform". | 16 // "transform". |
16 // See CSSSkew.idl for more documentation about this class. | 17 // See CSSSkew.idl for more information about this class. |
17 class CORE_EXPORT CSSSkew final : public CSSTransformComponent { | 18 class CORE_EXPORT CSSSkew final : public CSSTransformComponent { |
18 WTF_MAKE_NONCOPYABLE(CSSSkew); | 19 WTF_MAKE_NONCOPYABLE(CSSSkew); |
19 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
20 | 21 |
21 public: | 22 public: |
22 // Constructor defined in the IDL. | 23 // Constructor defined in the IDL. |
23 static CSSSkew* Create(CSSNumericValue* ax, CSSNumericValue* ay) { | 24 static CSSSkew* Create(CSSNumericValue* ax, CSSNumericValue* ay) { |
24 return new CSSSkew(ax, ay); | 25 return new CSSSkew(ax, ay); |
25 } | 26 } |
26 | 27 |
27 // Internal ways of creating CSSSkews. | 28 // Internal ways of creating CSSSkews. |
28 static CSSSkew* FromCSSValue(const CSSFunctionValue&); | 29 static CSSSkew* FromCSSValue(const CSSFunctionValue&); |
29 | 30 |
30 // Getters and setters for the ax and ay attributes defined in the IDL. | 31 // Getters and setters for the ax and ay attributes defined in the IDL. |
31 CSSNumericValue* ax() const { return ax_.Get(); } | 32 CSSNumericValue* ax() const { return ax_.Get(); } |
32 CSSNumericValue* ay() const { return ay_.Get(); } | 33 CSSNumericValue* ay() const { return ay_.Get(); } |
33 void setAx(CSSNumericValue*, ExceptionState&); | 34 void setAx(CSSNumericValue*, ExceptionState&); |
34 void setAy(CSSNumericValue*, ExceptionState&); | 35 void setAy(CSSNumericValue*, ExceptionState&); |
35 | 36 |
36 CSSMatrixComponent* asMatrix() const override { | 37 // Internal methods - from CSSTransformComponent. |
| 38 TransformComponentType GetType() const override { return kSkewType; } |
| 39 DOMMatrix* AsMatrix() const override { |
37 return nullptr; | 40 return nullptr; |
38 // TODO(meade): Reimplement this once the number/unit types | 41 // TODO(meade): Reimplement this once the number/unit types |
39 // are re-implemented. | 42 // are re-implemented. |
40 // return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees()); | 43 // return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees()); |
41 } | 44 } |
42 | |
43 // Internal methods - from CSSTransformComponent. | |
44 TransformComponentType GetType() const override { return kSkewType; } | |
45 CSSFunctionValue* ToCSSValue() const override; | 45 CSSFunctionValue* ToCSSValue() const override; |
46 | 46 |
47 DEFINE_INLINE_VIRTUAL_TRACE() { | 47 DEFINE_INLINE_VIRTUAL_TRACE() { |
48 visitor->Trace(ax_); | 48 visitor->Trace(ax_); |
49 visitor->Trace(ay_); | 49 visitor->Trace(ay_); |
50 CSSTransformComponent::Trace(visitor); | 50 CSSTransformComponent::Trace(visitor); |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
54 CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay) | 54 CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay) |
55 : CSSTransformComponent(), ax_(ax), ay_(ay) {} | 55 : CSSTransformComponent(), ax_(ax), ay_(ay) {} |
56 | 56 |
57 Member<CSSNumericValue> ax_; | 57 Member<CSSNumericValue> ax_; |
58 Member<CSSNumericValue> ay_; | 58 Member<CSSNumericValue> ay_; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
62 | 62 |
63 #endif | 63 #endif |
OLD | NEW |