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