OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 static PassRefPtr<SVGNumber> create(float value = 0.0f) | 47 static PassRefPtr<SVGNumber> create(float value = 0.0f) |
48 { | 48 { |
49 return adoptRef(new SVGNumber(value)); | 49 return adoptRef(new SVGNumber(value)); |
50 } | 50 } |
51 | 51 |
52 virtual PassRefPtr<SVGNumber> clone() const; | 52 virtual PassRefPtr<SVGNumber> clone() const; |
53 | 53 |
54 float value() const { return m_value; } | 54 float value() const { return m_value; } |
55 void setValue(float value) { m_value = value; } | 55 void setValue(float value) { m_value = value; } |
56 | 56 |
57 virtual String valueAsString() const OVERRIDE; | 57 virtual String valueAsString() const override; |
58 virtual void setValueAsString(const String&, ExceptionState&); | 58 virtual void setValueAsString(const String&, ExceptionState&); |
59 | 59 |
60 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) OVERR
IDE; | 60 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; |
61 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextE
lement) OVERRIDE; | 61 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextE
lement) override; |
62 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*
contextElement) OVERRIDE; | 62 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*
contextElement) override; |
63 | 63 |
64 static AnimatedPropertyType classType() { return AnimatedNumber; } | 64 static AnimatedPropertyType classType() { return AnimatedNumber; } |
65 | 65 |
66 protected: | 66 protected: |
67 explicit SVGNumber(float); | 67 explicit SVGNumber(float); |
68 | 68 |
69 template<typename CharType> | 69 template<typename CharType> |
70 bool parse(const CharType*& ptr, const CharType* end); | 70 bool parse(const CharType*& ptr, const CharType* end); |
71 | 71 |
72 float m_value; | 72 float m_value; |
73 }; | 73 }; |
74 | 74 |
75 inline PassRefPtr<SVGNumber> toSVGNumber(PassRefPtr<SVGPropertyBase> passBase) | 75 inline PassRefPtr<SVGNumber> toSVGNumber(PassRefPtr<SVGPropertyBase> passBase) |
76 { | 76 { |
77 RefPtr<SVGPropertyBase> base = passBase; | 77 RefPtr<SVGPropertyBase> base = passBase; |
78 ASSERT(base->type() == SVGNumber::classType()); | 78 ASSERT(base->type() == SVGNumber::classType()); |
79 return static_pointer_cast<SVGNumber>(base.release()); | 79 return static_pointer_cast<SVGNumber>(base.release()); |
80 } | 80 } |
81 | 81 |
82 // SVGNumber which also accepts percentage as its value. | 82 // SVGNumber which also accepts percentage as its value. |
83 // This is used for <stop> "offset" | 83 // This is used for <stop> "offset" |
84 // Spec: http://www.w3.org/TR/SVG11/pservers.html#GradientStops | 84 // Spec: http://www.w3.org/TR/SVG11/pservers.html#GradientStops |
85 // offset = "<number> | <percentage>" | 85 // offset = "<number> | <percentage>" |
86 class SVGNumberAcceptPercentage FINAL : public SVGNumber { | 86 class SVGNumberAcceptPercentage final : public SVGNumber { |
87 public: | 87 public: |
88 static PassRefPtr<SVGNumberAcceptPercentage> create(float value = 0) | 88 static PassRefPtr<SVGNumberAcceptPercentage> create(float value = 0) |
89 { | 89 { |
90 return adoptRef(new SVGNumberAcceptPercentage(value)); | 90 return adoptRef(new SVGNumberAcceptPercentage(value)); |
91 } | 91 } |
92 | 92 |
93 virtual PassRefPtr<SVGNumber> clone() const OVERRIDE; | 93 virtual PassRefPtr<SVGNumber> clone() const override; |
94 virtual void setValueAsString(const String&, ExceptionState&) OVERRIDE; | 94 virtual void setValueAsString(const String&, ExceptionState&) override; |
95 | 95 |
96 private: | 96 private: |
97 SVGNumberAcceptPercentage(float value); | 97 SVGNumberAcceptPercentage(float value); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace blink | 100 } // namespace blink |
101 | 101 |
102 #endif // SVGNumber_h | 102 #endif // SVGNumber_h |
OLD | NEW |