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

Side by Side Diff: Source/core/svg/SVGLengthList.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/SVGLengthList.h ('k') | Source/core/svg/SVGLengthListTearOff.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, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 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 10 matching lines...) Expand all
21 #include "config.h" 21 #include "config.h"
22 #include "core/svg/SVGLengthList.h" 22 #include "core/svg/SVGLengthList.h"
23 23
24 #include "bindings/v8/ExceptionStatePlaceholder.h" 24 #include "bindings/v8/ExceptionStatePlaceholder.h"
25 #include "core/svg/SVGAnimationElement.h" 25 #include "core/svg/SVGAnimationElement.h"
26 #include "core/svg/SVGParserUtilities.h" 26 #include "core/svg/SVGParserUtilities.h"
27 #include "wtf/text/StringBuilder.h" 27 #include "wtf/text/StringBuilder.h"
28 28
29 namespace WebCore { 29 namespace WebCore {
30 30
31 inline PassRefPtr<SVGLengthList> toSVGLengthList(PassRefPtr<NewSVGPropertyBase> passBase) 31 inline PassRefPtr<SVGLengthList> toSVGLengthList(PassRefPtr<SVGPropertyBase> pas sBase)
32 { 32 {
33 RefPtr<NewSVGPropertyBase> base = passBase; 33 RefPtr<SVGPropertyBase> base = passBase;
34 ASSERT(base->type() == SVGLengthList::classType()); 34 ASSERT(base->type() == SVGLengthList::classType());
35 return static_pointer_cast<SVGLengthList>(base.release()); 35 return static_pointer_cast<SVGLengthList>(base.release());
36 } 36 }
37 37
38 SVGLengthList::SVGLengthList(SVGLengthMode mode) 38 SVGLengthList::SVGLengthList(SVGLengthMode mode)
39 : m_mode(mode) 39 : m_mode(mode)
40 { 40 {
41 } 41 }
42 42
43 SVGLengthList::~SVGLengthList() 43 SVGLengthList::~SVGLengthList()
44 { 44 {
45 } 45 }
46 46
47 PassRefPtr<SVGLengthList> SVGLengthList::clone() 47 PassRefPtr<SVGLengthList> SVGLengthList::clone()
48 { 48 {
49 RefPtr<SVGLengthList> ret = SVGLengthList::create(m_mode); 49 RefPtr<SVGLengthList> ret = SVGLengthList::create(m_mode);
50 ret->deepCopy(this); 50 ret->deepCopy(this);
51 return ret.release(); 51 return ret.release();
52 } 52 }
53 53
54 PassRefPtr<NewSVGPropertyBase> SVGLengthList::cloneForAnimation(const String& va lue) const 54 PassRefPtr<SVGPropertyBase> SVGLengthList::cloneForAnimation(const String& value ) const
55 { 55 {
56 RefPtr<SVGLengthList> ret = SVGLengthList::create(m_mode); 56 RefPtr<SVGLengthList> ret = SVGLengthList::create(m_mode);
57 ret->setValueAsString(value, IGNORE_EXCEPTION); 57 ret->setValueAsString(value, IGNORE_EXCEPTION);
58 return ret.release(); 58 return ret.release();
59 } 59 }
60 60
61 String SVGLengthList::valueAsString() const 61 String SVGLengthList::valueAsString() const
62 { 62 {
63 StringBuilder builder; 63 StringBuilder builder;
64 64
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const LChar* ptr = value.characters8(); 108 const LChar* ptr = value.characters8();
109 const LChar* end = ptr + value.length(); 109 const LChar* end = ptr + value.length();
110 parseInternal(ptr, end, exceptionState); 110 parseInternal(ptr, end, exceptionState);
111 } else { 111 } else {
112 const UChar* ptr = value.characters16(); 112 const UChar* ptr = value.characters16();
113 const UChar* end = ptr + value.length(); 113 const UChar* end = ptr + value.length();
114 parseInternal(ptr, end, exceptionState); 114 parseInternal(ptr, end, exceptionState);
115 } 115 }
116 } 116 }
117 117
118 void SVGLengthList::add(PassRefPtr<NewSVGPropertyBase> other, SVGElement* contex tElement) 118 void SVGLengthList::add(PassRefPtr<SVGPropertyBase> other, SVGElement* contextEl ement)
119 { 119 {
120 RefPtr<SVGLengthList> otherList = toSVGLengthList(other); 120 RefPtr<SVGLengthList> otherList = toSVGLengthList(other);
121 121
122 if (length() != otherList->length()) 122 if (length() != otherList->length())
123 return; 123 return;
124 124
125 SVGLengthContext lengthContext(contextElement); 125 SVGLengthContext lengthContext(contextElement);
126 for (size_t i = 0; i < length(); ++i) 126 for (size_t i = 0; i < length(); ++i)
127 at(i)->setValue(at(i)->value(lengthContext) + otherList->at(i)->value(le ngthContext), lengthContext, ASSERT_NO_EXCEPTION); 127 at(i)->setValue(at(i)->value(lengthContext) + otherList->at(i)->value(le ngthContext), lengthContext, ASSERT_NO_EXCEPTION);
128 } 128 }
(...skipping 24 matching lines...) Expand all
153 ASSERT(!fromListSize || fromListSize == toListSize); 153 ASSERT(!fromListSize || fromListSize == toListSize);
154 if (resizeAnimatedListIfNeeded && length() < toListSize) { 154 if (resizeAnimatedListIfNeeded && length() < toListSize) {
155 size_t paddingCount = toListSize - length(); 155 size_t paddingCount = toListSize - length();
156 for (size_t i = 0; i < paddingCount; ++i) 156 for (size_t i = 0; i < paddingCount; ++i)
157 append(SVGLength::create(m_mode)); 157 append(SVGLength::create(m_mode));
158 } 158 }
159 159
160 return true; 160 return true;
161 } 161 }
162 162
163 void SVGLengthList::calculateAnimatedValue(SVGAnimationElement* animationElement , float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromVal ue, PassRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtE ndOfDurationValue, SVGElement* contextElement) 163 void SVGLengthList::calculateAnimatedValue(SVGAnimationElement* animationElement , float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurat ionValue, SVGElement* contextElement)
164 { 164 {
165 RefPtr<SVGLengthList> fromList = toSVGLengthList(fromValue); 165 RefPtr<SVGLengthList> fromList = toSVGLengthList(fromValue);
166 RefPtr<SVGLengthList> toList = toSVGLengthList(toValue); 166 RefPtr<SVGLengthList> toList = toSVGLengthList(toValue);
167 RefPtr<SVGLengthList> toAtEndOfDurationList = toSVGLengthList(toAtEndOfDurat ionValue); 167 RefPtr<SVGLengthList> toAtEndOfDurationList = toSVGLengthList(toAtEndOfDurat ionValue);
168 168
169 SVGLengthContext lengthContext(contextElement); 169 SVGLengthContext lengthContext(contextElement);
170 ASSERT(m_mode == SVGLength::lengthModeForAnimatedLengthAttribute(animationEl ement->attributeName())); 170 ASSERT(m_mode == SVGLength::lengthModeForAnimatedLengthAttribute(animationEl ement->attributeName()));
171 171
172 size_t fromLengthListSize = fromList->length(); 172 size_t fromLengthListSize = fromList->length();
173 size_t toLengthListSize = toList->length(); 173 size_t toLengthListSize = toList->length();
(...skipping 13 matching lines...) Expand all
187 } 187 }
188 float effectiveTo = toList->at(i)->value(lengthContext); 188 float effectiveTo = toList->at(i)->value(lengthContext);
189 float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurati onList->at(i)->value(lengthContext) : 0; 189 float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurati onList->at(i)->value(lengthContext) : 0;
190 190
191 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom, effectiveTo, effectiveToAtEnd, animatedNumber); 191 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom, effectiveTo, effectiveToAtEnd, animatedNumber);
192 at(i)->setUnitType(unitType); 192 at(i)->setUnitType(unitType);
193 at(i)->setValue(animatedNumber, lengthContext, ASSERT_NO_EXCEPTION); 193 at(i)->setValue(animatedNumber, lengthContext, ASSERT_NO_EXCEPTION);
194 } 194 }
195 } 195 }
196 196
197 float SVGLengthList::calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGEle ment*) 197 float SVGLengthList::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElemen t*)
198 { 198 {
199 // FIXME: Distance calculation is not possible for SVGLengthList right now. We need the distance for every single value. 199 // FIXME: Distance calculation is not possible for SVGLengthList right now. We need the distance for every single value.
200 return -1; 200 return -1;
201 } 201 }
202 } 202 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGLengthList.h ('k') | Source/core/svg/SVGLengthListTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698