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" | 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 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 CSSAngleValue* ax, const CSSAngleValue* 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 // CSSAngleValues are immutable. |
27 CSSAngleValue* ax() const { return const_cast<CSSAngleValue*>(m_ax.get()); } | 27 CSSAngleValue* ax() const { return const_cast<CSSAngleValue*>(m_ax.get()); } |
28 CSSAngleValue* ay() const { return const_cast<CSSAngleValue*>(m_ay.get()); } | 28 CSSAngleValue* ay() const { return const_cast<CSSAngleValue*>(m_ay.get()); } |
29 | 29 |
30 TransformComponentType type() const override { return SkewType; } | 30 TransformComponentType type() const override { return SkewType; } |
31 | 31 |
32 CSSMatrixTransformComponent* asMatrix() const override { | 32 CSSMatrixComponent* asMatrix() const override { |
33 return CSSMatrixTransformComponent::skew(m_ax->degrees(), m_ay->degrees()); | 33 return CSSMatrixComponent::skew(m_ax->degrees(), m_ay->degrees()); |
34 } | 34 } |
35 | 35 |
36 CSSFunctionValue* toCSSValue() const override; | 36 CSSFunctionValue* toCSSValue() const override; |
37 | 37 |
38 DEFINE_INLINE_VIRTUAL_TRACE() { | 38 DEFINE_INLINE_VIRTUAL_TRACE() { |
39 visitor->trace(m_ax); | 39 visitor->trace(m_ax); |
40 visitor->trace(m_ay); | 40 visitor->trace(m_ay); |
41 CSSTransformComponent::trace(visitor); | 41 CSSTransformComponent::trace(visitor); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 CSSSkew(const CSSAngleValue* ax, const CSSAngleValue* ay) | 45 CSSSkew(const CSSAngleValue* ax, const CSSAngleValue* ay) |
46 : CSSTransformComponent(), m_ax(ax), m_ay(ay) {} | 46 : CSSTransformComponent(), m_ax(ax), m_ay(ay) {} |
47 | 47 |
48 Member<const CSSAngleValue> m_ax; | 48 Member<const CSSAngleValue> m_ax; |
49 Member<const CSSAngleValue> m_ay; | 49 Member<const CSSAngleValue> m_ay; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace blink | 52 } // namespace blink |
53 | 53 |
54 #endif | 54 #endif |
OLD | NEW |