| 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 CSSTranslation_h | 5 #ifndef CSSTranslation_h |
| 6 #define CSSTranslation_h | 6 #define CSSTranslation_h |
| 7 | 7 |
| 8 #include "core/css/cssom/LengthValue.h" | 8 #include "core/css/cssom/CSSLengthValue.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 ExceptionState; | 13 class ExceptionState; |
| 14 | 14 |
| 15 class CORE_EXPORT CSSTranslation final : public TransformComponent { | 15 class CORE_EXPORT CSSTranslation final : public TransformComponent { |
| 16 WTF_MAKE_NONCOPYABLE(CSSTranslation); | 16 WTF_MAKE_NONCOPYABLE(CSSTranslation); |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 public: | 18 public: |
| 19 static CSSTranslation* create(LengthValue* x, LengthValue* y, ExceptionState
&) | 19 static CSSTranslation* create(CSSLengthValue* x, CSSLengthValue* y, Exceptio
nState&) |
| 20 { | 20 { |
| 21 return new CSSTranslation(x, y, nullptr); | 21 return new CSSTranslation(x, y, nullptr); |
| 22 } | 22 } |
| 23 static CSSTranslation* create(LengthValue* x, LengthValue* y, LengthValue* z
, ExceptionState&); | 23 static CSSTranslation* create(CSSLengthValue* x, CSSLengthValue* y, CSSLengt
hValue* z, ExceptionState&); |
| 24 | 24 |
| 25 LengthValue* x() const { return m_x; } | 25 CSSLengthValue* x() const { return m_x; } |
| 26 LengthValue* y() const { return m_y; } | 26 CSSLengthValue* y() const { return m_y; } |
| 27 LengthValue* z() const { return m_z; } | 27 CSSLengthValue* z() const { return m_z; } |
| 28 | 28 |
| 29 TransformComponentType type() const override { return is2D() ? TranslationTy
pe : Translation3DType; } | 29 TransformComponentType type() const override { return is2D() ? TranslationTy
pe : Translation3DType; } |
| 30 | 30 |
| 31 // TODO: Implement asMatrix for CSSTranslation. | 31 // TODO: Implement asMatrix for CSSTranslation. |
| 32 MatrixTransformComponent* asMatrix() const override { return nullptr; } | 32 MatrixTransformComponent* asMatrix() const override { return nullptr; } |
| 33 | 33 |
| 34 CSSFunctionValue* toCSSValue() const override; | 34 CSSFunctionValue* toCSSValue() const override; |
| 35 | 35 |
| 36 DEFINE_INLINE_VIRTUAL_TRACE() | 36 DEFINE_INLINE_VIRTUAL_TRACE() |
| 37 { | 37 { |
| 38 visitor->trace(m_x); | 38 visitor->trace(m_x); |
| 39 visitor->trace(m_y); | 39 visitor->trace(m_y); |
| 40 visitor->trace(m_z); | 40 visitor->trace(m_z); |
| 41 TransformComponent::trace(visitor); | 41 TransformComponent::trace(visitor); |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 CSSTranslation(LengthValue* x, LengthValue* y, LengthValue* z) | 45 CSSTranslation(CSSLengthValue* x, CSSLengthValue* y, CSSLengthValue* z) |
| 46 : TransformComponent() | 46 : TransformComponent() |
| 47 , m_x(x) | 47 , m_x(x) |
| 48 , m_y(y) | 48 , m_y(y) |
| 49 , m_z(z) | 49 , m_z(z) |
| 50 { } | 50 { } |
| 51 | 51 |
| 52 bool is2D() const { return !m_z; } | 52 bool is2D() const { return !m_z; } |
| 53 | 53 |
| 54 Member<LengthValue> m_x; | 54 Member<CSSLengthValue> m_x; |
| 55 Member<LengthValue> m_y; | 55 Member<CSSLengthValue> m_y; |
| 56 Member<LengthValue> m_z; | 56 Member<CSSLengthValue> m_z; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif | 61 #endif |
| OLD | NEW |