| 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 CSSPerspective_h | 5 #ifndef CSSPerspective_h |
| 6 #define CSSPerspective_h | 6 #define CSSPerspective_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/css/cssom/CSSNumericValue.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 DOMMatrix; | 14 class DOMMatrix; |
| 15 class ExceptionState; | 15 class ExceptionState; |
| 16 | 16 |
| 17 // Represents a perspective value in a CSSTransformValue used for properties |
| 18 // like "transform". |
| 19 // See CSSPerspective.idl for more information about this class. |
| 17 class CORE_EXPORT CSSPerspective : public CSSTransformComponent { | 20 class CORE_EXPORT CSSPerspective : public CSSTransformComponent { |
| 18 WTF_MAKE_NONCOPYABLE(CSSPerspective); | 21 WTF_MAKE_NONCOPYABLE(CSSPerspective); |
| 19 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 20 | 23 |
| 21 public: | 24 public: |
| 25 // Constructor defined in the IDL. |
| 22 static CSSPerspective* Create(const CSSNumericValue*, ExceptionState&); | 26 static CSSPerspective* Create(const CSSNumericValue*, ExceptionState&); |
| 27 |
| 28 // Blink-internal ways of creating CSSPerspectives. |
| 23 static CSSPerspective* FromCSSValue(const CSSFunctionValue&); | 29 static CSSPerspective* FromCSSValue(const CSSFunctionValue&); |
| 24 | 30 |
| 31 // Getters and setters for attributes defined in the IDL. |
| 25 // Bindings require a non const return value. | 32 // Bindings require a non const return value. |
| 26 CSSNumericValue* length() const { | 33 CSSNumericValue* length() const { |
| 27 return const_cast<CSSNumericValue*>(length_.Get()); | 34 return const_cast<CSSNumericValue*>(length_.Get()); |
| 28 } | 35 } |
| 29 | 36 |
| 37 // Internal methods - from CSSTransformComponent. |
| 30 TransformComponentType GetType() const override { return kPerspectiveType; } | 38 TransformComponentType GetType() const override { return kPerspectiveType; } |
| 31 | |
| 32 // TODO: Implement AsMatrix for CSSPerspective. | 39 // TODO: Implement AsMatrix for CSSPerspective. |
| 33 DOMMatrix* AsMatrix() const override { return nullptr; } | 40 DOMMatrix* AsMatrix() const override { return nullptr; } |
| 34 | |
| 35 CSSFunctionValue* ToCSSValue() const override; | 41 CSSFunctionValue* ToCSSValue() const override; |
| 36 | 42 |
| 37 DEFINE_INLINE_VIRTUAL_TRACE() { | 43 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 38 visitor->Trace(length_); | 44 visitor->Trace(length_); |
| 39 CSSTransformComponent::Trace(visitor); | 45 CSSTransformComponent::Trace(visitor); |
| 40 } | 46 } |
| 41 | 47 |
| 42 private: | 48 private: |
| 43 CSSPerspective(const CSSNumericValue* length) : length_(length) {} | 49 CSSPerspective(const CSSNumericValue* length) : length_(length) {} |
| 44 | 50 |
| 45 Member<const CSSNumericValue> length_; | 51 Member<const CSSNumericValue> length_; |
| 46 }; | 52 }; |
| 47 | 53 |
| 48 } // namespace blink | 54 } // namespace blink |
| 49 | 55 |
| 50 #endif | 56 #endif |
| OLD | NEW |