Chromium Code Reviews| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 static inline bool isRelativeUnit(CSSPrimitiveValue::UnitType unitType) | 84 static inline bool isRelativeUnit(CSSPrimitiveValue::UnitType unitType) |
| 85 { | 85 { |
| 86 return unitType == CSSPrimitiveValue::UnitType::Percentage | 86 return unitType == CSSPrimitiveValue::UnitType::Percentage |
| 87 || unitType == CSSPrimitiveValue::UnitType::Ems | 87 || unitType == CSSPrimitiveValue::UnitType::Ems |
| 88 || unitType == CSSPrimitiveValue::UnitType::Exs | 88 || unitType == CSSPrimitiveValue::UnitType::Exs |
| 89 || unitType == CSSPrimitiveValue::UnitType::Rems | 89 || unitType == CSSPrimitiveValue::UnitType::Rems |
| 90 || unitType == CSSPrimitiveValue::UnitType::Chs | 90 || unitType == CSSPrimitiveValue::UnitType::Chs |
| 91 || (unitType >= CSSPrimitiveValue::UnitType::ViewportWidth && unitTy pe <= CSSPrimitiveValue::UnitType::ViewportMax); | 91 || (unitType >= CSSPrimitiveValue::UnitType::ViewportWidth && unitTy pe <= CSSPrimitiveValue::UnitType::ViewportMax); |
| 92 } | 92 } |
| 93 inline bool isRelative() const { return isRelativeUnit(m_value->typeWithCalc Resolved()); } | 93 inline bool isRelative() const { return isRelativeUnit(m_value->typeWithCalc Resolved()); } |
| 94 inline bool isPercentage() const { return m_value->typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Percentage; } | |
|
fs
2016/01/28 14:00:20
Just use typeWithCalcResolved directly.
| |
| 94 | 95 |
| 95 bool isZero() const | 96 bool isZero() const |
| 96 { | 97 { |
| 97 return m_value->getFloatValue() == 0; | 98 return m_value->getFloatValue() == 0; |
| 98 } | 99 } |
| 99 | 100 |
| 100 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam e&); | 101 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam e&); |
| 101 static bool negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie dName&); | 102 static bool negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie dName&); |
| 102 | 103 |
| 103 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 104 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
| 104 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio nValue, SVGElement* contextElement) override; | 105 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio nValue, SVGElement* contextElement) override; |
| 105 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt* contextElement) override; | 106 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt* contextElement) override; |
| 106 | 107 |
| 107 static AnimatedPropertyType classType() { return AnimatedLength; } | 108 static AnimatedPropertyType classType() { return AnimatedLength; } |
| 108 | 109 |
| 109 private: | 110 private: |
| 110 SVGLength(SVGLengthMode); | 111 SVGLength(SVGLengthMode); |
| 111 SVGLength(const SVGLength&); | 112 SVGLength(const SVGLength&); |
| 112 | 113 |
| 113 RefPtrWillBeMember<CSSPrimitiveValue> m_value; | 114 RefPtrWillBeMember<CSSPrimitiveValue> m_value; |
| 114 unsigned m_unitMode : 2; | 115 unsigned m_unitMode : 2; |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); | 118 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); |
| 118 | 119 |
| 119 } // namespace blink | 120 } // namespace blink |
| 120 | 121 |
| 121 #endif // SVGLength_h | 122 #endif // SVGLength_h |
| OLD | NEW |