| 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 #include <array> | 10 #include <array> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::bitset<CSSLengthValue::kNumSupportedUnits> m_hasValueForUnit; | 48 std::bitset<CSSLengthValue::kNumSupportedUnits> m_hasValueForUnit; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&); | 51 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&); |
| 52 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) { | 52 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) { |
| 53 return create(length); | 53 return create(length); |
| 54 } | 54 } |
| 55 static CSSCalcLength* create(const CSSLengthValue*); | 55 static CSSCalcLength* create(const CSSLengthValue*); |
| 56 static CSSCalcLength* fromCSSValue(const CSSPrimitiveValue&); | 56 static CSSCalcLength* fromCSSValue(const CSSPrimitiveValue&); |
| 57 | 57 |
| 58 static CSSCalcLength* fromLength(const Length&); |
| 59 |
| 58 #define GETTER_MACRO(name, type) \ | 60 #define GETTER_MACRO(name, type) \ |
| 59 double name(bool& isNull) { \ | 61 double name(bool& isNull) { \ |
| 60 isNull = !m_unitData.has(type); \ | 62 isNull = !m_unitData.has(type); \ |
| 61 return m_unitData.get(type); \ | 63 return m_unitData.get(type); \ |
| 62 } | 64 } |
| 63 | 65 |
| 64 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels) | 66 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels) |
| 65 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage) | 67 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage) |
| 66 GETTER_MACRO(em, CSSPrimitiveValue::UnitType::Ems) | 68 GETTER_MACRO(em, CSSPrimitiveValue::UnitType::Ems) |
| 67 GETTER_MACRO(ex, CSSPrimitiveValue::UnitType::Exs) | 69 GETTER_MACRO(ex, CSSPrimitiveValue::UnitType::Exs) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DEFINE_TYPE_CASTS( \ | 106 DEFINE_TYPE_CASTS( \ |
| 105 CSSCalcLength, argumentType, value, \ | 107 CSSCalcLength, argumentType, value, \ |
| 106 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \ | 108 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \ |
| 107 value.type() == CSSLengthValue::StyleValueType::CalcLengthType) | 109 value.type() == CSSLengthValue::StyleValueType::CalcLengthType) |
| 108 | 110 |
| 109 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue); | 111 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue); |
| 110 | 112 |
| 111 } // namespace blink | 113 } // namespace blink |
| 112 | 114 |
| 113 #endif | 115 #endif |
| OLD | NEW |