OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 SVGElement* targetElement = this->targetElement(); | 179 SVGElement* targetElement = this->targetElement(); |
180 if (!targetElement) | 180 if (!targetElement) |
181 return; | 181 return; |
182 | 182 |
183 AffineTransform* transform = targetElement->animateMotionTransform(); | 183 AffineTransform* transform = targetElement->animateMotionTransform(); |
184 if (!transform) | 184 if (!transform) |
185 return; | 185 return; |
186 | 186 |
187 transform->makeIdentity(); | 187 transform->makeIdentity(); |
188 | 188 |
189 if (LayoutObject* targetRenderer = targetElement->renderer()) { | 189 if (LayoutObject* targetRenderer = targetElement->layoutObject()) { |
190 targetRenderer->setNeedsTransformUpdate(); | 190 targetRenderer->setNeedsTransformUpdate(); |
191 markForLayoutAndParentResourceInvalidation(targetRenderer); | 191 markForLayoutAndParentResourceInvalidation(targetRenderer); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 bool SVGAnimateMotionElement::calculateToAtEndOfDurationValue(const String& toAt
EndOfDurationString) | 195 bool SVGAnimateMotionElement::calculateToAtEndOfDurationValue(const String& toAt
EndOfDurationString) |
196 { | 196 { |
197 parsePoint(toAtEndOfDurationString, m_toPointAtEndOfDuration); | 197 parsePoint(toAtEndOfDurationString, m_toPointAtEndOfDuration); |
198 m_hasToPointAtEndOfDuration = true; | 198 m_hasToPointAtEndOfDuration = true; |
199 return true; | 199 return true; |
(...skipping 21 matching lines...) Expand all Loading... |
221 | 221 |
222 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned
repeatCount, SVGSMILElement*) | 222 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned
repeatCount, SVGSMILElement*) |
223 { | 223 { |
224 SVGElement* targetElement = this->targetElement(); | 224 SVGElement* targetElement = this->targetElement(); |
225 if (!targetElement) | 225 if (!targetElement) |
226 return; | 226 return; |
227 AffineTransform* transform = targetElement->animateMotionTransform(); | 227 AffineTransform* transform = targetElement->animateMotionTransform(); |
228 if (!transform) | 228 if (!transform) |
229 return; | 229 return; |
230 | 230 |
231 if (LayoutObject* targetRenderer = targetElement->renderer()) | 231 if (LayoutObject* targetRenderer = targetElement->layoutObject()) |
232 targetRenderer->setNeedsTransformUpdate(); | 232 targetRenderer->setNeedsTransformUpdate(); |
233 | 233 |
234 if (!isAdditive()) | 234 if (!isAdditive()) |
235 transform->makeIdentity(); | 235 transform->makeIdentity(); |
236 | 236 |
237 if (animationMode() != PathAnimation) { | 237 if (animationMode() != PathAnimation) { |
238 FloatPoint toPointAtEndOfDuration = m_toPoint; | 238 FloatPoint toPointAtEndOfDuration = m_toPoint; |
239 if (isAccumulated() && repeatCount && m_hasToPointAtEndOfDuration) | 239 if (isAccumulated() && repeatCount && m_hasToPointAtEndOfDuration) |
240 toPointAtEndOfDuration = m_toPointAtEndOfDuration; | 240 toPointAtEndOfDuration = m_toPointAtEndOfDuration; |
241 | 241 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 transform->rotate(angle); | 274 transform->rotate(angle); |
275 } | 275 } |
276 | 276 |
277 void SVGAnimateMotionElement::applyResultsToTarget() | 277 void SVGAnimateMotionElement::applyResultsToTarget() |
278 { | 278 { |
279 // We accumulate to the target element transform list so there is not much t
o do here. | 279 // We accumulate to the target element transform list so there is not much t
o do here. |
280 SVGElement* targetElement = this->targetElement(); | 280 SVGElement* targetElement = this->targetElement(); |
281 if (!targetElement) | 281 if (!targetElement) |
282 return; | 282 return; |
283 | 283 |
284 if (LayoutObject* renderer = targetElement->renderer()) | 284 if (LayoutObject* renderer = targetElement->layoutObject()) |
285 markForLayoutAndParentResourceInvalidation(renderer); | 285 markForLayoutAndParentResourceInvalidation(renderer); |
286 | 286 |
287 AffineTransform* t = targetElement->animateMotionTransform(); | 287 AffineTransform* t = targetElement->animateMotionTransform(); |
288 if (!t) | 288 if (!t) |
289 return; | 289 return; |
290 | 290 |
291 // ...except in case where we have additional instances in <use> trees. | 291 // ...except in case where we have additional instances in <use> trees. |
292 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& instances = tar
getElement->instancesForElement(); | 292 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& instances = tar
getElement->instancesForElement(); |
293 for (SVGElement* shadowTreeElement : instances) { | 293 for (SVGElement* shadowTreeElement : instances) { |
294 ASSERT(shadowTreeElement); | 294 ASSERT(shadowTreeElement); |
295 AffineTransform* transform = shadowTreeElement->animateMotionTransform()
; | 295 AffineTransform* transform = shadowTreeElement->animateMotionTransform()
; |
296 if (!transform) | 296 if (!transform) |
297 continue; | 297 continue; |
298 transform->setMatrix(t->a(), t->b(), t->c(), t->d(), t->e(), t->f()); | 298 transform->setMatrix(t->a(), t->b(), t->c(), t->d(), t->e(), t->f()); |
299 if (LayoutObject* renderer = shadowTreeElement->renderer()) { | 299 if (LayoutObject* renderer = shadowTreeElement->layoutObject()) { |
300 renderer->setNeedsTransformUpdate(); | 300 renderer->setNeedsTransformUpdate(); |
301 markForLayoutAndParentResourceInvalidation(renderer); | 301 markForLayoutAndParentResourceInvalidation(renderer); |
302 } | 302 } |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 float SVGAnimateMotionElement::calculateDistance(const String& fromString, const
String& toString) | 306 float SVGAnimateMotionElement::calculateDistance(const String& fromString, const
String& toString) |
307 { | 307 { |
308 FloatPoint from; | 308 FloatPoint from; |
309 FloatPoint to; | 309 FloatPoint to; |
310 if (!parsePoint(fromString, from)) | 310 if (!parsePoint(fromString, from)) |
311 return -1; | 311 return -1; |
312 if (!parsePoint(toString, to)) | 312 if (!parsePoint(toString, to)) |
313 return -1; | 313 return -1; |
314 FloatSize diff = to - from; | 314 FloatSize diff = to - from; |
315 return sqrtf(diff.width() * diff.width() + diff.height() * diff.height()); | 315 return sqrtf(diff.width() * diff.width() + diff.height() * diff.height()); |
316 } | 316 } |
317 | 317 |
318 void SVGAnimateMotionElement::updateAnimationMode() | 318 void SVGAnimateMotionElement::updateAnimationMode() |
319 { | 319 { |
320 if (!m_animationPath.isEmpty()) | 320 if (!m_animationPath.isEmpty()) |
321 setAnimationMode(PathAnimation); | 321 setAnimationMode(PathAnimation); |
322 else | 322 else |
323 SVGAnimationElement::updateAnimationMode(); | 323 SVGAnimationElement::updateAnimationMode(); |
324 } | 324 } |
325 | 325 |
326 } | 326 } |
OLD | NEW |