Title: [122882] branches/chromium/1180/Source/WebCore/svg
Revision
122882
Author
[email protected]
Date
2012-07-17 15:49:13 -0700 (Tue, 17 Jul 2012)

Log Message

Merge 122278
BUG=136296
Review URL: https://chromiumcodereview.appspot.com/10778043

Modified Paths

Diff

Modified: branches/chromium/1180/Source/WebCore/svg/SVGDocumentExtensions.cpp (122881 => 122882)


--- branches/chromium/1180/Source/WebCore/svg/SVGDocumentExtensions.cpp	2012-07-17 22:34:34 UTC (rev 122881)
+++ branches/chromium/1180/Source/WebCore/svg/SVGDocumentExtensions.cpp	2012-07-17 22:49:13 UTC (rev 122882)
@@ -169,14 +169,20 @@
 void SVGDocumentExtensions::removeAllAnimationElementsFromTarget(SVGElement* targetElement)
 {
     ASSERT(targetElement);
-    HashSet<SVGSMILElement*>* animationElementsForTarget = m_animatedElements.take(targetElement);
-    if (!animationElementsForTarget)
+    HashMap<SVGElement*, HashSet<SVGSMILElement*>* >::iterator it = m_animatedElements.find(targetElement);
+    if (it == m_animatedElements.end())
         return;
-    HashSet<SVGSMILElement*>::iterator it = animationElementsForTarget->begin();
+
+    HashSet<SVGSMILElement*>* animationElementsForTarget = it->second;
+    Vector<SVGSMILElement*> toBeReset;
+
     HashSet<SVGSMILElement*>::iterator end = animationElementsForTarget->end();
-    for (; it != end; ++it)
-        (*it)->resetTargetElement();
-    delete animationElementsForTarget;
+    for (HashSet<SVGSMILElement*>::iterator it = animationElementsForTarget->begin(); it != end; ++it)
+        toBeReset.append(*it);
+
+    Vector<SVGSMILElement*>::iterator vectorEnd = toBeReset.end();
+    for (Vector<SVGSMILElement*>::iterator vectorIt = toBeReset.begin(); vectorIt != vectorEnd; ++vectorIt)
+        (*vectorIt)->resetTargetElement();
 }
 
 // FIXME: Callers should probably use ScriptController::eventHandlerLineNumber()

Modified: branches/chromium/1180/Source/WebCore/svg/animation/SVGSMILElement.cpp (122881 => 122882)


--- branches/chromium/1180/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-07-17 22:34:34 UTC (rev 122881)
+++ branches/chromium/1180/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-07-17 22:49:13 UTC (rev 122882)
@@ -235,11 +235,8 @@
         disconnectConditions();
 
         // Clear target now, because disconnectConditions calls targetElement() which will recreate the target if we removed it sooner. 
-        if (m_targetElement) {
-            document()->accessSVGExtensions()->removeAnimationElementFromTarget(this, m_targetElement);
-            targetElementWillChange(m_targetElement, 0);
-            m_targetElement = 0;
-        }
+        if (m_targetElement)
+            resetTargetElement();
 
         m_attributeName = anyQName();
     }
@@ -584,6 +581,7 @@
 
 void SVGSMILElement::resetTargetElement()
 {
+    document()->accessSVGExtensions()->removeAnimationElementFromTarget(this, m_targetElement);
     targetElementWillChange(m_targetElement, 0);
     m_targetElement = 0;
     animationAttributeChanged();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to