Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.h

Issue 2943303002: [CSS Typed OM] Refactor is2D handling in CSSTransformComponents to match new spec (Closed)
Patch Set: rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "core/geometry/DOMMatrixReadOnly.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 class DOMMatrix; 14 class CSSMatrixComponentOptions;
14 15
15 // Represents a matrix value in a CSSTransformValue used for properties like 16 // Represents a matrix value in a CSSTransformValue used for properties like
16 // "transform". 17 // "transform".
17 // See CSSMatrixComponent.idl for more information about this class. 18 // See CSSMatrixComponent.idl for more information about this class.
18 class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent { 19 class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent {
19 WTF_MAKE_NONCOPYABLE(CSSMatrixComponent); 20 WTF_MAKE_NONCOPYABLE(CSSMatrixComponent);
20 DEFINE_WRAPPERTYPEINFO(); 21 DEFINE_WRAPPERTYPEINFO();
21 22
22 public: 23 public:
23 // Constructor defined in the IDL. 24 // Constructors defined in the IDL.
24 static CSSMatrixComponent* Create(DOMMatrixReadOnly*); 25 static CSSMatrixComponent* Create(DOMMatrixReadOnly*,
26 const CSSMatrixComponentOptions&);
25 27
26 // Blink-internal ways of creating CSSMatrixComponents. 28 // Blink-internal ways of creating CSSMatrixComponents.
27 static CSSMatrixComponent* FromCSSValue(const CSSFunctionValue& value) { 29 static CSSMatrixComponent* FromCSSValue(const CSSFunctionValue& value) {
30 // TODO(meade): Implement.
28 return nullptr; 31 return nullptr;
29 } 32 }
30 33
31 // Getters and setters for attributes defined in the IDL. 34 // Getters and setters for attributes defined in the IDL.
32 DOMMatrix* matrix() const { return matrix_; } 35 DOMMatrix* matrix() { return matrix_.Get(); }
33 void setMatrix(DOMMatrix* matrix) { matrix_ = matrix; } 36 void setMatrix(DOMMatrix* matrix) { matrix_ = matrix; }
34 37
35 // Internal methods - from CSSTransformComponent. 38 // Internal methods - from CSSTransformComponent.
36 TransformComponentType GetType() const override { 39 TransformComponentType GetType() const final { return kMatrixType; }
37 return is2d_ ? kMatrixType : kMatrix3DType; 40 DOMMatrix* AsMatrix() const final;
38 } 41 CSSFunctionValue* ToCSSValue() const final;
39 DOMMatrix* AsMatrix() const override { return matrix(); }
40 CSSFunctionValue* ToCSSValue() const override;
41 42
42 DEFINE_INLINE_VIRTUAL_TRACE() { 43 DEFINE_INLINE_VIRTUAL_TRACE() {
43 visitor->Trace(matrix_); 44 visitor->Trace(matrix_);
44 CSSTransformComponent::Trace(visitor); 45 CSSTransformComponent::Trace(visitor);
45 } 46 }
46 47
47 private: 48 private:
48 CSSMatrixComponent(DOMMatrixReadOnly*); 49 CSSMatrixComponent(DOMMatrixReadOnly* matrix, bool is2D)
50 : CSSTransformComponent(is2D), matrix_(DOMMatrix::Create(matrix)) {}
49 51
50 Member<DOMMatrix> matrix_; 52 Member<DOMMatrix> matrix_;
51 bool is2d_;
52 }; 53 };
53 54
54 } // namespace blink 55 } // namespace blink
55 56
56 #endif 57 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core_idl_files.gni ('k') | third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698