| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 NumberValue_h | 5 #ifndef NumberValue_h |
| 6 #define NumberValue_h | 6 #define NumberValue_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
| 11 #include "core/css/cssom/StyleValue.h" | 11 #include "core/css/cssom/StyleValue.h" |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class CORE_EXPORT NumberValue final : public StyleValue { | 16 class CORE_EXPORT NumberValue final : public StyleValue { |
| 17 WTF_MAKE_NONCOPYABLE(NumberValue); | 17 WTF_MAKE_NONCOPYABLE(NumberValue); |
| 18 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: | 19 public: |
| 20 static NumberValue* create(double value) | 20 static NumberValue* create(double value) |
| 21 { | 21 { |
| 22 return new NumberValue(value); | 22 return new NumberValue(value); |
| 23 } | 23 } |
| 24 | 24 |
| 25 double value() const { return m_value; } | 25 double value() const { return m_value; } |
| 26 | 26 |
| 27 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override | 27 RawPtr<CSSValue> toCSSValue() const override |
| 28 { | 28 { |
| 29 return cssValuePool().createValue(m_value, CSSPrimitiveValue::UnitType:: | 29 return cssValuePool().createValue(m_value, CSSPrimitiveValue::UnitType:: |
| 30 Number); | 30 Number); |
| 31 } | 31 } |
| 32 | 32 |
| 33 StyleValueType type() const override { return StyleValueType::NumberType; } | 33 StyleValueType type() const override { return StyleValueType::NumberType; } |
| 34 private: | 34 private: |
| 35 NumberValue(double value) : m_value(value) {} | 35 NumberValue(double value) : m_value(value) {} |
| 36 | 36 |
| 37 double m_value; | 37 double m_value; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace blink | 40 } // namespace blink |
| 41 | 41 |
| 42 #endif | 42 #endif |
| OLD | NEW |