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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 { | 46 { |
47 return adoptRefWillBeNoop(new SVGLength(mode)); | 47 return adoptRefWillBeNoop(new SVGLength(mode)); |
48 } | 48 } |
49 | 49 |
50 DECLARE_VIRTUAL_TRACE(); | 50 DECLARE_VIRTUAL_TRACE(); |
51 | 51 |
52 PassRefPtrWillBeRawPtr<SVGLength> clone() const; | 52 PassRefPtrWillBeRawPtr<SVGLength> clone() const; |
53 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; | 53 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; |
54 | 54 |
55 CSSPrimitiveValue::UnitType typeWithCalcResolved() const { return m_value->t
ypeWithCalcResolved(); } | 55 CSSPrimitiveValue::UnitType typeWithCalcResolved() const { return m_value->t
ypeWithCalcResolved(); } |
56 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const | |
57 { | |
58 return m_value->typeWithCalcResolved(); | |
59 } | |
60 void setUnitType(CSSPrimitiveValue::UnitType); | 56 void setUnitType(CSSPrimitiveValue::UnitType); |
61 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } | 57 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } |
62 | 58 |
63 bool operator==(const SVGLength&) const; | 59 bool operator==(const SVGLength&) const; |
64 bool operator!=(const SVGLength& other) const { return !operator==(other); } | 60 bool operator!=(const SVGLength& other) const { return !operator==(other); } |
65 | 61 |
66 float value(const SVGLengthContext&) const; | 62 float value(const SVGLengthContext&) const; |
67 void setValue(float, const SVGLengthContext&); | 63 void setValue(float, const SVGLengthContext&); |
68 | 64 |
69 float valueInSpecifiedUnits() const { return m_value->getFloatValue(); } | 65 float valueInSpecifiedUnits() const { return m_value->getFloatValue(); } |
70 void setValueInSpecifiedUnits(float value) | 66 void setValueInSpecifiedUnits(float value) |
71 { | 67 { |
72 m_value = CSSPrimitiveValue::create(value, m_value->typeWithCalcResolved
()); | 68 m_value = CSSPrimitiveValue::create(value, m_value->typeWithCalcResolved
()); |
73 } | 69 } |
74 | 70 |
| 71 CSSPrimitiveValue* asCSSPrimitiveValue() const { return m_value.get(); } |
| 72 |
75 // Resolves LengthTypePercentage into a normalized floating point number (fu
ll value is 1.0). | 73 // Resolves LengthTypePercentage into a normalized floating point number (fu
ll value is 1.0). |
76 float valueAsPercentage() const; | 74 float valueAsPercentage() const; |
77 | 75 |
78 // Returns a number to be used as percentage (so full value is 100) | 76 // Returns a number to be used as percentage (so full value is 100) |
79 float valueAsPercentage100() const; | 77 float valueAsPercentage100() const; |
80 | 78 |
81 // Scale the input value by this SVGLength. Higher precision than input * va
lueAsPercentage(). | 79 // Scale the input value by this SVGLength. Higher precision than input * va
lueAsPercentage(). |
82 float scaleByPercentage(float) const; | 80 float scaleByPercentage(float) const; |
83 | 81 |
84 String valueAsString() const override; | 82 String valueAsString() const override; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 115 |
118 RefPtrWillBeMember<CSSPrimitiveValue> m_value; | 116 RefPtrWillBeMember<CSSPrimitiveValue> m_value; |
119 unsigned m_unitMode : 2; | 117 unsigned m_unitMode : 2; |
120 }; | 118 }; |
121 | 119 |
122 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); | 120 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); |
123 | 121 |
124 } // namespace blink | 122 } // namespace blink |
125 | 123 |
126 #endif // SVGLength_h | 124 #endif // SVGLength_h |
OLD | NEW |