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

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

Issue 678163002: Oilpan: move SVG property hierarchy to the heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased upto r185213 Created 6 years, 1 month 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/SVGNumberList.h ('k') | Source/core/svg/SVGNumberList.idl » ('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/SVGNumberList.h" 22 #include "core/svg/SVGNumberList.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 "wtf/text/StringBuilder.h" 26 #include "wtf/text/StringBuilder.h"
27 #include "wtf/text/WTFString.h" 27 #include "wtf/text/WTFString.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 inline PassRefPtr<SVGNumberList> toSVGNumberList(PassRefPtr<SVGPropertyBase> pas sBase) 31 inline PassRefPtrWillBeRawPtr<SVGNumberList> toSVGNumberList(PassRefPtrWillBeRaw Ptr<SVGPropertyBase> passBase)
32 { 32 {
33 RefPtr<SVGPropertyBase> base = passBase; 33 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase;
34 ASSERT(base->type() == SVGNumberList::classType()); 34 ASSERT(base->type() == SVGNumberList::classType());
35 return static_pointer_cast<SVGNumberList>(base.release()); 35 return static_pointer_cast<SVGNumberList>(base.release());
36 } 36 }
37 37
38 SVGNumberList::SVGNumberList() 38 SVGNumberList::SVGNumberList()
39 { 39 {
40 } 40 }
41 41
42 SVGNumberList::~SVGNumberList() 42 SVGNumberList::~SVGNumberList()
43 { 43 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 if (!valid) { 98 if (!valid) {
99 exceptionState.throwDOMException(SyntaxError, "Problem parsing number li st \""+value+"\""); 99 exceptionState.throwDOMException(SyntaxError, "Problem parsing number li st \""+value+"\"");
100 // No call to |clear()| here. SVG policy is to use valid items before er ror. 100 // No call to |clear()| here. SVG policy is to use valid items before er ror.
101 // Spec: http://www.w3.org/TR/SVG/single-page.html#implnote-ErrorProcess ing 101 // Spec: http://www.w3.org/TR/SVG/single-page.html#implnote-ErrorProcess ing
102 } 102 }
103 } 103 }
104 104
105 void SVGNumberList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElemen t* contextElement) 105 void SVGNumberList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElemen t* contextElement)
106 { 106 {
107 RefPtr<SVGNumberList> otherList = toSVGNumberList(other); 107 RefPtrWillBeRawPtr<SVGNumberList> otherList = toSVGNumberList(other);
108 108
109 if (length() != otherList->length()) 109 if (length() != otherList->length())
110 return; 110 return;
111 111
112 for (size_t i = 0; i < length(); ++i) 112 for (size_t i = 0; i < length(); ++i)
113 at(i)->setValue(at(i)->value() + otherList->at(i)->value()); 113 at(i)->setValue(at(i)->value() + otherList->at(i)->value());
114 } 114 }
115 115
116 void SVGNumberList::calculateAnimatedValue(SVGAnimationElement* animationElement , float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurat ionValue, SVGElement* contextElement) 116 void SVGNumberList::calculateAnimatedValue(SVGAnimationElement* animationElement , float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase > fromValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRa wPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextElement)
117 { 117 {
118 RefPtr<SVGNumberList> fromList = toSVGNumberList(fromValue); 118 RefPtrWillBeRawPtr<SVGNumberList> fromList = toSVGNumberList(fromValue);
119 RefPtr<SVGNumberList> toList = toSVGNumberList(toValue); 119 RefPtrWillBeRawPtr<SVGNumberList> toList = toSVGNumberList(toValue);
120 RefPtr<SVGNumberList> toAtEndOfDurationList = toSVGNumberList(toAtEndOfDurat ionValue); 120 RefPtrWillBeRawPtr<SVGNumberList> toAtEndOfDurationList = toSVGNumberList(to AtEndOfDurationValue);
121 121
122 size_t fromListSize = fromList->length(); 122 size_t fromListSize = fromList->length();
123 size_t toListSize = toList->length(); 123 size_t toListSize = toList->length();
124 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length(); 124 size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length();
125 125
126 if (!adjustFromToListValues(fromList, toList, percentage, animationElement-> animationMode())) 126 if (!adjustFromToListValues(fromList, toList, percentage, animationElement-> animationMode()))
127 return; 127 return;
128 128
129 for (size_t i = 0; i < toListSize; ++i) { 129 for (size_t i = 0; i < toListSize; ++i) {
130 float effectiveFrom = fromListSize ? fromList->at(i)->value() : 0; 130 float effectiveFrom = fromListSize ? fromList->at(i)->value() : 0;
131 float effectiveTo = toListSize ? toList->at(i)->value() : 0; 131 float effectiveTo = toListSize ? toList->at(i)->value() : 0;
132 float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurati onList->at(i)->value() : 0; 132 float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurati onList->at(i)->value() : 0;
133 133
134 float animated = at(i)->value(); 134 float animated = at(i)->value();
135 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom, effectiveTo, effectiveToAtEnd, animated); 135 animationElement->animateAdditiveNumber(percentage, repeatCount, effecti veFrom, effectiveTo, effectiveToAtEnd, animated);
136 at(i)->setValue(animated); 136 at(i)->setValue(animated);
137 } 137 }
138 } 138 }
139 139
140 float SVGNumberList::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElemen t*) 140 float SVGNumberList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> t o, SVGElement*)
141 { 141 {
142 // FIXME: Distance calculation is not possible for SVGNumberList right now. We need the distance for every single value. 142 // FIXME: Distance calculation is not possible for SVGNumberList right now. We need the distance for every single value.
143 return -1; 143 return -1;
144 } 144 }
145 145
146 Vector<float> SVGNumberList::toFloatVector() const 146 Vector<float> SVGNumberList::toFloatVector() const
147 { 147 {
148 Vector<float> vec; 148 Vector<float> vec;
149 vec.reserveInitialCapacity(length()); 149 vec.reserveInitialCapacity(length());
150 for (size_t i = 0; i < length(); ++i) 150 for (size_t i = 0; i < length(); ++i)
151 vec.uncheckedAppend(at(i)->value()); 151 vec.uncheckedAppend(at(i)->value());
152 return vec; 152 return vec;
153 } 153 }
154 154
155 } 155 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGNumberList.h ('k') | Source/core/svg/SVGNumberList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698