| 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/CSSTransformComponent.h" | 8 #include "core/css/cssom/CSSTransformComponent.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class CSSNumericValue; | 12 class CSSNumericValue; |
| 13 class DOMMatrix; |
| 13 class ExceptionState; | 14 class ExceptionState; |
| 14 | 15 |
| 15 class CORE_EXPORT CSSTranslation final : public CSSTransformComponent { | 16 class CORE_EXPORT CSSTranslation final : public CSSTransformComponent { |
| 16 WTF_MAKE_NONCOPYABLE(CSSTranslation); | 17 WTF_MAKE_NONCOPYABLE(CSSTranslation); |
| 17 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
| 18 | 19 |
| 19 public: | 20 public: |
| 20 static CSSTranslation* Create(CSSNumericValue* x, | 21 static CSSTranslation* Create(CSSNumericValue* x, |
| 21 CSSNumericValue* y, | 22 CSSNumericValue* y, |
| 22 ExceptionState&) { | 23 ExceptionState&) { |
| 23 return new CSSTranslation(x, y, nullptr); | 24 return new CSSTranslation(x, y, nullptr); |
| 24 } | 25 } |
| 25 static CSSTranslation* Create(CSSNumericValue* x, | 26 static CSSTranslation* Create(CSSNumericValue* x, |
| 26 CSSNumericValue* y, | 27 CSSNumericValue* y, |
| 27 CSSNumericValue* z, | 28 CSSNumericValue* z, |
| 28 ExceptionState&); | 29 ExceptionState&); |
| 29 | 30 |
| 30 static CSSTranslation* FromCSSValue(const CSSFunctionValue& value) { | 31 static CSSTranslation* FromCSSValue(const CSSFunctionValue& value) { |
| 31 return nullptr; | 32 return nullptr; |
| 32 } | 33 } |
| 33 | 34 |
| 34 CSSNumericValue* x() const { return x_; } | 35 CSSNumericValue* x() const { return x_; } |
| 35 CSSNumericValue* y() const { return y_; } | 36 CSSNumericValue* y() const { return y_; } |
| 36 CSSNumericValue* z() const { return z_; } | 37 CSSNumericValue* z() const { return z_; } |
| 37 | 38 |
| 38 TransformComponentType GetType() const override { | 39 TransformComponentType GetType() const override { |
| 39 return Is2D() ? kTranslationType : kTranslation3DType; | 40 return Is2D() ? kTranslationType : kTranslation3DType; |
| 40 } | 41 } |
| 41 | 42 |
| 42 // TODO: Implement asMatrix for CSSTranslation. | 43 // TODO: Implement AsMatrix for CSSTranslation. |
| 43 CSSMatrixComponent* asMatrix() const override { return nullptr; } | 44 DOMMatrix* AsMatrix() const override { return nullptr; } |
| 44 | 45 |
| 45 CSSFunctionValue* ToCSSValue() const override; | 46 CSSFunctionValue* ToCSSValue() const override; |
| 46 | 47 |
| 47 DEFINE_INLINE_VIRTUAL_TRACE() { | 48 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 48 visitor->Trace(x_); | 49 visitor->Trace(x_); |
| 49 visitor->Trace(y_); | 50 visitor->Trace(y_); |
| 50 visitor->Trace(z_); | 51 visitor->Trace(z_); |
| 51 CSSTransformComponent::Trace(visitor); | 52 CSSTransformComponent::Trace(visitor); |
| 52 } | 53 } |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 CSSTranslation(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z) | 56 CSSTranslation(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z) |
| 56 : CSSTransformComponent(), x_(x), y_(y), z_(z) {} | 57 : CSSTransformComponent(), x_(x), y_(y), z_(z) {} |
| 57 | 58 |
| 58 bool Is2D() const { return !z_; } | 59 bool Is2D() const { return !z_; } |
| 59 | 60 |
| 60 Member<CSSNumericValue> x_; | 61 Member<CSSNumericValue> x_; |
| 61 Member<CSSNumericValue> y_; | 62 Member<CSSNumericValue> y_; |
| 62 Member<CSSNumericValue> z_; | 63 Member<CSSNumericValue> z_; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace blink | 66 } // namespace blink |
| 66 | 67 |
| 67 #endif | 68 #endif |
| OLD | NEW |