| 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 CSSNumberValue_h | |
| 6 #define CSSNumberValue_h | |
| 7 | |
| 8 #include "core/CoreExport.h" | |
| 9 #include "core/css/CSSPrimitiveValue.h" | |
| 10 #include "core/css/cssom/CSSStyleValue.h" | |
| 11 #include "platform/bindings/ScriptWrappable.h" | |
| 12 #include "platform/wtf/text/WTFString.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class CORE_EXPORT CSSNumberValue final : public CSSStyleValue { | |
| 17 WTF_MAKE_NONCOPYABLE(CSSNumberValue); | |
| 18 DEFINE_WRAPPERTYPEINFO(); | |
| 19 | |
| 20 public: | |
| 21 static CSSNumberValue* Create(double value) { | |
| 22 return new CSSNumberValue(value); | |
| 23 } | |
| 24 | |
| 25 double value() const { return value_; } | |
| 26 | |
| 27 CSSValue* ToCSSValue() const override { | |
| 28 return CSSPrimitiveValue::Create(value_, | |
| 29 CSSPrimitiveValue::UnitType::kNumber); | |
| 30 } | |
| 31 | |
| 32 StyleValueType GetType() const override { | |
| 33 return StyleValueType::kNumberType; | |
| 34 } | |
| 35 | |
| 36 private: | |
| 37 CSSNumberValue(double value) : value_(value) {} | |
| 38 | |
| 39 double value_; | |
| 40 }; | |
| 41 | |
| 42 } // namespace blink | |
| 43 | |
| 44 #endif | |
| OLD | NEW |