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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/CSSTranslation.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 CSSTranslation_h 5 #ifndef CSSTranslation_h
6 #define CSSTranslation_h 6 #define CSSTranslation_h
7 7
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/cssom/CSSStyleValue.h" 9 #include "core/css/cssom/CSSStyleValue.h"
10 #include "core/css/cssom/CSSTransformComponent.h" 10 #include "core/css/cssom/CSSTransformComponent.h"
(...skipping 13 matching lines...) Expand all
24 DEFINE_WRAPPERTYPEINFO(); 24 DEFINE_WRAPPERTYPEINFO();
25 25
26 public: 26 public:
27 // Constructors defined in the IDL. 27 // Constructors defined in the IDL.
28 static CSSTranslation* Create(CSSNumericValue* x, 28 static CSSTranslation* Create(CSSNumericValue* x,
29 CSSNumericValue* y, 29 CSSNumericValue* y,
30 CSSNumericValue* z, 30 CSSNumericValue* z,
31 ExceptionState&); 31 ExceptionState&);
32 static CSSTranslation* Create(CSSNumericValue* x, 32 static CSSTranslation* Create(CSSNumericValue* x,
33 CSSNumericValue* y, 33 CSSNumericValue* y,
34 ExceptionState& exception_state) { 34 ExceptionState&);
35 return Create(x, y, nullptr, exception_state);
36 }
37 35
38 // Blink-internal ways of creating CSSTranslations. 36 // Blink-internal ways of creating CSSTranslations.
39 static CSSTranslation* FromCSSValue(const CSSFunctionValue& value) { 37 static CSSTranslation* FromCSSValue(const CSSFunctionValue& value) {
40 return nullptr; 38 return nullptr;
41 } 39 }
42 40
43 // Getters and setters for attributes defined in the IDL. 41 // Getters and setters for attributes defined in the IDL.
44 CSSNumericValue* x() const { return x_; } 42 CSSNumericValue* x() const { return x_; }
45 CSSNumericValue* y() const { return y_; } 43 CSSNumericValue* y() const { return y_; }
46 CSSNumericValue* z() const { return z_; } 44 CSSNumericValue* z() const { return z_; }
47 void setX(CSSNumericValue* x, ExceptionState&); 45 void setX(CSSNumericValue* x, ExceptionState&);
48 void setY(CSSNumericValue* y, ExceptionState&); 46 void setY(CSSNumericValue* y, ExceptionState&);
49 void setZ(CSSNumericValue* z, ExceptionState&); 47 void setZ(CSSNumericValue* z, ExceptionState&);
50 48
51 // Internal methods - from CSSTransformComponent. 49 // Internal methods - from CSSTransformComponent.
52 TransformComponentType GetType() const final { 50 TransformComponentType GetType() const final { return kTranslationType; }
53 return Is2D() ? kTranslationType : kTranslation3DType;
54 }
55 // TODO: Implement AsMatrix for CSSTranslation. 51 // TODO: Implement AsMatrix for CSSTranslation.
56 DOMMatrix* AsMatrix() const final { return nullptr; } 52 DOMMatrix* AsMatrix() const final { return nullptr; }
57 CSSFunctionValue* ToCSSValue() const final; 53 CSSFunctionValue* ToCSSValue() const final;
58 54
59 DEFINE_INLINE_VIRTUAL_TRACE() { 55 DEFINE_INLINE_VIRTUAL_TRACE() {
60 visitor->Trace(x_); 56 visitor->Trace(x_);
61 visitor->Trace(y_); 57 visitor->Trace(y_);
62 visitor->Trace(z_); 58 visitor->Trace(z_);
63 CSSTransformComponent::Trace(visitor); 59 CSSTransformComponent::Trace(visitor);
64 } 60 }
65 61
66 private: 62 private:
67 CSSTranslation(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z) 63 CSSTranslation(CSSNumericValue* x,
68 : CSSTransformComponent(), x_(x), y_(y), z_(z) {} 64 CSSNumericValue* y,
69 65 CSSNumericValue* z,
70 bool Is2D() const { return !z_; } 66 bool is2D)
67 : CSSTransformComponent(is2D), x_(x), y_(y), z_(z) {}
71 68
72 Member<CSSNumericValue> x_; 69 Member<CSSNumericValue> x_;
73 Member<CSSNumericValue> y_; 70 Member<CSSNumericValue> y_;
74 Member<CSSNumericValue> z_; 71 Member<CSSNumericValue> z_;
75 }; 72 };
76 73
77 } // namespace blink 74 } // namespace blink
78 75
79 #endif 76 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698