Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Side by Side Diff: Source/core/svg/SVGLength.h

Issue 1212253012: Fix virtual/override/final usage in Source/core/svg/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 30 matching lines...) Expand all
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 = SVGLeng thMode::Other) 45 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = SVGLeng thMode::Other)
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 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con st 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 54 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const
55 { 55 {
56 if (m_unitType == LengthTypeNumber) 56 if (m_unitType == LengthTypeNumber)
57 return CSSPrimitiveValue::UnitType::CSS_PX; 57 return CSSPrimitiveValue::UnitType::CSS_PX;
58 58
59 if (m_unitType == LengthTypeREMS) 59 if (m_unitType == LengthTypeREMS)
60 return CSSPrimitiveValue::UnitType::CSS_REMS; 60 return CSSPrimitiveValue::UnitType::CSS_REMS;
61 if (m_unitType == LengthTypeCHS) 61 if (m_unitType == LengthTypeCHS)
(...skipping 15 matching lines...) Expand all
77 77
78 // Resolves LengthTypePercentage into a normalized floating point number (fu ll value is 1.0). 78 // Resolves LengthTypePercentage into a normalized floating point number (fu ll value is 1.0).
79 float valueAsPercentage() const; 79 float valueAsPercentage() const;
80 80
81 // Returns a number to be used as percentage (so full value is 100) 81 // Returns a number to be used as percentage (so full value is 100)
82 float valueAsPercentage100() const; 82 float valueAsPercentage100() const;
83 83
84 // Scale the input value by this SVGLength. Higher precision than input * va lueAsPercentage(). 84 // Scale the input value by this SVGLength. Higher precision than input * va lueAsPercentage().
85 float scaleByPercentage(float) const; 85 float scaleByPercentage(float) const;
86 86
87 virtual String valueAsString() const override; 87 String valueAsString() const override;
88 void setValueAsString(const String&, ExceptionState&); 88 void setValueAsString(const String&, ExceptionState&);
89 89
90 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits); 90 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits);
91 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&); 91 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&);
92 92
93 // Helper functions 93 // Helper functions
94 static inline bool isRelativeUnit(SVGLengthType unitType) 94 static inline bool isRelativeUnit(SVGLengthType unitType)
95 { 95 {
96 return unitType == LengthTypePercentage 96 return unitType == LengthTypePercentage
97 || unitType == LengthTypeEMS 97 || unitType == LengthTypeEMS
98 || unitType == LengthTypeEXS 98 || unitType == LengthTypeEXS
99 || unitType == LengthTypeREMS 99 || unitType == LengthTypeREMS
100 || unitType == LengthTypeCHS; 100 || unitType == LengthTypeCHS;
101 } 101 }
102 inline bool isRelative() const { return isRelativeUnit(unitType()); } 102 inline bool isRelative() const { return isRelativeUnit(unitType()); }
103 103
104 bool isZero() const 104 bool isZero() const
105 { 105 {
106 return !m_valueInSpecifiedUnits; 106 return !m_valueInSpecifiedUnits;
107 } 107 }
108 108
109 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV alue*); 109 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV alue*);
110 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef PtrWillBeRawPtr<SVGLength>); 110 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef PtrWillBeRawPtr<SVGLength>);
111 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam e&); 111 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedNam e&);
112 112
113 PassRefPtrWillBeRawPtr<SVGLength> blend(PassRefPtrWillBeRawPtr<SVGLength> fr om, float progress) const; 113 PassRefPtrWillBeRawPtr<SVGLength> blend(PassRefPtrWillBeRawPtr<SVGLength> fr om, float progress) const;
114 114
115 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr ide; 115 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override;
116 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO fDurationValue, SVGElement* contextElement) override; 116 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio nValue, SVGElement* contextElement) override;
117 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement* contextElement) override; 117 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt* contextElement) override;
118 118
119 static AnimatedPropertyType classType() { return AnimatedLength; } 119 static AnimatedPropertyType classType() { return AnimatedLength; }
120 120
121 private: 121 private:
122 SVGLength(SVGLengthMode); 122 SVGLength(SVGLengthMode);
123 SVGLength(const SVGLength&); 123 SVGLength(const SVGLength&);
124 124
125 float m_valueInSpecifiedUnits; 125 float m_valueInSpecifiedUnits;
126 unsigned m_unitMode : 2; 126 unsigned m_unitMode : 2;
127 unsigned m_unitType : 4; 127 unsigned m_unitType : 4;
128 }; 128 };
129 129
130 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP ropertyBase> passBase) 130 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP ropertyBase> passBase)
131 { 131 {
132 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; 132 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase;
133 ASSERT(base->type() == SVGLength::classType()); 133 ASSERT(base->type() == SVGLength::classType());
134 return static_pointer_cast<SVGLength>(base.release()); 134 return static_pointer_cast<SVGLength>(base.release());
135 } 135 }
136 136
137 } // namespace blink 137 } // namespace blink
138 138
139 #endif // SVGLength_h 139 #endif // SVGLength_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698