Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: Source/core/svg/SVGPointList.cpp

Issue 208133002: [SVG] Remove "New" prefix from properties implementation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGPointList.h ('k') | Source/core/svg/SVGPointListTearOff.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 WebCore { 30 namespace WebCore {
31 31
32 inline PassRefPtr<SVGPointList> toSVGPointList(PassRefPtr<NewSVGPropertyBase> pa ssBase) 32 inline PassRefPtr<SVGPointList> toSVGPointList(PassRefPtr<SVGPropertyBase> passB ase)
33 { 33 {
34 RefPtr<NewSVGPropertyBase> base = passBase; 34 RefPtr<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 {
45 } 45 }
46 46
47 PassRefPtr<SVGPointList> SVGPointList::clone() 47 PassRefPtr<SVGPointList> SVGPointList::clone()
48 { 48 {
49 RefPtr<SVGPointList> svgPointList = SVGPointList::create(); 49 RefPtr<SVGPointList> svgPointList = SVGPointList::create();
50 svgPointList->deepCopy(this); 50 svgPointList->deepCopy(this);
51 return svgPointList.release(); 51 return svgPointList.release();
52 } 52 }
53 53
54 PassRefPtr<NewSVGPropertyBase> SVGPointList::cloneForAnimation(const String& val ue) const 54 PassRefPtr<SVGPropertyBase> SVGPointList::cloneForAnimation(const String& value) const
55 { 55 {
56 RefPtr<SVGPointList> svgPointList = SVGPointList::create(); 56 RefPtr<SVGPointList> svgPointList = SVGPointList::create();
57 svgPointList->setValueAsString(value, IGNORE_EXCEPTION); 57 svgPointList->setValueAsString(value, IGNORE_EXCEPTION);
58 return svgPointList.release(); 58 return svgPointList.release();
59 } 59 }
60 60
61 String SVGPointList::valueAsString() const 61 String SVGPointList::valueAsString() const
62 { 62 {
63 StringBuilder builder; 63 StringBuilder builder;
64 64
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } else { 125 } else {
126 const UChar* ptr = value.characters16(); 126 const UChar* ptr = value.characters16();
127 const UChar* end = ptr + value.length(); 127 const UChar* end = ptr + value.length();
128 valid = parse(ptr, end); 128 valid = parse(ptr, end);
129 } 129 }
130 130
131 if (!valid) 131 if (!valid)
132 exceptionState.throwDOMException(SyntaxError, "Problem parsing points=\" "+value+"\""); 132 exceptionState.throwDOMException(SyntaxError, "Problem parsing points=\" "+value+"\"");
133 } 133 }
134 134
135 void SVGPointList::add(PassRefPtr<NewSVGPropertyBase> other, SVGElement* context Element) 135 void SVGPointList::add(PassRefPtr<SVGPropertyBase> other, SVGElement* contextEle ment)
136 { 136 {
137 RefPtr<SVGPointList> otherList = toSVGPointList(other); 137 RefPtr<SVGPointList> otherList = toSVGPointList(other);
138 138
139 if (length() != otherList->length()) 139 if (length() != otherList->length())
140 return; 140 return;
141 141
142 for (size_t i = 0; i < length(); ++i) 142 for (size_t i = 0; i < length(); ++i)
143 at(i)->setValue(at(i)->value() + otherList->at(i)->value()); 143 at(i)->setValue(at(i)->value() + otherList->at(i)->value());
144 } 144 }
145 145
(...skipping 23 matching lines...) Expand all
169 ASSERT(!fromListSize || fromListSize == toListSize); 169 ASSERT(!fromListSize || fromListSize == toListSize);
170 if (resizeAnimatedListIfNeeded && length() < toListSize) { 170 if (resizeAnimatedListIfNeeded && length() < toListSize) {
171 size_t paddingCount = toListSize - length(); 171 size_t paddingCount = toListSize - length();
172 for (size_t i = 0; i < paddingCount; ++i) 172 for (size_t i = 0; i < paddingCount; ++i)
173 append(SVGPoint::create()); 173 append(SVGPoint::create());
174 } 174 }
175 175
176 return true; 176 return true;
177 } 177 }
178 178
179 void SVGPointList::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValu e, PassRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEn dOfDurationValue, SVGElement* contextElement) 179 void SVGPointList::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurati onValue, SVGElement* contextElement)
180 { 180 {
181 RefPtr<SVGPointList> fromList = toSVGPointList(fromValue); 181 RefPtr<SVGPointList> fromList = toSVGPointList(fromValue);
182 RefPtr<SVGPointList> toList = toSVGPointList(toValue); 182 RefPtr<SVGPointList> toList = toSVGPointList(toValue);
183 RefPtr<SVGPointList> toAtEndOfDurationList = toSVGPointList(toAtEndOfDuratio nValue); 183 RefPtr<SVGPointList> toAtEndOfDurationList = toSVGPointList(toAtEndOfDuratio nValue);
184 184
185 size_t fromPointListSize = fromList->length(); 185 size_t fromPointListSize = fromList->length();
186 size_t toPointListSize = toList->length(); 186 size_t toPointListSize = toList->length();
187 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length(); 187 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length();
188 188
189 if (!adjustFromToListValues(fromList, toList, percentage, animationElement-> animationMode() == ToAnimation, true)) 189 if (!adjustFromToListValues(fromList, toList, percentage, animationElement-> animationMode() == ToAnimation, true))
(...skipping 10 matching lines...) Expand all
200 FloatPoint effectiveToAtEnd; 200 FloatPoint effectiveToAtEnd;
201 if (i < toAtEndOfDurationListSize) 201 if (i < toAtEndOfDurationListSize)
202 effectiveToAtEnd = toAtEndOfDurationList->at(i)->value(); 202 effectiveToAtEnd = toAtEndOfDurationList->at(i)->value();
203 203
204 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom.x(), effectiveTo.x(), effectiveToAtEnd.x(), animatedX); 204 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom.x(), effectiveTo.x(), effectiveToAtEnd.x(), animatedX);
205 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom.y(), effectiveTo.y(), effectiveToAtEnd.y(), animatedY); 205 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom.y(), effectiveTo.y(), effectiveToAtEnd.y(), animatedY);
206 at(i)->setValue(FloatPoint(animatedX, animatedY)); 206 at(i)->setValue(FloatPoint(animatedX, animatedY));
207 } 207 }
208 } 208 }
209 209
210 float SVGPointList::calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElem ent*) 210 float SVGPointList::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement *)
211 { 211 {
212 // FIXME: Distance calculation is not possible for SVGPointList right now. W e need the distance for every single value. 212 // FIXME: Distance calculation is not possible for SVGPointList right now. W e need the distance for every single value.
213 return -1; 213 return -1;
214 } 214 }
215 215
216 } 216 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPointList.h ('k') | Source/core/svg/SVGPointListTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698