summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/svg/SVGPathElement.cpp13
-rw-r--r--Source/WebCore/svg/SVGPathElement.h4
-rw-r--r--Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h7
3 files changed, 21 insertions, 3 deletions
diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp
index b030c9a83..c34c476f4 100644
--- a/Source/WebCore/svg/SVGPathElement.cpp
+++ b/Source/WebCore/svg/SVGPathElement.cpp
@@ -329,13 +329,22 @@ PassRefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElemen
if (RefPtr<SVGAnimatedProperty> property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(ownerType, dPropertyInfo()))
return property;
- // Build initial SVGPathSegList.
- buildSVGPathSegListFromByteStream(ownerType->m_pathByteStream.get(), ownerType, ownerType->m_pathSegList.value, UnalteredParsing);
+ if (ownerType->m_pathSegList.value.isEmpty())
+ buildSVGPathSegListFromByteStream(ownerType->m_pathByteStream.get(), ownerType, ownerType->m_pathSegList.value, UnalteredParsing);
return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegList>
(ownerType, dPropertyInfo(), ownerType->m_pathSegList.value);
}
+void SVGPathElement::animatedPropertyWillBeDeleted()
+{
+ // m_pathSegList.shouldSynchronize is set to true when the 'd' wrapper for m_pathSegList
+ // is created and cached. We need to reset it back to false when this wrapper is deleted
+ // so we can be sure if shouldSynchronize is true, SVGAnimatedProperty::lookupWrapper()
+ // will return a valid cached 'd' wrapper for the m_pathSegList.
+ m_pathSegList.shouldSynchronize = false;
+}
+
void SVGPathElement::synchronizeD(SVGElement* contextElement)
{
ASSERT(contextElement);
diff --git a/Source/WebCore/svg/SVGPathElement.h b/Source/WebCore/svg/SVGPathElement.h
index 0ca66ac11..e9db8a56e 100644
--- a/Source/WebCore/svg/SVGPathElement.h
+++ b/Source/WebCore/svg/SVGPathElement.h
@@ -98,7 +98,9 @@ public:
bool isAnimValObserved() const { return m_isAnimValObserved; }
-private:
+ void animatedPropertyWillBeDeleted();
+
+ private:
SVGPathElement(const QualifiedName&, Document*);
virtual bool isValid() const { return SVGTests::isValid(); }
diff --git a/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
index 1cfe0230e..dd5396aff 100644
--- a/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
+++ b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
@@ -113,6 +113,13 @@ private:
: SVGAnimatedListPropertyTearOff<SVGPathSegList>(contextElement, attributeName, animatedPropertyType, values)
, m_animatedPathByteStream(0)
{
+ ASSERT(contextElement);
+ ASSERT(toSVGPathElement(contextElement));
+ }
+
+ virtual ~SVGAnimatedPathSegListPropertyTearOff()
+ {
+ static_cast<SVGPathElement*>(contextElement())->animatedPropertyWillBeDeleted();
}
SVGPathByteStream* m_animatedPathByteStream;