Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 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 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011. 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 | 55 |
| 56 bool SVGAnimateElement::hasValidAttributeType() | 56 bool SVGAnimateElement::hasValidAttributeType() |
| 57 { | 57 { |
| 58 SVGElement* targetElement = this->targetElement(); | 58 SVGElement* targetElement = this->targetElement(); |
| 59 if (!targetElement) | 59 if (!targetElement) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT ype(); | 62 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT ype(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement * targetElement) const | |
| 66 { | |
| 67 ASSERT(targetElement); | |
| 68 | |
| 69 Vector<AnimatedPropertyType> propertyTypes; | |
| 70 targetElement->animatedPropertyTypeForAttribute(attributeName(), propertyTyp es); | |
| 71 if (propertyTypes.isEmpty()) | |
| 72 return AnimatedUnknown; | |
| 73 | |
| 74 ASSERT(propertyTypes.size() <= 2); | |
| 75 AnimatedPropertyType type = propertyTypes[0]; | |
| 76 | |
| 77 // Animations of transform lists are not allowed for <animate> or <set> | |
| 78 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties | |
|
haraken
2014/03/05 14:26:49
Keep this spec link.
kouhei (in TOK)
2014/03/06 03:53:30
Done.
| |
| 79 if (type == AnimatedTransformList && !hasTagName(SVGNames::animateTransformT ag)) | |
| 80 return AnimatedUnknown; | |
| 81 | |
| 82 if (propertyTypes.size() == 2) | |
| 83 ASSERT(propertyTypes[0] == propertyTypes[1]); | |
| 84 | |
| 85 return type; | |
| 86 } | |
| 87 | |
| 88 void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat Count, SVGSMILElement* resultElement) | 65 void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat Count, SVGSMILElement* resultElement) |
| 89 { | 66 { |
| 90 ASSERT(resultElement); | 67 ASSERT(resultElement); |
| 91 SVGElement* targetElement = this->targetElement(); | 68 SVGElement* targetElement = this->targetElement(); |
| 92 if (!targetElement || !isSVGAnimateElement(*resultElement)) | 69 if (!targetElement || !isSVGAnimateElement(*resultElement)) |
| 93 return; | 70 return; |
| 94 | 71 |
| 95 ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(targetElement )); | 72 ASSERT(m_animatedPropertyType == determineAnimatedPropertyType()); |
| 96 | 73 |
| 97 ASSERT(percentage >= 0 && percentage <= 1); | 74 ASSERT(percentage >= 0 && percentage <= 1); |
| 98 ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGName s::animateTransformTag)); | 75 ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGName s::animateTransformTag)); |
| 99 ASSERT(m_animatedPropertyType != AnimatedUnknown); | 76 ASSERT(m_animatedPropertyType != AnimatedUnknown); |
| 100 ASSERT(m_animator); | 77 ASSERT(m_animator); |
| 101 ASSERT(m_animator->type() == m_animatedPropertyType); | 78 ASSERT(m_animator->type() == m_animatedPropertyType); |
| 102 ASSERT(m_fromProperty); | 79 ASSERT(m_fromProperty); |
| 103 ASSERT(m_fromProperty->type() == m_animatedPropertyType); | 80 ASSERT(m_fromProperty->type() == m_animatedPropertyType); |
| 104 ASSERT(m_toProperty); | 81 ASSERT(m_toProperty); |
| 105 | 82 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 resetAnimatedPropertyType(); | 389 resetAnimatedPropertyType(); |
| 413 } | 390 } |
| 414 | 391 |
| 415 void SVGAnimateElement::resetAnimatedPropertyType() | 392 void SVGAnimateElement::resetAnimatedPropertyType() |
| 416 { | 393 { |
| 417 ASSERT(!m_animatedProperty); | 394 ASSERT(!m_animatedProperty); |
| 418 m_fromProperty.clear(); | 395 m_fromProperty.clear(); |
| 419 m_toProperty.clear(); | 396 m_toProperty.clear(); |
| 420 m_toAtEndOfDurationProperty.clear(); | 397 m_toAtEndOfDurationProperty.clear(); |
| 421 m_animator.clear(); | 398 m_animator.clear(); |
| 422 m_animatedPropertyType = targetElement() ? determineAnimatedPropertyType(tar getElement()) : AnimatedString; | 399 m_animatedPropertyType = determineAnimatedPropertyType(); |
| 423 } | 400 } |
| 424 | 401 |
| 425 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() | 402 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() |
| 426 { | 403 { |
| 427 if (!m_animator) | 404 if (!m_animator) |
| 428 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType); | 405 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType); |
| 429 ASSERT(m_animatedPropertyType == m_animator->type()); | 406 ASSERT(m_animatedPropertyType == m_animator->type()); |
| 430 return m_animator.get(); | 407 return m_animator.get(); |
| 431 } | 408 } |
| 432 | 409 |
| 433 } | 410 } |
| OLD | NEW |