2011-01-26 Justin Schuh <jschuh@chromium.org>
authorjschuh@chromium.org <jschuh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jan 2011 20:42:28 +0000 (20:42 +0000)
committerjschuh@chromium.org <jschuh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jan 2011 20:42:28 +0000 (20:42 +0000)
        Reviewed by Adam Barth.

        Make fireEventsAndUpdateStyle use stack local vectors.
        https://bugs.webkit.org/show_bug.cgi?id=46760

        Test: animations/animation-add-events-in-handler.html

        * page/animation/AnimationController.cpp:
        (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle):
2011-01-26  Justin Schuh  <jschuh@chromium.org>

        Reviewed by Adam Barth.

        Make fireEventsAndUpdateStyle use stack local vectors.
        https://bugs.webkit.org/show_bug.cgi?id=46760

        * animations/animation-add-events-in-handler-expected.txt: Added.
        * animations/animation-add-events-in-handler.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76708 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/animations/animation-add-events-in-handler-expected.txt [new file with mode: 0644]
LayoutTests/animations/animation-add-events-in-handler.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/animation/AnimationController.cpp

index dddb964ba933412acdff1a912e4b38b94c5c01a3..500de8a1445643ca26d850007a10f56222a05249 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  Justin Schuh  <jschuh@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Make fireEventsAndUpdateStyle use stack local vectors.   
+        https://bugs.webkit.org/show_bug.cgi?id=46760
+
+        * animations/animation-add-events-in-handler-expected.txt: Added.
+        * animations/animation-add-events-in-handler.html: Added.
+
 2011-01-26  Tony Chang  <tony@chromium.org>
 
         Unreviewed, marking fast/overflow/overflow-rtl-vertical.html as
 2011-01-26  Tony Chang  <tony@chromium.org>
 
         Unreviewed, marking fast/overflow/overflow-rtl-vertical.html as
diff --git a/LayoutTests/animations/animation-add-events-in-handler-expected.txt b/LayoutTests/animations/animation-add-events-in-handler-expected.txt
new file mode 100644 (file)
index 0000000..1dd9c0b
--- /dev/null
@@ -0,0 +1 @@
+PASS: Adding animation events in the handler did not crash.
diff --git a/LayoutTests/animations/animation-add-events-in-handler.html b/LayoutTests/animations/animation-add-events-in-handler.html
new file mode 100644 (file)
index 0000000..a2c14eb
--- /dev/null
@@ -0,0 +1,58 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function touchElement(evt) {
+    getComputedStyle(evt.srcElement.firstElementChild)['-webkit-animation-duration'];
+    evt.srcElement.firstElementChild.style.display = 'block';
+    total++;
+    if (total == 500) {
+        document.getElementById("results").innerHTML = "PASS: Adding animation events in the handler did not crash.";
+        if (window.layoutTestController)
+          layoutTestController.notifyDone();
+    }
+}
+
+window.onload = function() {
+    total = 0;
+    var padding = document.getElementsByClassName("padding");
+    for (var i = 0; i < padding.length; i++)
+        padding[i].addEventListener('webkitAnimationIteration', touchElement, false, false);
+};
+</script>
+<style>
+@-webkit-keyframes keyframes {
+    from { }
+}
+
+.crash {
+    -webkit-animation-name: keyframes;
+}
+
+.padding {
+    -webkit-animation-name: keyframes;
+    -webkit-animation-iteration-count: infinite;
+    -webkit-animation-duration: 0.001;
+}
+</style>
+<div id="results">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<div class="padding">
+<img class="crash">
index e52126a521e2998ebe612e3f9f220bf9af8bb195..1a8123682f1e2e76def8717f1cc9d846ca95c607 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-26  Justin Schuh  <jschuh@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Make fireEventsAndUpdateStyle use stack local vectors. 
+        https://bugs.webkit.org/show_bug.cgi?id=46760
+
+        Test: animations/animation-add-events-in-handler.html
+
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle):
+
 2011-01-26  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Adam Barth.
 2011-01-26  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Adam Barth.
index e1281dd18a7654c3ee625137a4a5c7873d4dfefa..dcdea0301125742c3748b80fb487c78aacf89099 100644 (file)
@@ -145,16 +145,16 @@ void AnimationControllerPrivate::fireEventsAndUpdateStyle()
     bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
     
     // fire all the events
     bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
     
     // fire all the events
-    Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end();
-    for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
+    Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch;
+    m_eventsToDispatch.clear();
+    Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = eventsToDispatch.end();
+    for (Vector<EventToDispatch>::const_iterator it = eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
         if (it->eventType == eventNames().webkitTransitionEndEvent)
             it->element->dispatchEvent(WebKitTransitionEvent::create(it->eventType, it->name, it->elapsedTime));
         else
             it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
     }
     
         if (it->eventType == eventNames().webkitTransitionEndEvent)
             it->element->dispatchEvent(WebKitTransitionEvent::create(it->eventType, it->name, it->elapsedTime));
         else
             it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
     }
     
-    m_eventsToDispatch.clear();
-    
     // call setChanged on all the elements
     Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
     for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)
     // call setChanged on all the elements
     Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
     for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)