OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CSSUnitValue_h | 5 #ifndef CSSUnitValue_h |
6 #define CSSUnitValue_h | 6 #define CSSUnitValue_h |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/cssom/CSSNumericValue.h" | 9 #include "core/css/cssom/CSSNumericValue.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool ContainsPercent() const final { | 45 bool ContainsPercent() const final { |
46 return unit_ == CSSPrimitiveValue::UnitType::kPercentage; | 46 return unit_ == CSSPrimitiveValue::UnitType::kPercentage; |
47 } | 47 } |
48 const CSSValue* ToCSSValue() const final; | 48 const CSSValue* ToCSSValue() const final; |
49 | 49 |
50 private: | 50 private: |
51 | 51 |
52 CSSUnitValue(double value, CSSPrimitiveValue::UnitType unit) | 52 CSSUnitValue(double value, CSSPrimitiveValue::UnitType unit) |
53 : CSSNumericValue(), value_(value), unit_(unit) {} | 53 : CSSNumericValue(), value_(value), unit_(unit) {} |
54 | 54 |
| 55 double ConvertFixedLength(CSSPrimitiveValue::UnitType) const; |
55 double ConvertAngle(CSSPrimitiveValue::UnitType) const; | 56 double ConvertAngle(CSSPrimitiveValue::UnitType) const; |
56 | 57 |
57 double value_; | 58 double value_; |
58 CSSPrimitiveValue::UnitType unit_; | 59 CSSPrimitiveValue::UnitType unit_; |
59 }; | 60 }; |
60 | 61 |
61 DEFINE_TYPE_CASTS(CSSUnitValue, | 62 DEFINE_TYPE_CASTS(CSSUnitValue, |
62 CSSNumericValue, | 63 CSSNumericValue, |
63 value, | 64 value, |
64 !value->IsCalculated(), | 65 !value->IsCalculated(), |
65 !value.IsCalculated()); | 66 !value.IsCalculated()); |
66 | 67 |
67 } // namespace blink | 68 } // namespace blink |
68 | 69 |
69 #endif // CSSUnitValue_h | 70 #endif // CSSUnitValue_h |
OLD | NEW |