| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri
ng&) const override; | 51 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri
ng&) const override; |
| 52 | 52 |
| 53 SVGLengthType unitType() const { return static_cast<SVGLengthType>(m_unitTyp
e); } | 53 SVGLengthType unitType() const { return static_cast<SVGLengthType>(m_unitTyp
e); } |
| 54 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const | 54 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const |
| 55 { | 55 { |
| 56 if (m_unitType == LengthTypeNumber) | 56 if (m_unitType == LengthTypeNumber) |
| 57 return CSSPrimitiveValue::UnitType::CSS_PX; | 57 return CSSPrimitiveValue::UnitType::CSS_PX; |
| 58 | 58 |
| 59 if (m_unitType == LengthTypeREMS) | 59 if (m_unitType == LengthTypeREMS) |
| 60 return CSSPrimitiveValue::UnitType::CSS_REMS; | 60 return CSSPrimitiveValue::UnitType::CSS_REMS; |
| 61 if (m_unitType == LengthTypeCHS) |
| 62 return CSSPrimitiveValue::UnitType::CSS_CHS; |
| 61 | 63 |
| 62 return static_cast<CSSPrimitiveValue::UnitType>(m_unitType); | 64 return static_cast<CSSPrimitiveValue::UnitType>(m_unitType); |
| 63 } | 65 } |
| 64 void setUnitType(SVGLengthType); | 66 void setUnitType(SVGLengthType); |
| 65 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } | 67 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } |
| 66 | 68 |
| 67 bool operator==(const SVGLength&) const; | 69 bool operator==(const SVGLength&) const; |
| 68 bool operator!=(const SVGLength& other) const { return !operator==(other); } | 70 bool operator!=(const SVGLength& other) const { return !operator==(other); } |
| 69 | 71 |
| 70 float value(const SVGLengthContext&) const; | 72 float value(const SVGLengthContext&) const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 87 | 89 |
| 88 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits); | 90 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits); |
| 89 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&); | 91 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&); |
| 90 | 92 |
| 91 // Helper functions | 93 // Helper functions |
| 92 static inline bool isRelativeUnit(SVGLengthType unitType) | 94 static inline bool isRelativeUnit(SVGLengthType unitType) |
| 93 { | 95 { |
| 94 return unitType == LengthTypePercentage | 96 return unitType == LengthTypePercentage |
| 95 || unitType == LengthTypeEMS | 97 || unitType == LengthTypeEMS |
| 96 || unitType == LengthTypeEXS | 98 || unitType == LengthTypeEXS |
| 97 || unitType == LengthTypeREMS; | 99 || unitType == LengthTypeREMS |
| 100 || unitType == LengthTypeCHS; |
| 98 } | 101 } |
| 99 inline bool isRelative() const { return isRelativeUnit(unitType()); } | 102 inline bool isRelative() const { return isRelativeUnit(unitType()); } |
| 100 | 103 |
| 101 bool isZero() const | 104 bool isZero() const |
| 102 { | 105 { |
| 103 return !m_valueInSpecifiedUnits; | 106 return !m_valueInSpecifiedUnits; |
| 104 } | 107 } |
| 105 | 108 |
| 106 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV
alue*); | 109 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV
alue*); |
| 107 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef
PtrWillBeRawPtr<SVGLength>); | 110 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef
PtrWillBeRawPtr<SVGLength>); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 127 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) | 130 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) |
| 128 { | 131 { |
| 129 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; | 132 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
| 130 ASSERT(base->type() == SVGLength::classType()); | 133 ASSERT(base->type() == SVGLength::classType()); |
| 131 return static_pointer_cast<SVGLength>(base.release()); | 134 return static_pointer_cast<SVGLength>(base.release()); |
| 132 } | 135 } |
| 133 | 136 |
| 134 } // namespace blink | 137 } // namespace blink |
| 135 | 138 |
| 136 #endif // SVGLength_h | 139 #endif // SVGLength_h |
| OLD | NEW |