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/CSSAngleValue.h" | |
9 #include "core/css/cssom/CSSMatrixComponent.h" | 8 #include "core/css/cssom/CSSMatrixComponent.h" |
| 9 #include "core/css/cssom/CSSNumericValue.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 CSSSkew final : public CSSTransformComponent { | 14 class CORE_EXPORT CSSSkew final : public CSSTransformComponent { |
15 WTF_MAKE_NONCOPYABLE(CSSSkew); | 15 WTF_MAKE_NONCOPYABLE(CSSSkew); |
16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
17 | 17 |
18 public: | 18 public: |
19 static CSSSkew* Create(const CSSAngleValue* ax, const CSSAngleValue* ay) { | 19 static CSSSkew* Create(const CSSNumericValue* ax, const CSSNumericValue* ay) { |
20 return new CSSSkew(ax, ay); | 20 return new CSSSkew(ax, ay); |
21 } | 21 } |
22 | 22 |
23 static CSSSkew* FromCSSValue(const CSSFunctionValue&); | 23 static CSSSkew* FromCSSValue(const CSSFunctionValue&); |
24 | 24 |
25 // Bindings requires returning non-const pointers. This is safe because | 25 // Bindings requires returning non-const pointers. This is safe because |
26 // CSSAngleValues are immutable. | 26 // CSSNumericValues are immutable. |
27 CSSAngleValue* ax() const { return const_cast<CSSAngleValue*>(ax_.Get()); } | 27 CSSNumericValue* ax() const { |
28 CSSAngleValue* ay() const { return const_cast<CSSAngleValue*>(ay_.Get()); } | 28 return const_cast<CSSNumericValue*>(ax_.Get()); |
| 29 } |
| 30 CSSNumericValue* ay() const { |
| 31 return const_cast<CSSNumericValue*>(ay_.Get()); |
| 32 } |
29 | 33 |
30 TransformComponentType GetType() const override { return kSkewType; } | 34 TransformComponentType GetType() const override { return kSkewType; } |
31 | 35 |
32 CSSMatrixComponent* asMatrix() const override { | 36 CSSMatrixComponent* asMatrix() const override { |
33 return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees()); | 37 return nullptr; |
| 38 // TODO(meade): Reimplement this once the number/unit types |
| 39 // are re-implemented. |
| 40 // return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees()); |
34 } | 41 } |
35 | 42 |
36 CSSFunctionValue* ToCSSValue() const override; | 43 CSSFunctionValue* ToCSSValue() const override; |
37 | 44 |
38 DEFINE_INLINE_VIRTUAL_TRACE() { | 45 DEFINE_INLINE_VIRTUAL_TRACE() { |
39 visitor->Trace(ax_); | 46 visitor->Trace(ax_); |
40 visitor->Trace(ay_); | 47 visitor->Trace(ay_); |
41 CSSTransformComponent::Trace(visitor); | 48 CSSTransformComponent::Trace(visitor); |
42 } | 49 } |
43 | 50 |
44 private: | 51 private: |
45 CSSSkew(const CSSAngleValue* ax, const CSSAngleValue* ay) | 52 CSSSkew(const CSSNumericValue* ax, const CSSNumericValue* ay) |
46 : CSSTransformComponent(), ax_(ax), ay_(ay) {} | 53 : CSSTransformComponent(), ax_(ax), ay_(ay) {} |
47 | 54 |
48 Member<const CSSAngleValue> ax_; | 55 Member<const CSSNumericValue> ax_; |
49 Member<const CSSAngleValue> ay_; | 56 Member<const CSSNumericValue> ay_; |
50 }; | 57 }; |
51 | 58 |
52 } // namespace blink | 59 } // namespace blink |
53 | 60 |
54 #endif | 61 #endif |
OLD | NEW |