| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/svg/SVGAnimationElement.h" | 33 #include "core/svg/SVGAnimationElement.h" |
| 34 #include "core/svg/SVGParserUtilities.h" | 34 #include "core/svg/SVGParserUtilities.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 SVGNumber::SVGNumber(float value) | 38 SVGNumber::SVGNumber(float value) |
| 39 : m_value(value) | 39 : m_value(value) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 PassRefPtrWillBeRawPtr<SVGNumber> SVGNumber::clone() const | 43 RawPtr<SVGNumber> SVGNumber::clone() const |
| 44 { | 44 { |
| 45 return create(m_value); | 45 return create(m_value); |
| 46 } | 46 } |
| 47 | 47 |
| 48 String SVGNumber::valueAsString() const | 48 String SVGNumber::valueAsString() const |
| 49 { | 49 { |
| 50 return String::number(m_value); | 50 return String::number(m_value); |
| 51 } | 51 } |
| 52 | 52 |
| 53 template<typename CharType> | 53 template<typename CharType> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 if (string.is8Bit()) { | 73 if (string.is8Bit()) { |
| 74 const LChar* ptr = string.characters8(); | 74 const LChar* ptr = string.characters8(); |
| 75 const LChar* end = ptr + string.length(); | 75 const LChar* end = ptr + string.length(); |
| 76 return parse(ptr, end); | 76 return parse(ptr, end); |
| 77 } | 77 } |
| 78 const UChar* ptr = string.characters16(); | 78 const UChar* ptr = string.characters16(); |
| 79 const UChar* end = ptr + string.length(); | 79 const UChar* end = ptr + string.length(); |
| 80 return parse(ptr, end); | 80 return parse(ptr, end); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SVGNumber::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) | 83 void SVGNumber::add(RawPtr<SVGPropertyBase> other, SVGElement*) |
| 84 { | 84 { |
| 85 setValue(m_value + toSVGNumber(other)->value()); | 85 setValue(m_value + toSVGNumber(other)->value()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl
oat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fr
om, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGProper
tyBase> toAtEndOfDuration, SVGElement*) | 88 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl
oat percentage, unsigned repeatCount, RawPtr<SVGPropertyBase> from, RawPtr<SVGPr
opertyBase> to, RawPtr<SVGPropertyBase> toAtEndOfDuration, SVGElement*) |
| 89 { | 89 { |
| 90 ASSERT(animationElement); | 90 ASSERT(animationElement); |
| 91 | 91 |
| 92 RefPtrWillBeRawPtr<SVGNumber> fromNumber = toSVGNumber(from); | 92 RawPtr<SVGNumber> fromNumber = toSVGNumber(from); |
| 93 RefPtrWillBeRawPtr<SVGNumber> toNumber = toSVGNumber(to); | 93 RawPtr<SVGNumber> toNumber = toSVGNumber(to); |
| 94 RefPtrWillBeRawPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndO
fDuration); | 94 RawPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndOfDuration); |
| 95 | 95 |
| 96 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber-
>value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value); | 96 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber-
>value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value); |
| 97 } | 97 } |
| 98 | 98 |
| 99 float SVGNumber::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> other
, SVGElement*) | 99 float SVGNumber::calculateDistance(RawPtr<SVGPropertyBase> other, SVGElement*) |
| 100 { | 100 { |
| 101 return fabsf(m_value - toSVGNumber(other)->value()); | 101 return fabsf(m_value - toSVGNumber(other)->value()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 PassRefPtrWillBeRawPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const | 104 RawPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const |
| 105 { | 105 { |
| 106 return create(m_value); | 106 return create(m_value); |
| 107 } | 107 } |
| 108 | 108 |
| 109 template<typename CharType> | 109 template<typename CharType> |
| 110 static SVGParsingError parseNumberOrPercentage(const CharType*& ptr, const CharT
ype* end, float& number) | 110 static SVGParsingError parseNumberOrPercentage(const CharType*& ptr, const CharT
ype* end, float& number) |
| 111 { | 111 { |
| 112 const CharType* start = ptr; | 112 const CharType* start = ptr; |
| 113 if (!parseNumber(ptr, end, number, AllowLeadingWhitespace)) | 113 if (!parseNumber(ptr, end, number, AllowLeadingWhitespace)) |
| 114 return SVGParsingError(SVGParseStatus::ExpectedNumberOrPercentage, ptr -
start); | 114 return SVGParsingError(SVGParseStatus::ExpectedNumberOrPercentage, ptr -
start); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 143 m_value = number; | 143 m_value = number; |
| 144 return error; | 144 return error; |
| 145 } | 145 } |
| 146 | 146 |
| 147 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value) | 147 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value) |
| 148 : SVGNumber(value) | 148 : SVGNumber(value) |
| 149 { | 149 { |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |