summaryrefslogtreecommitdiff
path: root/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp
index 67e32e04d0..7e0785829f 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp
@@ -1,12 +1,10 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
Copyright (C) 2007 Eric Seidel <eric@webkit.org>
Copyright (C) 2008 Apple Inc. All rights reserved.
Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
- This file is part of the KDE project
-
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
@@ -53,7 +51,6 @@ SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document*
: SVGSMILElement(tagName, doc)
, SVGTests()
, SVGExternalResourcesRequired()
- , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false)
, m_animationValid(false)
{
}
@@ -61,7 +58,7 @@ SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document*
SVGAnimationElement::~SVGAnimationElement()
{
}
-
+
static void parseKeyTimes(const String& parse, Vector<float>& result, bool verifyOrder)
{
result.clear();
@@ -143,6 +140,14 @@ void SVGAnimationElement::attributeChanged(Attribute* attr, bool preserveDecls)
SVGSMILElement::attributeChanged(attr, preserveDecls);
}
+void SVGAnimationElement::synchronizeProperty(const QualifiedName& attrName)
+{
+ SVGSMILElement::synchronizeProperty(attrName);
+
+ if (attrName == anyQName() || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ synchronizeExternalResourcesRequired();
+}
+
float SVGAnimationElement::getStartTime() const
{
return narrowPrecisionToFloat(intervalBegin().value());
@@ -311,9 +316,9 @@ void SVGAnimationElement::setTargetAttributeAnimatedValue(const String& value)
static_cast<SVGStyledElement*>(target)->setInstanceUpdatesBlocked(false);
// If the target element is used in an <use> instance tree, update that as well.
- HashSet<SVGElementInstance*> instances = target->instancesForElement();
- HashSet<SVGElementInstance*>::iterator end = instances.end();
- for (HashSet<SVGElementInstance*>::iterator it = instances.begin(); it != end; ++it) {
+ const HashSet<SVGElementInstance*>& instances = target->instancesForElement();
+ const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
+ for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
SVGElement* shadowTreeElement = (*it)->shadowTreeElement();
ASSERT(shadowTreeElement);
if (isCSS)
@@ -471,6 +476,17 @@ void SVGAnimationElement::startedActiveInterval()
if (!hasValidTarget())
return;
+ // These validations are appropriate for all animation modes.
+ if (hasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() != m_keyTimes.size())
+ return;
+
+ CalcMode calcMode = this->calcMode();
+ if (calcMode == CalcModeSpline) {
+ unsigned num = m_keySplines.size() + 1;
+ if ((hasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() != num) || m_values.size() != num)
+ return;
+ }
+
AnimationMode animationMode = this->animationMode();
if (animationMode == NoAnimation)
return;
@@ -485,16 +501,15 @@ void SVGAnimationElement::startedActiveInterval()
else if (animationMode == ByAnimation)
m_animationValid = calculateFromAndByValues(String(), byValue());
else if (animationMode == ValuesAnimation) {
- CalcMode calcMode = this->calcMode();
m_animationValid = m_values.size() > 1
&& (calcMode == CalcModePaced || !hasAttribute(SVGNames::keyTimesAttr) || hasAttribute(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
&& (calcMode == CalcModeDiscrete || !m_keyTimes.size() || m_keyTimes.last() == 1.0)
- && (calcMode != CalcModeSpline || (m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1) || m_keySplines.size() == m_keyPoints.size() - 1))
+ && (calcMode != CalcModeSpline || ((m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1)) || m_keySplines.size() == m_keyPoints.size() - 1))
&& (!hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size()));
if (calcMode == CalcModePaced && m_animationValid)
calculateKeyTimesForCalcModePaced();
} else if (animationMode == PathAnimation)
- m_animationValid = calcMode() == CalcModePaced || !hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
+ m_animationValid = calcMode == CalcModePaced || !hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
}
void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement)