diff options
Diffstat (limited to 'Source/WebCore/svg/SVGAnimationElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGAnimationElement.cpp | 41 |
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) |