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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SVGLength_h | 21 #ifndef SVGLength_h |
22 #define SVGLength_h | 22 #define SVGLength_h |
23 | 23 |
| 24 #include "core/css/CSSPrimitiveValue.h" |
24 #include "core/svg/SVGLengthContext.h" | 25 #include "core/svg/SVGLengthContext.h" |
25 #include "core/svg/properties/SVGProperty.h" | 26 #include "core/svg/properties/SVGProperty.h" |
26 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
27 | 28 |
28 namespace blink { | 29 namespace blink { |
29 | 30 |
30 class CSSPrimitiveValue; | |
31 class ExceptionState; | 31 class ExceptionState; |
32 class QualifiedName; | 32 class QualifiedName; |
33 | 33 |
34 enum SVGLengthNegativeValuesMode { | 34 enum SVGLengthNegativeValuesMode { |
35 AllowNegativeLengths, | 35 AllowNegativeLengths, |
36 ForbidNegativeLengths | 36 ForbidNegativeLengths |
37 }; | 37 }; |
38 | 38 |
39 class SVGLengthTearOff; | 39 class SVGLengthTearOff; |
40 | 40 |
41 class SVGLength final : public SVGPropertyBase { | 41 class SVGLength final : public SVGPropertyBase { |
42 public: | 42 public: |
43 typedef SVGLengthTearOff TearOffType; | 43 typedef SVGLengthTearOff TearOffType; |
44 | 44 |
45 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = LengthM
odeOther) | 45 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = LengthM
odeOther) |
46 { | 46 { |
47 return adoptRefWillBeNoop(new SVGLength(mode)); | 47 return adoptRefWillBeNoop(new SVGLength(mode)); |
48 } | 48 } |
49 | 49 |
50 PassRefPtrWillBeRawPtr<SVGLength> clone() const; | 50 PassRefPtrWillBeRawPtr<SVGLength> clone() const; |
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 |
| 55 { |
| 56 if (m_unitType == LengthTypeNumber) |
| 57 return CSSPrimitiveValue::UnitType::CSS_PX; |
| 58 return static_cast<CSSPrimitiveValue::UnitType>(m_unitType); |
| 59 } |
54 void setUnitType(SVGLengthType); | 60 void setUnitType(SVGLengthType); |
55 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } | 61 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod
e); } |
56 | 62 |
57 bool operator==(const SVGLength&) const; | 63 bool operator==(const SVGLength&) const; |
58 bool operator!=(const SVGLength& other) const { return !operator==(other); } | 64 bool operator!=(const SVGLength& other) const { return !operator==(other); } |
59 | 65 |
60 float value(const SVGLengthContext&) const; | 66 float value(const SVGLengthContext&) const; |
61 void setValue(float, const SVGLengthContext&); | 67 void setValue(float, const SVGLengthContext&); |
62 | 68 |
63 float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; } | 69 float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) | 122 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) |
117 { | 123 { |
118 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; | 124 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
119 ASSERT(base->type() == SVGLength::classType()); | 125 ASSERT(base->type() == SVGLength::classType()); |
120 return static_pointer_cast<SVGLength>(base.release()); | 126 return static_pointer_cast<SVGLength>(base.release()); |
121 } | 127 } |
122 | 128 |
123 } // namespace blink | 129 } // namespace blink |
124 | 130 |
125 #endif // SVGLength_h | 131 #endif // SVGLength_h |
OLD | NEW |