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 StyleCalcLength_h | 5 #ifndef StyleCalcLength_h |
6 #define StyleCalcLength_h | 6 #define StyleCalcLength_h |
7 | 7 |
8 #include "core/css/cssom/LengthValue.h" | 8 #include "core/css/cssom/LengthValue.h" |
9 #include "wtf/BitVector.h" | 9 #include "wtf/BitVector.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 GETTER_MACRO(cm, CSSPrimitiveValue::UnitType::Centimeters) | 43 GETTER_MACRO(cm, CSSPrimitiveValue::UnitType::Centimeters) |
44 GETTER_MACRO(mm, CSSPrimitiveValue::UnitType::Millimeters) | 44 GETTER_MACRO(mm, CSSPrimitiveValue::UnitType::Millimeters) |
45 GETTER_MACRO(in, CSSPrimitiveValue::UnitType::Inches) | 45 GETTER_MACRO(in, CSSPrimitiveValue::UnitType::Inches) |
46 GETTER_MACRO(pc, CSSPrimitiveValue::UnitType::Picas) | 46 GETTER_MACRO(pc, CSSPrimitiveValue::UnitType::Picas) |
47 GETTER_MACRO(pt, CSSPrimitiveValue::UnitType::Points) | 47 GETTER_MACRO(pt, CSSPrimitiveValue::UnitType::Points) |
48 | 48 |
49 #undef GETTER_MACRO | 49 #undef GETTER_MACRO |
50 | 50 |
51 bool containsPercent() const override; | 51 bool containsPercent() const override; |
52 | 52 |
| 53 bool isRelative() const override |
| 54 { |
| 55 return has(CSSPrimitiveValue::UnitType::Percentage) |
| 56 || has(CSSPrimitiveValue::UnitType::Ems) |
| 57 || has(CSSPrimitiveValue::UnitType::Exs) |
| 58 || has(CSSPrimitiveValue::UnitType::Chs) |
| 59 || has(CSSPrimitiveValue::UnitType::Rems) |
| 60 || has(CSSPrimitiveValue::UnitType::ViewportWidth) |
| 61 || has(CSSPrimitiveValue::UnitType::ViewportHeight) |
| 62 || has(CSSPrimitiveValue::UnitType::ViewportMin) |
| 63 || has(CSSPrimitiveValue::UnitType::ViewportMax); |
| 64 } |
| 65 |
53 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override; | 66 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override; |
54 | 67 |
55 StyleValueType type() const override { return CalcLengthType; } | 68 StyleValueType type() const override { return CalcLengthType; } |
56 protected: | 69 protected: |
57 LengthValue* addInternal(const LengthValue* other, ExceptionState&) override
; | 70 LengthValue* addInternal(const LengthValue* other, ExceptionState&) override
; |
58 LengthValue* subtractInternal(const LengthValue* other, ExceptionState&) ove
rride; | 71 LengthValue* subtractInternal(const LengthValue* other, ExceptionState&) ove
rride; |
59 LengthValue* multiplyInternal(double, ExceptionState&) override; | 72 LengthValue* multiplyInternal(double, ExceptionState&) override; |
60 LengthValue* divideInternal(double, ExceptionState&) override; | 73 LengthValue* divideInternal(double, ExceptionState&) override; |
61 | 74 |
62 private: | 75 private: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #define DEFINE_CALC_LENGTH_TYPE_CASTS(argumentType) \ | 112 #define DEFINE_CALC_LENGTH_TYPE_CASTS(argumentType) \ |
100 DEFINE_TYPE_CASTS(StyleCalcLength, argumentType, value, \ | 113 DEFINE_TYPE_CASTS(StyleCalcLength, argumentType, value, \ |
101 value->type() == LengthValue::StyleValueType::CalcLengthType, \ | 114 value->type() == LengthValue::StyleValueType::CalcLengthType, \ |
102 value.type() == LengthValue::StyleValueType::CalcLengthType) | 115 value.type() == LengthValue::StyleValueType::CalcLengthType) |
103 | 116 |
104 DEFINE_CALC_LENGTH_TYPE_CASTS(StyleValue); | 117 DEFINE_CALC_LENGTH_TYPE_CASTS(StyleValue); |
105 | 118 |
106 } // namespace blink | 119 } // namespace blink |
107 | 120 |
108 #endif | 121 #endif |
OLD | NEW |