OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 , m_byteStream(byteStream) | 49 , m_byteStream(byteStream) |
50 , m_listSyncedToByteStream(true) | 50 , m_listSyncedToByteStream(true) |
51 { | 51 { |
52 ASSERT(contextElement); | 52 ASSERT(contextElement); |
53 } | 53 } |
54 | 54 |
55 SVGPathSegList::~SVGPathSegList() | 55 SVGPathSegList::~SVGPathSegList() |
56 { | 56 { |
57 } | 57 } |
58 | 58 |
59 PassRefPtr<SVGPathSegList> SVGPathSegList::clone() | 59 void SVGPathSegList::trace(Visitor* visitor) |
60 { | 60 { |
61 RefPtr<SVGPathSegList> svgPathSegList = adoptRef(new SVGPathSegList(m_contex
tElement, byteStream()->copy())); | 61 visitor->trace(m_contextElement); |
| 62 SVGListPropertyHelper<SVGPathSegList, SVGPathSeg>::trace(visitor); |
| 63 } |
| 64 |
| 65 PassRefPtrWillBeRawPtr<SVGPathSegList> SVGPathSegList::clone() |
| 66 { |
| 67 RefPtrWillBeRawPtr<SVGPathSegList> svgPathSegList = adoptRefWillBeNoop(new S
VGPathSegList(m_contextElement, byteStream()->copy())); |
62 svgPathSegList->invalidateList(); | 68 svgPathSegList->invalidateList(); |
63 return svgPathSegList.release(); | 69 return svgPathSegList.release(); |
64 } | 70 } |
65 | 71 |
66 PassRefPtr<SVGPropertyBase> SVGPathSegList::cloneForAnimation(const String& valu
e) const | 72 PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGPathSegList::cloneForAnimation(const
String& value) const |
67 { | 73 { |
68 RefPtr<SVGPathSegList> svgPathSegList = SVGPathSegList::create(m_contextElem
ent); | 74 RefPtrWillBeRawPtr<SVGPathSegList> svgPathSegList = SVGPathSegList::create(m
_contextElement); |
69 svgPathSegList->setValueAsString(value, IGNORE_EXCEPTION); | 75 svgPathSegList->setValueAsString(value, IGNORE_EXCEPTION); |
70 return svgPathSegList; | 76 return svgPathSegList; |
71 } | 77 } |
72 | 78 |
73 const SVGPathByteStream* SVGPathSegList::byteStream() const | 79 const SVGPathByteStream* SVGPathSegList::byteStream() const |
74 { | 80 { |
75 if (!m_byteStream) { | 81 if (!m_byteStream) { |
76 m_byteStream = SVGPathByteStream::create(); | 82 m_byteStream = SVGPathByteStream::create(); |
77 | 83 |
78 if (!Base::isEmpty()) { | 84 if (!Base::isEmpty()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 119 |
114 m_listSyncedToByteStream = true; | 120 m_listSyncedToByteStream = true; |
115 } | 121 } |
116 | 122 |
117 void SVGPathSegList::invalidateList() | 123 void SVGPathSegList::invalidateList() |
118 { | 124 { |
119 m_listSyncedToByteStream = false; | 125 m_listSyncedToByteStream = false; |
120 Base::clear(); | 126 Base::clear(); |
121 } | 127 } |
122 | 128 |
123 PassRefPtr<SVGPathSeg> SVGPathSegList::appendItem(PassRefPtr<SVGPathSeg> passIte
m) | 129 PassRefPtrWillBeRawPtr<SVGPathSeg> SVGPathSegList::appendItem(PassRefPtrWillBeRa
wPtr<SVGPathSeg> passItem) |
124 { | 130 { |
125 updateListFromByteStream(); | 131 updateListFromByteStream(); |
126 RefPtr<SVGPathSeg> item = Base::appendItem(passItem); | 132 RefPtrWillBeRawPtr<SVGPathSeg> item = Base::appendItem(passItem); |
127 | 133 |
128 if (m_byteStream) { | 134 if (m_byteStream) { |
129 SVGPathByteStreamBuilder builder; | 135 SVGPathByteStreamBuilder builder; |
130 builder.setCurrentByteStream(m_byteStream.get()); | 136 builder.setCurrentByteStream(m_byteStream.get()); |
131 | 137 |
132 SVGPathSegListSource source(lastAppended(), end()); | 138 SVGPathSegListSource source(lastAppended(), end()); |
133 | 139 |
134 SVGPathParser parser; | 140 SVGPathParser parser; |
135 parser.setCurrentConsumer(&builder); | 141 parser.setCurrentConsumer(&builder); |
136 parser.setCurrentSource(&source); | 142 parser.setCurrentSource(&source); |
(...skipping 14 matching lines...) Expand all Loading... |
151 { | 157 { |
152 invalidateList(); | 158 invalidateList(); |
153 if (!m_byteStream) | 159 if (!m_byteStream) |
154 m_byteStream = SVGPathByteStream::create(); | 160 m_byteStream = SVGPathByteStream::create(); |
155 if (!buildSVGPathByteStreamFromString(string, m_byteStream.get(), UnalteredP
arsing)) | 161 if (!buildSVGPathByteStreamFromString(string, m_byteStream.get(), UnalteredP
arsing)) |
156 exceptionState.throwDOMException(SyntaxError, "Problem parsing path \""
+ string + "\""); | 162 exceptionState.throwDOMException(SyntaxError, "Problem parsing path \""
+ string + "\""); |
157 } | 163 } |
158 | 164 |
159 void SVGPathSegList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGEleme
nt*) | 165 void SVGPathSegList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGEleme
nt*) |
160 { | 166 { |
161 RefPtr<SVGPathSegList> otherList = toSVGPathSegList(other); | 167 RefPtrWillBeRawPtr<SVGPathSegList> otherList = toSVGPathSegList(other); |
162 if (length() != otherList->length()) | 168 if (length() != otherList->length()) |
163 return; | 169 return; |
164 | 170 |
165 byteStream(); // create |m_byteStream| if not exist. | 171 byteStream(); // create |m_byteStream| if not exist. |
166 addToSVGPathByteStream(m_byteStream.get(), otherList->byteStream()); | 172 addToSVGPathByteStream(m_byteStream.get(), otherList->byteStream()); |
167 invalidateList(); | 173 invalidateList(); |
168 } | 174 } |
169 | 175 |
170 void SVGPathSegList::calculateAnimatedValue(SVGAnimationElement* animationElemen
t, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue
, PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDura
tionValue, SVGElement*) | 176 void SVGPathSegList::calculateAnimatedValue(SVGAnimationElement* animationElemen
t, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBas
e> fromValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeR
awPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) |
171 { | 177 { |
172 invalidateList(); | 178 invalidateList(); |
173 | 179 |
174 ASSERT(animationElement); | 180 ASSERT(animationElement); |
175 bool isToAnimation = animationElement->animationMode() == ToAnimation; | 181 bool isToAnimation = animationElement->animationMode() == ToAnimation; |
176 | 182 |
177 const RefPtr<SVGPathSegList> from = toSVGPathSegList(fromValue); | 183 const RefPtrWillBeRawPtr<SVGPathSegList> from = toSVGPathSegList(fromValue); |
178 const RefPtr<SVGPathSegList> to = toSVGPathSegList(toValue); | 184 const RefPtrWillBeRawPtr<SVGPathSegList> to = toSVGPathSegList(toValue); |
179 const RefPtr<SVGPathSegList> toAtEndOfDuration = toSVGPathSegList(toAtEndOfD
urationValue); | 185 const RefPtrWillBeRawPtr<SVGPathSegList> toAtEndOfDuration = toSVGPathSegLis
t(toAtEndOfDurationValue); |
180 | 186 |
181 const SVGPathByteStream* toStream = to->byteStream(); | 187 const SVGPathByteStream* toStream = to->byteStream(); |
182 const SVGPathByteStream* fromStream = from->byteStream(); | 188 const SVGPathByteStream* fromStream = from->byteStream(); |
183 OwnPtr<SVGPathByteStream> copy; | 189 OwnPtr<SVGPathByteStream> copy; |
184 | 190 |
185 // If no 'to' value is given, nothing to animate. | 191 // If no 'to' value is given, nothing to animate. |
186 if (!toStream->size()) | 192 if (!toStream->size()) |
187 return; | 193 return; |
188 | 194 |
189 if (isToAnimation) { | 195 if (isToAnimation) { |
(...skipping 30 matching lines...) Expand all Loading... |
220 if (!fromStream->size() || (animationElement->isAdditive() && !isToAnimation
)) | 226 if (!fromStream->size() || (animationElement->isAdditive() && !isToAnimation
)) |
221 addToSVGPathByteStream(m_byteStream.get(), lastAnimatedStream.get()); | 227 addToSVGPathByteStream(m_byteStream.get(), lastAnimatedStream.get()); |
222 | 228 |
223 // Handle accumulate='sum'. | 229 // Handle accumulate='sum'. |
224 if (animationElement->isAccumulated() && repeatCount) { | 230 if (animationElement->isAccumulated() && repeatCount) { |
225 const SVGPathByteStream* toAtEndOfDurationStream = toAtEndOfDuration->by
teStream(); | 231 const SVGPathByteStream* toAtEndOfDurationStream = toAtEndOfDuration->by
teStream(); |
226 addToSVGPathByteStream(m_byteStream.get(), toAtEndOfDurationStream, repe
atCount); | 232 addToSVGPathByteStream(m_byteStream.get(), toAtEndOfDurationStream, repe
atCount); |
227 } | 233 } |
228 } | 234 } |
229 | 235 |
230 float SVGPathSegList::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGEleme
nt*) | 236 float SVGPathSegList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase>
to, SVGElement*) |
231 { | 237 { |
232 // FIXME: Support paced animations. | 238 // FIXME: Support paced animations. |
233 return -1; | 239 return -1; |
234 } | 240 } |
235 | 241 |
236 } | 242 } |
OLD | NEW |