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 | 47 |
48 String SVGInteger::valueAsString() const | 48 String SVGInteger::valueAsString() const |
49 { | 49 { |
50 return String::number(m_value); | 50 return String::number(m_value); |
51 } | 51 } |
52 | 52 |
53 SVGParsingError SVGInteger::setValueAsString(const String& string) | 53 SVGParsingError SVGInteger::setValueAsString(const String& string) |
54 { | 54 { |
55 if (string.isEmpty()) { | 55 if (string.isEmpty()) { |
56 m_value = 0; | 56 m_value = 0; |
57 return NoError; | 57 return SVGStatus::NoError; |
58 } | 58 } |
59 | 59 |
60 bool valid = true; | 60 bool valid = true; |
61 m_value = stripLeadingAndTrailingHTMLSpaces(string).toIntStrict(&valid); | 61 m_value = stripLeadingAndTrailingHTMLSpaces(string).toIntStrict(&valid); |
62 | 62 |
63 if (!valid) { | 63 if (!valid) { |
64 m_value = 0; | 64 m_value = 0; |
65 return ParsingAttributeFailedError; | 65 return SVGStatus::ParsingFailed; |
66 } | 66 } |
67 return NoError; | 67 return SVGStatus::NoError; |
68 } | 68 } |
69 | 69 |
70 void SVGInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) | 70 void SVGInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) |
71 { | 71 { |
72 setValue(m_value + toSVGInteger(other)->value()); | 72 setValue(m_value + toSVGInteger(other)->value()); |
73 } | 73 } |
74 | 74 |
75 void SVGInteger::calculateAnimatedValue(SVGAnimationElement* animationElement, f
loat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> f
rom, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPrope
rtyBase> toAtEndOfDuration, SVGElement*) | 75 void SVGInteger::calculateAnimatedValue(SVGAnimationElement* animationElement, f
loat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> f
rom, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPrope
rtyBase> toAtEndOfDuration, SVGElement*) |
76 { | 76 { |
77 ASSERT(animationElement); | 77 ASSERT(animationElement); |
78 | 78 |
79 RefPtrWillBeRawPtr<SVGInteger> fromInteger = toSVGInteger(from); | 79 RefPtrWillBeRawPtr<SVGInteger> fromInteger = toSVGInteger(from); |
80 RefPtrWillBeRawPtr<SVGInteger> toInteger = toSVGInteger(to); | 80 RefPtrWillBeRawPtr<SVGInteger> toInteger = toSVGInteger(to); |
81 RefPtrWillBeRawPtr<SVGInteger> toAtEndOfDurationInteger = toSVGInteger(toAtE
ndOfDuration); | 81 RefPtrWillBeRawPtr<SVGInteger> toAtEndOfDurationInteger = toSVGInteger(toAtE
ndOfDuration); |
82 | 82 |
83 float animatedFloat = m_value; | 83 float animatedFloat = m_value; |
84 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger
->value(), toInteger->value(), toAtEndOfDurationInteger->value(), animatedFloat)
; | 84 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger
->value(), toInteger->value(), toAtEndOfDurationInteger->value(), animatedFloat)
; |
85 m_value = static_cast<int>(roundf(animatedFloat)); | 85 m_value = static_cast<int>(roundf(animatedFloat)); |
86 } | 86 } |
87 | 87 |
88 float SVGInteger::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> othe
r, SVGElement*) | 88 float SVGInteger::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> othe
r, SVGElement*) |
89 { | 89 { |
90 return abs(m_value - toSVGInteger(other)->value()); | 90 return abs(m_value - toSVGInteger(other)->value()); |
91 } | 91 } |
92 | 92 |
93 } | 93 } |
OLD | NEW |