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 26 matching lines...) Expand all Loading... | |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class SVGNumberTearOff; | 39 class SVGNumberTearOff; |
40 | 40 |
41 class SVGNumber : public SVGPropertyHelper<SVGNumber> { | 41 class SVGNumber : public SVGPropertyHelper<SVGNumber> { |
42 public: | 42 public: |
43 // SVGNumber has a tear-off type, but SVGAnimatedNumber uses primitive type. | 43 // SVGNumber has a tear-off type, but SVGAnimatedNumber uses primitive type. |
44 typedef SVGNumberTearOff TearOffType; | 44 typedef SVGNumberTearOff TearOffType; |
45 typedef float PrimitiveType; | 45 typedef float PrimitiveType; |
46 | 46 |
47 static PassRefPtr<SVGNumber> create(float value = 0.0f) | 47 static PassRefPtrWillBeRawPtr<SVGNumber> create(float value = 0.0f) |
48 { | 48 { |
49 return adoptRef(new SVGNumber(value)); | 49 return adoptRefWillBeNoop(new SVGNumber(value)); |
50 } | 50 } |
51 | 51 |
52 virtual PassRefPtr<SVGNumber> clone() const; | 52 virtual PassRefPtrWillBeRawPtr<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, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO fDurationValue, SVGElement* contextElement) override; |
62 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement* contextElement) override; | 62 virtual float calculateDistance(PassRefPtrWillBeRawPtr<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 PassRefPtrWillBeRawPtr<SVGNumber> toSVGNumber(PassRefPtrWillBeRawPtr<SVGP ropertyBase> passBase) |
76 { | 76 { |
77 RefPtr<SVGPropertyBase> base = passBase; | 77 RefPtrWillBeRawPtr<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 PassRefPtrWillBeRawPtr<SVGNumberAcceptPercentage> create(float value = 0) |
89 { | 89 { |
90 return adoptRef(new SVGNumberAcceptPercentage(value)); | 90 return adoptRefWillBeNoop(new SVGNumberAcceptPercentage(value)); |
91 } | 91 } |
92 | 92 |
93 virtual PassRefPtr<SVGNumber> clone() const override; | 93 virtual PassRefPtrWillBeRawPtr<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); |
haraken
2014/11/11 05:22:46
Add explicit.
sof
2014/11/12 13:45:08
Done.
| |
98 }; | 98 }; |
99 | 99 |
100 } // namespace blink | 100 } // namespace blink |
101 | 101 |
102 #endif // SVGNumber_h | 102 #endif // SVGNumber_h |
OLD | NEW |