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 CSSAngleValue_h | 5 #ifndef CSSAngleValue_h |
6 #define CSSAngleValue_h | 6 #define CSSAngleValue_h |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/cssom/CSSStyleValue.h" | 9 #include "core/css/cssom/CSSStyleValue.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT CSSAngleValue final : public CSSStyleValue { | 13 class CORE_EXPORT CSSAngleValue final : public CSSStyleValue { |
14 WTF_MAKE_NONCOPYABLE(CSSAngleValue); | 14 WTF_MAKE_NONCOPYABLE(CSSAngleValue); |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 | 16 |
17 public: | 17 public: |
18 static CSSAngleValue* create(double value, const String& unit); | 18 static CSSAngleValue* create(double value, const String& unit); |
| 19 static CSSAngleValue* create(double value, CSSPrimitiveValue::UnitType); |
19 static CSSAngleValue* fromCSSValue(const CSSPrimitiveValue&); | 20 static CSSAngleValue* fromCSSValue(const CSSPrimitiveValue&); |
20 | 21 |
21 StyleValueType type() const override { return AngleType; } | 22 StyleValueType type() const override { return AngleType; } |
22 | 23 |
23 double degrees() const; | 24 double degrees() const; |
24 double radians() const; | 25 double radians() const; |
25 double gradians() const; | 26 double gradians() const; |
26 double turns() const; | 27 double turns() const; |
27 | 28 |
28 double value() const { return m_value; } | 29 double value() const { return m_value; } |
29 CSSPrimitiveValue::UnitType unit() const { return m_unit; } | 30 CSSPrimitiveValue::UnitType unit() const { return m_unit; } |
30 CSSValue* toCSSValue() const override; | 31 CSSValue* toCSSValue() const override; |
31 | 32 |
32 private: | 33 private: |
33 CSSAngleValue(double value, CSSPrimitiveValue::UnitType unit) | 34 CSSAngleValue(double value, CSSPrimitiveValue::UnitType unit) |
34 : m_value(value), m_unit(unit) {} | 35 : m_value(value), m_unit(unit) {} |
35 | 36 |
36 double m_value; | 37 double m_value; |
37 CSSPrimitiveValue::UnitType m_unit; | 38 CSSPrimitiveValue::UnitType m_unit; |
38 }; | 39 }; |
39 } | 40 } |
40 | 41 |
41 #endif // CSSAngleValue_h | 42 #endif // CSSAngleValue_h |
OLD | NEW |