| 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 CSSSimpleLength_h | 5 #ifndef CSSSimpleLength_h |
| 6 #define CSSSimpleLength_h | 6 #define CSSSimpleLength_h |
| 7 | 7 |
| 8 #include "core/css/cssom/CSSLengthValue.h" | 8 #include "core/css/cssom/CSSLengthValue.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class CSSPrimitiveValue; | 12 class CSSPrimitiveValue; |
| 13 class ExceptionState; | 13 class ExceptionState; |
| 14 | 14 |
| 15 class CORE_EXPORT CSSSimpleLength final : public CSSLengthValue { | 15 class CORE_EXPORT CSSSimpleLength final : public CSSLengthValue { |
| 16 WTF_MAKE_NONCOPYABLE(CSSSimpleLength); | 16 WTF_MAKE_NONCOPYABLE(CSSSimpleLength); |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 public: | 18 public: |
| 19 static CSSSimpleLength* create(double, const String& type, ExceptionState&); | 19 static CSSSimpleLength* create(double, const String& type, ExceptionState&); |
| 20 static CSSSimpleLength* create(double value, CSSPrimitiveValue::UnitType typ
e) | 20 static CSSSimpleLength* create(double value, CSSPrimitiveValue::UnitType typ
e) |
| 21 { | 21 { |
| 22 return new CSSSimpleLength(value, type); | 22 return new CSSSimpleLength(value, type); |
| 23 } | 23 } |
| 24 static CSSSimpleLength* fromCSSValue(const CSSPrimitiveValue&); | 24 static CSSSimpleLength* fromCSSValue(const CSSPrimitiveValue&); |
| 25 | 25 |
| 26 bool containsPercent() const override; | 26 bool containsPercent() const override; |
| 27 | 27 |
| 28 double value() const { return m_value; } | 28 double value() const { return m_value; } |
| 29 String unit() const { return String(CSSPrimitiveValue::unitTypeToString(m_un
it)); } | 29 String unit() const; |
| 30 CSSPrimitiveValue::UnitType lengthUnit() const { return m_unit; } | 30 CSSPrimitiveValue::UnitType lengthUnit() const { return m_unit; } |
| 31 | 31 |
| 32 StyleValueType type() const override { return StyleValueType::SimpleLengthTy
pe; } | 32 StyleValueType type() const override { return StyleValueType::SimpleLengthTy
pe; } |
| 33 | 33 |
| 34 CSSValue* toCSSValue() const override; | 34 CSSValue* toCSSValue() const override; |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 virtual CSSLengthValue* addInternal(const CSSLengthValue* other); | 37 virtual CSSLengthValue* addInternal(const CSSLengthValue* other); |
| 38 virtual CSSLengthValue* subtractInternal(const CSSLengthValue* other); | 38 virtual CSSLengthValue* subtractInternal(const CSSLengthValue* other); |
| 39 virtual CSSLengthValue* multiplyInternal(double); | 39 virtual CSSLengthValue* multiplyInternal(double); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 DEFINE_TYPE_CASTS(CSSSimpleLength, argumentType, value, \ | 50 DEFINE_TYPE_CASTS(CSSSimpleLength, argumentType, value, \ |
| 51 value->type() == CSSLengthValue::StyleValueType::SimpleLengthType, \ | 51 value->type() == CSSLengthValue::StyleValueType::SimpleLengthType, \ |
| 52 value.type() == CSSLengthValue::StyleValueType::SimpleLengthType) | 52 value.type() == CSSLengthValue::StyleValueType::SimpleLengthType) |
| 53 | 53 |
| 54 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(CSSLengthValue); | 54 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(CSSLengthValue); |
| 55 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(CSSStyleValue); | 55 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(CSSStyleValue); |
| 56 | 56 |
| 57 } // namespace blink | 57 } // namespace blink |
| 58 | 58 |
| 59 #endif | 59 #endif |
| OLD | NEW |