| 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 CSSCalcLength_h | 5 #ifndef CSSCalcLength_h |
| 6 #define CSSCalcLength_h | 6 #define CSSCalcLength_h |
| 7 | 7 |
| 8 #include "core/css/cssom/CSSLengthValue.h" | 8 #include "core/css/cssom/CSSLengthValue.h" |
| 9 #include "wtf/BitVector.h" | 9 #include "wtf/BitVector.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class CSSCalcDictionary; | 13 class CSSCalcDictionary; |
| 14 class CSSSimpleLength; | 14 class CSSSimpleLength; |
| 15 | 15 |
| 16 class CORE_EXPORT CSSCalcLength final : public CSSLengthValue { | 16 class CORE_EXPORT CSSCalcLength final : public CSSLengthValue { |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 public: | 18 public: |
| 19 static CSSCalcLength* create(const CSSLengthValue*); | 19 static CSSCalcLength* create(const CSSLengthValue*); |
| 20 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&); | 20 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&); |
| 21 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) | 21 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) |
| 22 { | 22 { |
| 23 return create(length); | 23 return create(length); |
| 24 } | 24 } |
| 25 static CSSCalcLength* fromCSSValue(const CSSPrimitiveValue&); |
| 25 | 26 |
| 26 #define GETTER_MACRO(name, type) \ | 27 #define GETTER_MACRO(name, type) \ |
| 27 double name(bool& isNull) \ | 28 double name(bool& isNull) \ |
| 28 { \ | 29 { \ |
| 29 isNull = !hasAtIndex(indexForUnit(type)); \ | 30 isNull = !hasAtIndex(indexForUnit(type)); \ |
| 30 return get(type); \ | 31 return get(type); \ |
| 31 } | 32 } |
| 32 | 33 |
| 33 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels) | 34 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels) |
| 34 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage) | 35 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #define DEFINE_CALC_LENGTH_TYPE_CASTS(argumentType) \ | 100 #define DEFINE_CALC_LENGTH_TYPE_CASTS(argumentType) \ |
| 100 DEFINE_TYPE_CASTS(CSSCalcLength, argumentType, value, \ | 101 DEFINE_TYPE_CASTS(CSSCalcLength, argumentType, value, \ |
| 101 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \ | 102 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \ |
| 102 value.type() == CSSLengthValue::StyleValueType::CalcLengthType) | 103 value.type() == CSSLengthValue::StyleValueType::CalcLengthType) |
| 103 | 104 |
| 104 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue); | 105 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue); |
| 105 | 106 |
| 106 } // namespace blink | 107 } // namespace blink |
| 107 | 108 |
| 108 #endif | 109 #endif |
| OLD | NEW |