| 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 SimpleLength_h | 5 #ifndef SimpleLength_h |
| 6 #define SimpleLength_h | 6 #define SimpleLength_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/css/cssom/LengthValue.h" | 9 #include "core/css/cssom/LengthValue.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 double value() const { return m_value; } | 34 double value() const { return m_value; } |
| 35 String unit() const { return LengthValue::lengthTypeToString(m_unit); } | 35 String unit() const { return LengthValue::lengthTypeToString(m_unit); } |
| 36 LengthUnit lengthUnit() const { return m_unit; } | 36 LengthUnit lengthUnit() const { return m_unit; } |
| 37 | 37 |
| 38 void setValue(double value) { m_value = value; } | 38 void setValue(double value) { m_value = value; } |
| 39 | 39 |
| 40 StyleValueType type() const override { return StyleValueType::SimpleLengthTy
pe; } | 40 StyleValueType type() const override { return StyleValueType::SimpleLengthTy
pe; } |
| 41 | 41 |
| 42 String cssString() const override; | |
| 43 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override; | 42 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override; |
| 44 | 43 |
| 45 protected: | 44 protected: |
| 46 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); | 45 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); |
| 47 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta
te&); | 46 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta
te&); |
| 48 virtual LengthValue* multiplyInternal(double, ExceptionState&); | 47 virtual LengthValue* multiplyInternal(double, ExceptionState&); |
| 49 virtual LengthValue* divideInternal(double, ExceptionState&); | 48 virtual LengthValue* divideInternal(double, ExceptionState&); |
| 50 | 49 |
| 51 private: | 50 private: |
| 52 SimpleLength(double value, LengthUnit unit) : LengthValue(), m_unit(unit), m
_value(value) {} | 51 SimpleLength(double value, LengthUnit unit) : LengthValue(), m_unit(unit), m
_value(value) {} |
| 53 | 52 |
| 54 LengthUnit m_unit; | 53 LengthUnit m_unit; |
| 55 double m_value; | 54 double m_value; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \ | 57 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \ |
| 59 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \ | 58 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \ |
| 60 value->type() == LengthValue::StyleValueType::SimpleLengthType, \ | 59 value->type() == LengthValue::StyleValueType::SimpleLengthType, \ |
| 61 value.type() == LengthValue::StyleValueType::SimpleLengthType) | 60 value.type() == LengthValue::StyleValueType::SimpleLengthType) |
| 62 | 61 |
| 63 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(LengthValue); | 62 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(LengthValue); |
| 64 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue); | 63 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue); |
| 65 | 64 |
| 66 } // namespace blink | 65 } // namespace blink |
| 67 | 66 |
| 68 #endif | 67 #endif |
| OLD | NEW |