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 CSSNumberValue_h | 5 #ifndef CSSNumberValue_h |
6 #define CSSNumberValue_h | 6 #define CSSNumberValue_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/CSSStyleValue.h" | 11 #include "core/css/cssom/CSSStyleValue.h" |
12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
| 15 namespace cssom { |
15 | 16 |
16 class CORE_EXPORT CSSNumberValue final : public CSSStyleValue { | 17 class CORE_EXPORT CSSNumberValue final : public CSSStyleValue { |
17 WTF_MAKE_NONCOPYABLE(CSSNumberValue); | 18 WTF_MAKE_NONCOPYABLE(CSSNumberValue); |
18 DEFINE_WRAPPERTYPEINFO(); | 19 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 20 public: |
20 static CSSNumberValue* create(double value) | 21 static CSSNumberValue* create(double value) |
21 { | 22 { |
22 return new CSSNumberValue(value); | 23 return new CSSNumberValue(value); |
23 } | 24 } |
24 | 25 |
25 double value() const { return m_value; } | 26 double value() const { return m_value; } |
26 | 27 |
27 CSSValue* toCSSValue() const override | 28 CSSValue* toCSSValue() const override |
28 { | 29 { |
29 return CSSPrimitiveValue::create(m_value, CSSPrimitiveValue::UnitType:: | 30 return CSSPrimitiveValue::create(m_value, CSSPrimitiveValue::UnitType:: |
30 Number); | 31 Number); |
31 } | 32 } |
32 | 33 |
33 StyleValueType type() const override { return StyleValueType::NumberType; } | 34 StyleValueType type() const override { return StyleValueType::NumberType; } |
34 private: | 35 private: |
35 CSSNumberValue(double value) : m_value(value) {} | 36 CSSNumberValue(double value) : m_value(value) {} |
36 | 37 |
37 double m_value; | 38 double m_value; |
38 }; | 39 }; |
39 | 40 |
| 41 } // namespace cssom |
40 } // namespace blink | 42 } // namespace blink |
41 | 43 |
| 44 |
42 #endif | 45 #endif |
OLD | NEW |