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 13 matching lines...) Expand all Loading... |
24 #include "core/css/CSSPrimitiveValue.h" | 24 #include "core/css/CSSPrimitiveValue.h" |
25 #include "core/svg/SVGLengthContext.h" | 25 #include "core/svg/SVGLengthContext.h" |
26 #include "core/svg/properties/SVGProperty.h" | 26 #include "core/svg/properties/SVGProperty.h" |
27 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 class ExceptionState; | 31 class ExceptionState; |
32 class QualifiedName; | 32 class QualifiedName; |
33 | 33 |
34 enum SVGLengthNegativeValuesMode { | |
35 AllowNegativeLengths, | |
36 ForbidNegativeLengths | |
37 }; | |
38 | |
39 class SVGLengthTearOff; | 34 class SVGLengthTearOff; |
40 | 35 |
41 class SVGLength final : public SVGPropertyBase { | 36 class SVGLength final : public SVGPropertyBase { |
42 public: | 37 public: |
43 typedef SVGLengthTearOff TearOffType; | 38 typedef SVGLengthTearOff TearOffType; |
44 | 39 |
45 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = SVGLeng
thMode::Other) | 40 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = SVGLeng
thMode::Other) |
46 { | 41 { |
47 return adoptRefWillBeNoop(new SVGLength(mode)); | 42 return adoptRefWillBeNoop(new SVGLength(mode)); |
48 } | 43 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 || unitType == CSSPrimitiveValue::UnitType::Chs; | 92 || unitType == CSSPrimitiveValue::UnitType::Chs; |
98 } | 93 } |
99 inline bool isRelative() const { return isRelativeUnit(m_value->typeWithCalc
Resolved()); } | 94 inline bool isRelative() const { return isRelativeUnit(m_value->typeWithCalc
Resolved()); } |
100 | 95 |
101 bool isZero() const | 96 bool isZero() const |
102 { | 97 { |
103 return m_value->getFloatValue() == 0; | 98 return m_value->getFloatValue() == 0; |
104 } | 99 } |
105 | 100 |
106 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam
e&); | 101 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam
e&); |
| 102 static bool negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie
dName&); |
107 | 103 |
108 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 104 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
109 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; |
110 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt* contextElement) override; | 106 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt* contextElement) override; |
111 | 107 |
112 static AnimatedPropertyType classType() { return AnimatedLength; } | 108 static AnimatedPropertyType classType() { return AnimatedLength; } |
113 | 109 |
114 private: | 110 private: |
115 SVGLength(SVGLengthMode); | 111 SVGLength(SVGLengthMode); |
116 SVGLength(const SVGLength&); | 112 SVGLength(const SVGLength&); |
117 | 113 |
118 RefPtrWillBeMember<CSSPrimitiveValue> m_value; | 114 RefPtrWillBeMember<CSSPrimitiveValue> m_value; |
119 unsigned m_unitMode : 2; | 115 unsigned m_unitMode : 2; |
120 }; | 116 }; |
121 | 117 |
122 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); | 118 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); |
123 | 119 |
124 } // namespace blink | 120 } // namespace blink |
125 | 121 |
126 #endif // SVGLength_h | 122 #endif // SVGLength_h |
OLD | NEW |