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 CSSMatrixComponent_h | 5 #ifndef CSSMatrixComponent_h |
6 #define CSSMatrixComponent_h | 6 #define CSSMatrixComponent_h |
7 | 7 |
8 #include "core/css/cssom/CSSTransformComponent.h" | 8 #include "core/css/cssom/CSSTransformComponent.h" |
9 #include "core/geometry/DOMMatrix.h" | 9 #include "core/geometry/DOMMatrix.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class DOMMatrixReadOnly; | 13 class DOMMatrix; |
14 | 14 |
| 15 // Represents a matrix value in a CSSTransformValue used for properties like |
| 16 // "transform". |
| 17 // See CSSMatrixComponent.idl for more information about this class. |
15 class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent { | 18 class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent { |
16 WTF_MAKE_NONCOPYABLE(CSSMatrixComponent); | 19 WTF_MAKE_NONCOPYABLE(CSSMatrixComponent); |
17 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
18 | 21 |
19 public: | 22 public: |
| 23 // Constructor defined in the IDL. |
20 static CSSMatrixComponent* Create(DOMMatrixReadOnly*); | 24 static CSSMatrixComponent* Create(DOMMatrixReadOnly*); |
21 | 25 |
| 26 // Blink-internal ways of creating CSSMatrixComponents. |
22 static CSSMatrixComponent* FromCSSValue(const CSSFunctionValue& value) { | 27 static CSSMatrixComponent* FromCSSValue(const CSSFunctionValue& value) { |
23 return nullptr; | 28 return nullptr; |
24 } | 29 } |
25 | 30 |
| 31 // Getters and setters for attributes defined in the IDL. |
26 DOMMatrix* matrix() const { return matrix_; } | 32 DOMMatrix* matrix() const { return matrix_; } |
27 | |
28 void setMatrix(DOMMatrix* matrix) { matrix_ = matrix; } | 33 void setMatrix(DOMMatrix* matrix) { matrix_ = matrix; } |
29 | 34 |
| 35 // Internal methods - from CSSTransformComponent. |
30 TransformComponentType GetType() const override { | 36 TransformComponentType GetType() const override { |
31 return is2d_ ? kMatrixType : kMatrix3DType; | 37 return is2d_ ? kMatrixType : kMatrix3DType; |
32 } | 38 } |
33 | |
34 DOMMatrix* AsMatrix() const override { return matrix(); } | 39 DOMMatrix* AsMatrix() const override { return matrix(); } |
35 | |
36 CSSFunctionValue* ToCSSValue() const override; | 40 CSSFunctionValue* ToCSSValue() const override; |
37 | 41 |
38 DEFINE_INLINE_VIRTUAL_TRACE() { | 42 DEFINE_INLINE_VIRTUAL_TRACE() { |
39 visitor->Trace(matrix_); | 43 visitor->Trace(matrix_); |
40 CSSTransformComponent::Trace(visitor); | 44 CSSTransformComponent::Trace(visitor); |
41 } | 45 } |
42 | 46 |
43 private: | 47 private: |
44 CSSMatrixComponent(DOMMatrixReadOnly*); | 48 CSSMatrixComponent(DOMMatrixReadOnly*); |
45 | 49 |
46 Member<DOMMatrix> matrix_; | 50 Member<DOMMatrix> matrix_; |
47 bool is2d_; | 51 bool is2d_; |
48 }; | 52 }; |
49 | 53 |
50 } // namespace blink | 54 } // namespace blink |
51 | 55 |
52 #endif | 56 #endif |
OLD | NEW |