| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "core/svg/SVGPointList.h" | 22 #include "core/svg/SVGPointList.h" |
| 23 | 23 |
| 24 #include "core/svg/SVGAnimationElement.h" | 24 #include "core/svg/SVGAnimationElement.h" |
| 25 #include "core/svg/SVGParserUtilities.h" | 25 #include "core/svg/SVGParserUtilities.h" |
| 26 #include "platform/geometry/FloatPoint.h" | 26 #include "platform/geometry/FloatPoint.h" |
| 27 #include "wtf/text/StringBuilder.h" | 27 #include "wtf/text/StringBuilder.h" |
| 28 #include "wtf/text/WTFString.h" | 28 #include "wtf/text/WTFString.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 inline PassRefPtr<SVGPointList> toSVGPointList(PassRefPtr<SVGPropertyBase> passB
ase) | 32 inline PassRefPtrWillBeRawPtr<SVGPointList> toSVGPointList(PassRefPtrWillBeRawPt
r<SVGPropertyBase> passBase) |
| 33 { | 33 { |
| 34 RefPtr<SVGPropertyBase> base = passBase; | 34 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
| 35 ASSERT(base->type() == SVGPointList::classType()); | 35 ASSERT(base->type() == SVGPointList::classType()); |
| 36 return static_pointer_cast<SVGPointList>(base.release()); | 36 return static_pointer_cast<SVGPointList>(base.release()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 SVGPointList::SVGPointList() | 39 SVGPointList::SVGPointList() |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 SVGPointList::~SVGPointList() | 43 SVGPointList::~SVGPointList() |
| 44 { | 44 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const UChar* end = ptr + value.length(); | 113 const UChar* end = ptr + value.length(); |
| 114 valid = parse(ptr, end); | 114 valid = parse(ptr, end); |
| 115 } | 115 } |
| 116 | 116 |
| 117 if (!valid) | 117 if (!valid) |
| 118 exceptionState.throwDOMException(SyntaxError, "Problem parsing points=\"
"+value+"\""); | 118 exceptionState.throwDOMException(SyntaxError, "Problem parsing points=\"
"+value+"\""); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void SVGPointList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement
* contextElement) | 121 void SVGPointList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement
* contextElement) |
| 122 { | 122 { |
| 123 RefPtr<SVGPointList> otherList = toSVGPointList(other); | 123 RefPtrWillBeRawPtr<SVGPointList> otherList = toSVGPointList(other); |
| 124 | 124 |
| 125 if (length() != otherList->length()) | 125 if (length() != otherList->length()) |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 for (size_t i = 0; i < length(); ++i) | 128 for (size_t i = 0; i < length(); ++i) |
| 129 at(i)->setValue(at(i)->value() + otherList->at(i)->value()); | 129 at(i)->setValue(at(i)->value() + otherList->at(i)->value()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void SVGPointList::calculateAnimatedValue(SVGAnimationElement* animationElement,
float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue,
PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurati
onValue, SVGElement* contextElement) | 132 void SVGPointList::calculateAnimatedValue(SVGAnimationElement* animationElement,
float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase>
fromValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRaw
Ptr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextElement) |
| 133 { | 133 { |
| 134 RefPtr<SVGPointList> fromList = toSVGPointList(fromValue); | 134 RefPtrWillBeRawPtr<SVGPointList> fromList = toSVGPointList(fromValue); |
| 135 RefPtr<SVGPointList> toList = toSVGPointList(toValue); | 135 RefPtrWillBeRawPtr<SVGPointList> toList = toSVGPointList(toValue); |
| 136 RefPtr<SVGPointList> toAtEndOfDurationList = toSVGPointList(toAtEndOfDuratio
nValue); | 136 RefPtrWillBeRawPtr<SVGPointList> toAtEndOfDurationList = toSVGPointList(toAt
EndOfDurationValue); |
| 137 | 137 |
| 138 size_t fromPointListSize = fromList->length(); | 138 size_t fromPointListSize = fromList->length(); |
| 139 size_t toPointListSize = toList->length(); | 139 size_t toPointListSize = toList->length(); |
| 140 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length(); | 140 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length(); |
| 141 | 141 |
| 142 if (!adjustFromToListValues(fromList, toList, percentage, animationElement->
animationMode())) | 142 if (!adjustFromToListValues(fromList, toList, percentage, animationElement->
animationMode())) |
| 143 return; | 143 return; |
| 144 | 144 |
| 145 for (size_t i = 0; i < toPointListSize; ++i) { | 145 for (size_t i = 0; i < toPointListSize; ++i) { |
| 146 float animatedX = at(i)->x(); | 146 float animatedX = at(i)->x(); |
| 147 float animatedY = at(i)->y(); | 147 float animatedY = at(i)->y(); |
| 148 | 148 |
| 149 FloatPoint effectiveFrom; | 149 FloatPoint effectiveFrom; |
| 150 if (fromPointListSize) | 150 if (fromPointListSize) |
| 151 effectiveFrom = fromList->at(i)->value(); | 151 effectiveFrom = fromList->at(i)->value(); |
| 152 FloatPoint effectiveTo = toList->at(i)->value(); | 152 FloatPoint effectiveTo = toList->at(i)->value(); |
| 153 FloatPoint effectiveToAtEnd; | 153 FloatPoint effectiveToAtEnd; |
| 154 if (i < toAtEndOfDurationListSize) | 154 if (i < toAtEndOfDurationListSize) |
| 155 effectiveToAtEnd = toAtEndOfDurationList->at(i)->value(); | 155 effectiveToAtEnd = toAtEndOfDurationList->at(i)->value(); |
| 156 | 156 |
| 157 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti
veFrom.x(), effectiveTo.x(), effectiveToAtEnd.x(), animatedX); | 157 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti
veFrom.x(), effectiveTo.x(), effectiveToAtEnd.x(), animatedX); |
| 158 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti
veFrom.y(), effectiveTo.y(), effectiveToAtEnd.y(), animatedY); | 158 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti
veFrom.y(), effectiveTo.y(), effectiveToAtEnd.y(), animatedY); |
| 159 at(i)->setValue(FloatPoint(animatedX, animatedY)); | 159 at(i)->setValue(FloatPoint(animatedX, animatedY)); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 float SVGPointList::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement
*) | 163 float SVGPointList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to
, SVGElement*) |
| 164 { | 164 { |
| 165 // FIXME: Distance calculation is not possible for SVGPointList right now. W
e need the distance for every single value. | 165 // FIXME: Distance calculation is not possible for SVGPointList right now. W
e need the distance for every single value. |
| 166 return -1; | 166 return -1; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } | 169 } |
| OLD | NEW |