summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGAnimationElement.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/svg/SVGAnimationElement.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/svg/SVGAnimationElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGAnimationElement.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp
index 3c209707c..993f950c1 100644
--- a/Source/WebCore/svg/SVGAnimationElement.cpp
+++ b/Source/WebCore/svg/SVGAnimationElement.cpp
@@ -156,7 +156,7 @@ bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName)
supportedAttributes.add(SVGNames::toAttr);
supportedAttributes.add(SVGNames::byAttr);
}
- return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
+ return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
}
void SVGAnimationElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -259,7 +259,7 @@ void SVGAnimationElement::beginElement()
void SVGAnimationElement::beginElementAt(float offset)
{
- if (isnan(offset))
+ if (std::isnan(offset))
return;
SMILTime elapsed = this->elapsed();
addBeginTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
@@ -272,7 +272,7 @@ void SVGAnimationElement::endElement()
void SVGAnimationElement::endElementAt(float offset)
{
- if (isnan(offset))
+ if (std::isnan(offset))
return;
SMILTime elapsed = this->elapsed();
addEndTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
@@ -319,7 +319,7 @@ void SVGAnimationElement::setAttributeType(const AtomicString& attributeType)
m_attributeType = AttributeTypeXML;
else
m_attributeType = AttributeTypeAuto;
- checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget));
+ checkInvalidCSSAttributeType(targetElement());
}
String SVGAnimationElement::toValue() const
@@ -354,7 +354,7 @@ bool SVGAnimationElement::isAccumulated() const
bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* targetElement, const QualifiedName& attributeName)
{
ASSERT(targetElement);
- if (!targetElement->isStyled())
+ if (!targetElement->isSVGStyledElement())
return false;
return SVGStyledElement::isAnimatableCSSProperty(attributeName);
@@ -385,6 +385,10 @@ void SVGAnimationElement::calculateKeyTimesForCalcModePaced()
ASSERT(valuesCount >= 1);
if (valuesCount == 1)
return;
+
+ // FIXME, webkit.org/b/109010: m_keyTimes should not be modified in this function.
+ m_keyTimes.clear();
+
Vector<float> keyTimesForPaced;
float totalDistance = 0;
keyTimesForPaced.append(0);
@@ -405,7 +409,7 @@ void SVGAnimationElement::calculateKeyTimesForCalcModePaced()
keyTimesForPaced[keyTimesForPaced.size() - 1] = 1;
// Use key times calculated based on pacing instead of the user provided ones.
- m_keyTimes.swap(keyTimesForPaced);
+ m_keyTimes = keyTimesForPaced;
}
static inline double solveEpsilon(double duration) { return 1 / (200 * duration); }
@@ -427,7 +431,7 @@ unsigned SVGAnimationElement::calculateKeyTimesIndex(float percent) const
float SVGAnimationElement::calculatePercentForSpline(float percent, unsigned splineIndex) const
{
ASSERT(calcMode() == CalcModeSpline);
- ASSERT(splineIndex < m_keySplines.size());
+ ASSERT_WITH_SECURITY_IMPLICATION(splineIndex < m_keySplines.size());
UnitBezier bezier = m_keySplines[splineIndex];
SMILTime duration = simpleDuration();
if (!duration.isFinite())
@@ -628,14 +632,15 @@ void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount, S
calculateAnimatedValue(effectivePercent, repeatCount, resultElement);
}
-void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& value)
+void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& valueString)
{
ASSERT(element);
- ASSERT(element->isStyled());
+ ASSERT(element->isSVGStyledElement());
// Don't include any properties resulting from CSS Transitions/Animations or SMIL animations, as we want to retrieve the "base value".
element->setUseOverrideComputedStyle(true);
- value = CSSComputedStyleDeclaration::create(element)->getPropertyValue(id);
+ RefPtr<CSSValue> value = ComputedStyleExtractor(element).propertyValue(id);
+ valueString = value ? value->cssText() : String();
element->setUseOverrideComputedStyle(false);
}
@@ -649,8 +654,8 @@ void SVGAnimationElement::adjustForInheritance(SVGElement* targetElement, const
if (!parent || !parent->isSVGElement())
return;
- SVGElement* svgParent = static_cast<SVGElement*>(parent);
- if (!svgParent->isStyled())
+ SVGElement* svgParent = toSVGElement(parent);
+ if (!svgParent->isSVGStyledElement())
return;
computeCSSPropertyValue(svgParent, cssPropertyID(attributeName.localName()), value);
}
@@ -660,7 +665,7 @@ static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName&
ASSERT(targetElement);
DEFINE_STATIC_LOCAL(const AtomicString, inherit, ("inherit", AtomicString::ConstructFromLiteral));
- if (value.isEmpty() || value != inherit || !targetElement->isStyled())
+ if (value.isEmpty() || value != inherit || !targetElement->isSVGStyledElement())
return false;
return SVGStyledElement::isAnimatableCSSProperty(attributeName);
}
@@ -677,18 +682,16 @@ void SVGAnimationElement::determinePropertyValueTypes(const String& from, const
m_toPropertyValueType = InheritValue;
}
-void SVGAnimationElement::targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget)
+void SVGAnimationElement::setTargetElement(SVGElement* target)
{
- SVGSMILElement::targetElementWillChange(currentTarget, newTarget);
-
- checkInvalidCSSAttributeType(newTarget);
+ SVGSMILElement::setTargetElement(target);
+ checkInvalidCSSAttributeType(target);
}
void SVGAnimationElement::setAttributeName(const QualifiedName& attributeName)
{
SVGSMILElement::setAttributeName(attributeName);
-
- checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget));
+ checkInvalidCSSAttributeType(targetElement());
}
void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target)