| 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 CSSPositionValue_h | 5 #ifndef CSSPositionValue_h |
| 6 #define CSSPositionValue_h | 6 #define CSSPositionValue_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/css/cssom/CSSStyleValue.h" | 9 #include "core/css/cssom/CSSStyleValue.h" |
| 10 #include "platform/bindings/ScriptWrappable.h" | 10 #include "platform/bindings/ScriptWrappable.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class CSSLengthValue; | 14 class CSSNumericValue; |
| 15 | 15 |
| 16 class CORE_EXPORT CSSPositionValue final : public CSSStyleValue { | 16 class CORE_EXPORT CSSPositionValue final : public CSSStyleValue { |
| 17 WTF_MAKE_NONCOPYABLE(CSSPositionValue); | 17 WTF_MAKE_NONCOPYABLE(CSSPositionValue); |
| 18 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
| 19 | 19 |
| 20 public: | 20 public: |
| 21 static CSSPositionValue* Create(const CSSLengthValue* x, | 21 static CSSPositionValue* Create(const CSSNumericValue* x, |
| 22 const CSSLengthValue* y) { | 22 const CSSNumericValue* y) { |
| 23 return new CSSPositionValue(x, y); | 23 return new CSSPositionValue(x, y); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // Bindings require a non const return value. | 26 // Bindings require a non const return value. |
| 27 CSSLengthValue* x() const { return const_cast<CSSLengthValue*>(x_.Get()); } | 27 CSSNumericValue* x() const { return const_cast<CSSNumericValue*>(x_.Get()); } |
| 28 CSSLengthValue* y() const { return const_cast<CSSLengthValue*>(y_.Get()); } | 28 CSSNumericValue* y() const { return const_cast<CSSNumericValue*>(y_.Get()); } |
| 29 | 29 |
| 30 StyleValueType GetType() const override { return kPositionType; } | 30 StyleValueType GetType() const override { return kPositionType; } |
| 31 | 31 |
| 32 CSSValue* ToCSSValue() const override; | 32 CSSValue* ToCSSValue() const override; |
| 33 | 33 |
| 34 DEFINE_INLINE_VIRTUAL_TRACE() { | 34 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 35 visitor->Trace(x_); | 35 visitor->Trace(x_); |
| 36 visitor->Trace(y_); | 36 visitor->Trace(y_); |
| 37 CSSStyleValue::Trace(visitor); | 37 CSSStyleValue::Trace(visitor); |
| 38 } | 38 } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 CSSPositionValue(const CSSLengthValue* x, const CSSLengthValue* y) | 41 CSSPositionValue(const CSSNumericValue* x, const CSSNumericValue* y) |
| 42 : x_(x), y_(y) {} | 42 : x_(x), y_(y) {} |
| 43 | 43 |
| 44 Member<const CSSLengthValue> x_; | 44 Member<const CSSNumericValue> x_; |
| 45 Member<const CSSLengthValue> y_; | 45 Member<const CSSNumericValue> y_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace blink | 48 } // namespace blink |
| 49 | 49 |
| 50 #endif | 50 #endif |
| OLD | NEW |