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 23 matching lines...) Expand all Loading... |
34 #include "core/svg/SVGAnimationElement.h" | 34 #include "core/svg/SVGAnimationElement.h" |
35 #include "core/svg/SVGParserUtilities.h" | 35 #include "core/svg/SVGParserUtilities.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 SVGNumber::SVGNumber(float value) | 39 SVGNumber::SVGNumber(float value) |
40 : m_value(value) | 40 : m_value(value) |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 PassRefPtr<SVGNumber> SVGNumber::clone() const | 44 PassRefPtrWillBeRawPtr<SVGNumber> SVGNumber::clone() const |
45 { | 45 { |
46 return create(m_value); | 46 return create(m_value); |
47 } | 47 } |
48 | 48 |
49 String SVGNumber::valueAsString() const | 49 String SVGNumber::valueAsString() const |
50 { | 50 { |
51 return String::number(m_value); | 51 return String::number(m_value); |
52 } | 52 } |
53 | 53 |
54 template<typename CharType> | 54 template<typename CharType> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
string + "') is invalid."); | 89 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
string + "') is invalid."); |
90 m_value = 0; | 90 m_value = 0; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 void SVGNumber::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) | 94 void SVGNumber::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) |
95 { | 95 { |
96 setValue(m_value + toSVGNumber(other)->value()); | 96 setValue(m_value + toSVGNumber(other)->value()); |
97 } | 97 } |
98 | 98 |
99 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl
oat percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefP
tr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDuration, SVGElemen
t*) | 99 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl
oat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fr
om, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGProper
tyBase> toAtEndOfDuration, SVGElement*) |
100 { | 100 { |
101 ASSERT(animationElement); | 101 ASSERT(animationElement); |
102 | 102 |
103 RefPtr<SVGNumber> fromNumber = toSVGNumber(from); | 103 RefPtrWillBeRawPtr<SVGNumber> fromNumber = toSVGNumber(from); |
104 RefPtr<SVGNumber> toNumber = toSVGNumber(to); | 104 RefPtrWillBeRawPtr<SVGNumber> toNumber = toSVGNumber(to); |
105 RefPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndOfDuration); | 105 RefPtrWillBeRawPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndO
fDuration); |
106 | 106 |
107 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber-
>value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value); | 107 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber-
>value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value); |
108 } | 108 } |
109 | 109 |
110 float SVGNumber::calculateDistance(PassRefPtr<SVGPropertyBase> other, SVGElement
*) | 110 float SVGNumber::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> other
, SVGElement*) |
111 { | 111 { |
112 return fabsf(m_value - toSVGNumber(other)->value()); | 112 return fabsf(m_value - toSVGNumber(other)->value()); |
113 } | 113 } |
114 | 114 |
115 PassRefPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const | 115 PassRefPtrWillBeRawPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const |
116 { | 116 { |
117 return create(m_value); | 117 return create(m_value); |
118 } | 118 } |
119 | 119 |
120 void SVGNumberAcceptPercentage::setValueAsString(const String& string, Exception
State& exceptionState) | 120 void SVGNumberAcceptPercentage::setValueAsString(const String& string, Exception
State& exceptionState) |
121 { | 121 { |
122 bool valid = parseNumberOrPercentage(string, m_value); | 122 bool valid = parseNumberOrPercentage(string, m_value); |
123 | 123 |
124 if (!valid) { | 124 if (!valid) { |
125 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
string + "') is invalid."); | 125 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
string + "') is invalid."); |
126 m_value = 0; | 126 m_value = 0; |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value) | 130 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value) |
131 : SVGNumber(value) | 131 : SVGNumber(value) |
132 { | 132 { |
133 } | 133 } |
134 | 134 |
135 } | 135 } |
OLD | NEW |