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

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

Issue 2921243002: [CSS Typed OM] Add setters for the CSSNumericValues contained in CSSSkew (Closed)
Patch Set: Rebase Created 3 years, 6 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 CSSSkew_h 5 #ifndef CSSSkew_h
6 #define CSSSkew_h 6 #define CSSSkew_h
7 7
8 #include "core/css/cssom/CSSMatrixComponent.h" 8 #include "core/css/cssom/CSSMatrixComponent.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 // Represents a skew value in a CSSTransformValue used for properties like
15 // "transform".
16 // See CSSSkew.idl for more documentation about this class.
14 class CORE_EXPORT CSSSkew final : public CSSTransformComponent { 17 class CORE_EXPORT CSSSkew final : public CSSTransformComponent {
15 WTF_MAKE_NONCOPYABLE(CSSSkew); 18 WTF_MAKE_NONCOPYABLE(CSSSkew);
16 DEFINE_WRAPPERTYPEINFO(); 19 DEFINE_WRAPPERTYPEINFO();
17 20
18 public: 21 public:
19 static CSSSkew* Create(const CSSNumericValue* ax, const CSSNumericValue* ay) { 22 // Constructor defined in the IDL.
23 static CSSSkew* Create(CSSNumericValue* ax, CSSNumericValue* ay) {
20 return new CSSSkew(ax, ay); 24 return new CSSSkew(ax, ay);
21 } 25 }
22 26
27 // Internal ways of creating CSSSkews.
23 static CSSSkew* FromCSSValue(const CSSFunctionValue&); 28 static CSSSkew* FromCSSValue(const CSSFunctionValue&);
24 29
25 // Bindings requires returning non-const pointers. This is safe because 30 // Getters and setters for the ax and ay attributes defined in the IDL.
26 // CSSNumericValues are immutable. 31 CSSNumericValue* ax() const { return ax_.Get(); }
27 CSSNumericValue* ax() const { 32 CSSNumericValue* ay() const { return ay_.Get(); }
28 return const_cast<CSSNumericValue*>(ax_.Get()); 33 void setAx(CSSNumericValue*, ExceptionState&);
29 } 34 void setAy(CSSNumericValue*, ExceptionState&);
30 CSSNumericValue* ay() const {
31 return const_cast<CSSNumericValue*>(ay_.Get());
32 }
33
34 TransformComponentType GetType() const override { return kSkewType; }
35 35
36 CSSMatrixComponent* asMatrix() const override { 36 CSSMatrixComponent* asMatrix() const override {
37 return nullptr; 37 return nullptr;
38 // TODO(meade): Reimplement this once the number/unit types 38 // TODO(meade): Reimplement this once the number/unit types
39 // are re-implemented. 39 // are re-implemented.
40 // return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees()); 40 // return CSSMatrixComponent::Skew(ax_->degrees(), ay_->degrees());
41 } 41 }
42 42
43 // Internal methods - from CSSTransformComponent.
44 TransformComponentType GetType() const override { return kSkewType; }
43 CSSFunctionValue* ToCSSValue() const override; 45 CSSFunctionValue* ToCSSValue() const override;
44 46
45 DEFINE_INLINE_VIRTUAL_TRACE() { 47 DEFINE_INLINE_VIRTUAL_TRACE() {
46 visitor->Trace(ax_); 48 visitor->Trace(ax_);
47 visitor->Trace(ay_); 49 visitor->Trace(ay_);
48 CSSTransformComponent::Trace(visitor); 50 CSSTransformComponent::Trace(visitor);
49 } 51 }
50 52
51 private: 53 private:
52 CSSSkew(const CSSNumericValue* ax, const CSSNumericValue* ay) 54 CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay)
53 : CSSTransformComponent(), ax_(ax), ay_(ay) {} 55 : CSSTransformComponent(), ax_(ax), ay_(ay) {}
54 56
55 Member<const CSSNumericValue> ax_; 57 Member<CSSNumericValue> ax_;
56 Member<const CSSNumericValue> ay_; 58 Member<CSSNumericValue> ay_;
57 }; 59 };
58 60
59 } // namespace blink 61 } // namespace blink
60 62
61 #endif 63 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698