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