| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 CSSPrimitiveValue::UnitType typeWithCalcResolved() const { return m_value->t
ypeWithCalcResolved(); } | 50 CSSPrimitiveValue::UnitType typeWithCalcResolved() const { return m_value->t
ypeWithCalcResolved(); } |
| 51 void setUnitType(CSSPrimitiveValue::UnitType); | 51 void setUnitType(CSSPrimitiveValue::UnitType); |
| 52 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } | 52 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } |
| 53 | 53 |
| 54 bool operator==(const SVGLength&) const; | 54 bool operator==(const SVGLength&) const; |
| 55 bool operator!=(const SVGLength& other) const { return !operator==(other); } | 55 bool operator!=(const SVGLength& other) const { return !operator==(other); } |
| 56 | 56 |
| 57 float value(const SVGLengthContext&) const; | 57 float value(const SVGLengthContext&) const; |
| 58 void setValue(float, const SVGLengthContext&); | 58 void setValue(float, const SVGLengthContext&); |
| 59 void setValueAsNumber(float); |
| 59 | 60 |
| 60 float valueInSpecifiedUnits() const { return m_value->getFloatValue(); } | 61 float valueInSpecifiedUnits() const { return m_value->getFloatValue(); } |
| 61 void setValueInSpecifiedUnits(float value) | 62 void setValueInSpecifiedUnits(float value) |
| 62 { | 63 { |
| 63 m_value = CSSPrimitiveValue::create(value, m_value->typeWithCalcResolved
()); | 64 m_value = CSSPrimitiveValue::create(value, m_value->typeWithCalcResolved
()); |
| 64 } | 65 } |
| 65 | 66 |
| 66 const CSSPrimitiveValue* asCSSPrimitiveValue() const { return m_value.get();
} | 67 const CSSPrimitiveValue* asCSSPrimitiveValue() const { return m_value.get();
} |
| 67 | 68 |
| 68 // Resolves LengthTypePercentage into a normalized floating point number (fu
ll value is 1.0). | 69 // Resolves LengthTypePercentage into a normalized floating point number (fu
ll value is 1.0). |
| 69 float valueAsPercentage() const; | 70 float valueAsPercentage() const; |
| 70 | 71 |
| 71 // Returns a number to be used as percentage (so full value is 100) | 72 // Returns a number to be used as percentage (so full value is 100) |
| 72 float valueAsPercentage100() const; | 73 float valueAsPercentage100() const; |
| 73 | 74 |
| 74 // Scale the input value by this SVGLength. Higher precision than input * va
lueAsPercentage(). | 75 // Scale the input value by this SVGLength. Higher precision than input * va
lueAsPercentage(). |
| 75 float scaleByPercentage(float) const; | 76 float scaleByPercentage(float) const; |
| 76 | 77 |
| 77 String valueAsString() const override; | 78 String valueAsString() const override; |
| 78 SVGParsingError setValueAsString(const String&); | 79 SVGParsingError setValueAsString(const String&); |
| 79 | 80 |
| 80 void newValueSpecifiedUnits(CSSPrimitiveValue::UnitType, float valueInSpecif
iedUnits); | 81 void newValueSpecifiedUnits(CSSPrimitiveValue::UnitType, float valueInSpecif
iedUnits); |
| 81 void convertToSpecifiedUnits(CSSPrimitiveValue::UnitType, const SVGLengthCon
text&); | 82 void convertToSpecifiedUnits(CSSPrimitiveValue::UnitType, const SVGLengthCon
text&); |
| 82 | 83 |
| 83 // Helper functions | 84 // Helper functions |
| 84 inline bool isRelative() const { return CSSPrimitiveValue::isRelativeUnit(m_
value->typeWithCalcResolved()); } | 85 inline bool isRelative() const { return CSSPrimitiveValue::isRelativeUnit(m_
value->typeWithCalcResolved()); } |
| 86 inline bool isCalculated() const { return m_value->isCalculated(); } |
| 85 | 87 |
| 86 bool isZero() const | 88 bool isZero() const |
| 87 { | 89 { |
| 88 return m_value->getFloatValue() == 0; | 90 return m_value->getFloatValue() == 0; |
| 89 } | 91 } |
| 90 | 92 |
| 91 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam
e&); | 93 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam
e&); |
| 92 static bool negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie
dName&); | 94 static bool negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie
dName&); |
| 93 | 95 |
| 94 void add(SVGPropertyBase*, SVGElement*) override; | 96 void add(SVGPropertyBase*, SVGElement*) override; |
| 95 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, SVGPropertyBase* from, SVGPropertyBase* to, SVGPropertyBase* toAtE
ndOfDurationValue, SVGElement* contextElement) override; | 97 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, SVGPropertyBase* from, SVGPropertyBase* to, SVGPropertyBase* toAtE
ndOfDurationValue, SVGElement* contextElement) override; |
| 96 float calculateDistance(SVGPropertyBase* to, SVGElement* contextElement) ove
rride; | 98 float calculateDistance(SVGPropertyBase* to, SVGElement* contextElement) ove
rride; |
| 97 | 99 |
| 98 static AnimatedPropertyType classType() { return AnimatedLength; } | 100 static AnimatedPropertyType classType() { return AnimatedLength; } |
| 99 AnimatedPropertyType type() const override { return classType(); } | 101 AnimatedPropertyType type() const override { return classType(); } |
| 100 | 102 |
| 101 private: | 103 private: |
| 102 SVGLength(SVGLengthMode); | 104 SVGLength(SVGLengthMode); |
| 103 SVGLength(const SVGLength&); | 105 SVGLength(const SVGLength&); |
| 104 | 106 |
| 105 Member<const CSSPrimitiveValue> m_value; | 107 Member<const CSSPrimitiveValue> m_value; |
| 106 unsigned m_unitMode : 2; | 108 unsigned m_unitMode : 2; |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); | 111 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); |
| 110 | 112 |
| 111 } // namespace blink | 113 } // namespace blink |
| 112 | 114 |
| 113 #endif // SVGLength_h | 115 #endif // SVGLength_h |
| OLD | NEW |