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 CSSLengthValue_h | 5 #ifndef CSSLengthValue_h |
6 #define CSSLengthValue_h | 6 #define CSSLengthValue_h |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/cssom/StyleValue.h" | 9 #include "core/css/cssom/CSSStyleValue.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CalcDictionary; | 13 class CalcDictionary; |
14 class ExceptionState; | 14 class ExceptionState; |
15 | 15 |
16 class CORE_EXPORT CSSLengthValue : public StyleValue { | 16 class CORE_EXPORT CSSLengthValue : public CSSStyleValue { |
17 WTF_MAKE_NONCOPYABLE(CSSLengthValue); | 17 WTF_MAKE_NONCOPYABLE(CSSLengthValue); |
18 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 19 public: |
20 static CSSPrimitiveValue::UnitType unitFromName(const String& name); | 20 static CSSPrimitiveValue::UnitType unitFromName(const String& name); |
21 | 21 |
22 CSSLengthValue* add(const CSSLengthValue* other, ExceptionState&); | 22 CSSLengthValue* add(const CSSLengthValue* other, ExceptionState&); |
23 CSSLengthValue* subtract(const CSSLengthValue* other, ExceptionState&); | 23 CSSLengthValue* subtract(const CSSLengthValue* other, ExceptionState&); |
24 CSSLengthValue* multiply(double, ExceptionState&); | 24 CSSLengthValue* multiply(double, ExceptionState&); |
25 CSSLengthValue* divide(double, ExceptionState&); | 25 CSSLengthValue* divide(double, ExceptionState&); |
26 | 26 |
(...skipping 14 matching lines...) Expand all Loading... |
41 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit) | 41 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit) |
42 { | 42 { |
43 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue::
UnitType::Percentage) | 43 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue::
UnitType::Percentage) |
44 && unit != CSSPrimitiveValue::UnitType::QuirkyEms | 44 && unit != CSSPrimitiveValue::UnitType::QuirkyEms |
45 && unit != CSSPrimitiveValue::UnitType::UserUnits; | 45 && unit != CSSPrimitiveValue::UnitType::UserUnits; |
46 } | 46 } |
47 | 47 |
48 static const int kNumSupportedUnits = 15; | 48 static const int kNumSupportedUnits = 15; |
49 }; | 49 }; |
50 | 50 |
51 DEFINE_TYPE_CASTS(CSSLengthValue, StyleValue, value, | 51 DEFINE_TYPE_CASTS(CSSLengthValue, CSSStyleValue, value, |
52 (value->type() == StyleValue::SimpleLengthType | 52 (value->type() == CSSStyleValue::SimpleLengthType |
53 || value->type() == StyleValue::CalcLengthType), | 53 || value->type() == CSSStyleValue::CalcLengthType), |
54 (value.type() == StyleValue::SimpleLengthType | 54 (value.type() == CSSStyleValue::SimpleLengthType |
55 || value.type() == StyleValue::CalcLengthType)); | 55 || value.type() == CSSStyleValue::CalcLengthType)); |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
58 | 58 |
59 #endif | 59 #endif |
OLD | NEW |