Index: Source/core/svg/SVGAnimatedTypeAnimator.cpp |
diff --git a/Source/core/svg/SVGAnimatedTypeAnimator.cpp b/Source/core/svg/SVGAnimatedTypeAnimator.cpp |
index 087699a8abf35b7df0b1d441e61eae70e6252768..9e9091040956f655a0e73de3c8138ed7d0307caa 100644 |
--- a/Source/core/svg/SVGAnimatedTypeAnimator.cpp |
+++ b/Source/core/svg/SVGAnimatedTypeAnimator.cpp |
@@ -25,7 +25,6 @@ |
#include "core/svg/SVGAnimateTransformElement.h" |
#include "core/svg/SVGAnimatedColor.h" |
#include "core/svg/SVGAnimationElement.h" |
-#include "core/svg/SVGElement.h" |
#include "core/svg/SVGLength.h" |
#include "core/svg/SVGLengthList.h" |
#include "core/svg/SVGNumber.h" |
@@ -61,7 +60,7 @@ SVGAnimatedTypeAnimator::~SVGAnimatedTypeAnimator() |
{ |
} |
-PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::createPropertyForAnimation(const String& value) |
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::createPropertyForAnimation(const String& value) |
{ |
if (isAnimatingSVGDom()) { |
// SVG DOM animVal animation code-path. |
@@ -89,22 +88,22 @@ PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::createPropertyForAnimation( |
case AnimatedColor: |
return SVGColorProperty::create(value.isEmpty() ? StyleColor::currentColor() : CSSParser::colorFromRGBColorString(value)); |
case AnimatedNumber: { |
- RefPtr<SVGNumber> property = SVGNumber::create(); |
+ RefPtrWillBeRawPtr<SVGNumber> property = SVGNumber::create(); |
property->setValueAsString(value, IGNORE_EXCEPTION); |
return property.release(); |
} |
case AnimatedLength: { |
- RefPtr<SVGLength> property = SVGLength::create(LengthModeOther); |
+ RefPtrWillBeRawPtr<SVGLength> property = SVGLength::create(LengthModeOther); |
property->setValueAsString(value, IGNORE_EXCEPTION); |
return property.release(); |
} |
case AnimatedLengthList: { |
- RefPtr<SVGLengthList> property = SVGLengthList::create(LengthModeOther); |
+ RefPtrWillBeRawPtr<SVGLengthList> property = SVGLengthList::create(LengthModeOther); |
property->setValueAsString(value, IGNORE_EXCEPTION); |
return property.release(); |
} |
case AnimatedString: { |
- RefPtr<SVGString> property = SVGString::create(); |
+ RefPtrWillBeRawPtr<SVGString> property = SVGString::create(); |
property->setValueAsString(value, IGNORE_EXCEPTION); |
return property.release(); |
} |
@@ -135,18 +134,18 @@ PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::createPropertyForAnimation( |
return nullptr; |
} |
-PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::constructFromString(const String& value) |
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::constructFromString(const String& value) |
{ |
return createPropertyForAnimation(value); |
} |
-void SVGAnimatedTypeAnimator::calculateFromAndToValues(RefPtr<SVGPropertyBase>& from, RefPtr<SVGPropertyBase>& to, const String& fromString, const String& toString) |
+void SVGAnimatedTypeAnimator::calculateFromAndToValues(RefPtrWillBeMember<SVGPropertyBase>& from, RefPtrWillBeMember<SVGPropertyBase>& to, const String& fromString, const String& toString) |
{ |
from = constructFromString(fromString); |
to = constructFromString(toString); |
} |
-void SVGAnimatedTypeAnimator::calculateFromAndByValues(RefPtr<SVGPropertyBase>& from, RefPtr<SVGPropertyBase>& to, const String& fromString, const String& byString) |
+void SVGAnimatedTypeAnimator::calculateFromAndByValues(RefPtrWillBeMember<SVGPropertyBase>& from, RefPtrWillBeMember<SVGPropertyBase>& to, const String& fromString, const String& byString) |
{ |
from = constructFromString(fromString); |
to = constructFromString(byString); |
@@ -156,14 +155,14 @@ void SVGAnimatedTypeAnimator::calculateFromAndByValues(RefPtr<SVGPropertyBase>& |
namespace { |
-void setAnimatedValueOnAllTargetProperties(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list, const QualifiedName& attributeName, PassRefPtr<SVGPropertyBase> passValue) |
+void setAnimatedValueOnAllTargetProperties(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<SVGPropertyBase> passValue) |
{ |
- RefPtr<SVGPropertyBase> value = passValue; |
+ RefPtrWillBeRawPtr<SVGPropertyBase> value = passValue; |
WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator it = list.begin(); |
WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator itEnd = list.end(); |
for (; it != itEnd; ++it) { |
- RefPtr<SVGAnimatedPropertyBase> animatedProperty = (*it)->propertyFromAttribute(attributeName); |
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = (*it)->propertyFromAttribute(attributeName); |
if (animatedProperty) |
animatedProperty->setAnimatedValue(value); |
} |
@@ -171,17 +170,17 @@ void setAnimatedValueOnAllTargetProperties(const WillBeHeapVector<RawPtrWillBeMe |
} |
-PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::resetAnimation(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::resetAnimation(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
{ |
ASSERT(isAnimatingSVGDom()); |
- RefPtr<SVGPropertyBase> animatedValue = m_animatedProperty->createAnimatedValue(); |
+ RefPtrWillBeRawPtr<SVGPropertyBase> animatedValue = m_animatedProperty->createAnimatedValue(); |
ASSERT(animatedValue->type() == m_type); |
setAnimatedValueOnAllTargetProperties(list, m_animatedProperty->attributeName(), animatedValue); |
return animatedValue.release(); |
} |
-PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::startAnimValAnimation(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::startAnimValAnimation(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
{ |
ASSERT(isAnimatingSVGDom()); |
SVGElement::InstanceUpdateBlocker blocker(m_contextElement); |
@@ -197,13 +196,13 @@ void SVGAnimatedTypeAnimator::stopAnimValAnimation(const WillBeHeapVector<RawPtr |
WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator it = list.begin(); |
WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator itEnd = list.end(); |
for (; it != itEnd; ++it) { |
- RefPtr<SVGAnimatedPropertyBase> animatedProperty = (*it)->propertyFromAttribute(m_animatedProperty->attributeName()); |
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = (*it)->propertyFromAttribute(m_animatedProperty->attributeName()); |
if (animatedProperty) |
animatedProperty->animationEnded(); |
} |
} |
-PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::resetAnimValToBaseVal(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::resetAnimValToBaseVal(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) |
{ |
SVGElement::InstanceUpdateBlocker blocker(m_contextElement); |
@@ -211,19 +210,20 @@ PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::resetAnimValToBaseVal(const |
} |
class ParsePropertyFromString { |
+ STACK_ALLOCATED(); |
public: |
explicit ParsePropertyFromString(SVGAnimatedTypeAnimator* animator) |
: m_animator(animator) |
{ |
} |
- PassRefPtr<SVGPropertyBase> operator()(SVGAnimationElement*, const String& value) |
+ PassRefPtrWillBeRawPtr<SVGPropertyBase> operator()(SVGAnimationElement*, const String& value) |
{ |
return m_animator->createPropertyForAnimation(value); |
} |
private: |
- SVGAnimatedTypeAnimator* m_animator; |
+ RawPtrWillBeMember<SVGAnimatedTypeAnimator> m_animator; |
}; |
void SVGAnimatedTypeAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGPropertyBase* from, SVGPropertyBase* to, SVGPropertyBase* toAtEndOfDuration, SVGPropertyBase* animated) |
@@ -231,15 +231,15 @@ void SVGAnimatedTypeAnimator::calculateAnimatedValue(float percentage, unsigned |
ASSERT(m_animationElement); |
ASSERT(m_contextElement); |
- RefPtr<SVGPropertyBase> fromValue = m_animationElement->animationMode() == ToAnimation ? animated : from; |
- RefPtr<SVGPropertyBase> toValue = to; |
- RefPtr<SVGPropertyBase> toAtEndOfDurationValue = toAtEndOfDuration; |
- RefPtr<SVGPropertyBase> animatedValue = animated; |
+ RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = m_animationElement->animationMode() == ToAnimation ? animated : from; |
+ RefPtrWillBeRawPtr<SVGPropertyBase> toValue = to; |
+ RefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDurationValue = toAtEndOfDuration; |
+ RefPtrWillBeRawPtr<SVGPropertyBase> animatedValue = animated; |
// Apply CSS inheritance rules. |
ParsePropertyFromString parsePropertyFromString(this); |
- m_animationElement->adjustForInheritance<RefPtr<SVGPropertyBase>, ParsePropertyFromString>(parsePropertyFromString, m_animationElement->fromPropertyValueType(), fromValue, m_contextElement); |
- m_animationElement->adjustForInheritance<RefPtr<SVGPropertyBase>, ParsePropertyFromString>(parsePropertyFromString, m_animationElement->toPropertyValueType(), toValue, m_contextElement); |
+ m_animationElement->adjustForInheritance<RefPtrWillBeRawPtr<SVGPropertyBase>, ParsePropertyFromString>(parsePropertyFromString, m_animationElement->fromPropertyValueType(), fromValue, m_contextElement); |
+ m_animationElement->adjustForInheritance<RefPtrWillBeRawPtr<SVGPropertyBase>, ParsePropertyFromString>(parsePropertyFromString, m_animationElement->toPropertyValueType(), toValue, m_contextElement); |
animatedValue->calculateAnimatedValue(m_animationElement, percentage, repeatCount, fromValue, toValue, toAtEndOfDurationValue, m_contextElement); |
} |
@@ -248,8 +248,8 @@ float SVGAnimatedTypeAnimator::calculateDistance(const String& fromString, const |
{ |
ASSERT(m_animationElement); |
ASSERT(m_contextElement); |
- RefPtr<SVGPropertyBase> fromValue = createPropertyForAnimation(fromString); |
- RefPtr<SVGPropertyBase> toValue = createPropertyForAnimation(toString); |
+ RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = createPropertyForAnimation(fromString); |
+ RefPtrWillBeRawPtr<SVGPropertyBase> toValue = createPropertyForAnimation(toString); |
return fromValue->calculateDistance(toValue, m_contextElement); |
} |
@@ -257,6 +257,7 @@ void SVGAnimatedTypeAnimator::trace(Visitor* visitor) |
{ |
visitor->trace(m_animationElement); |
visitor->trace(m_contextElement); |
+ visitor->trace(m_animatedProperty); |
} |
} |