WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2006 20:30:20 +0000 (20:30 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2006 20:30:20 +0000 (20:30 +0000)
2006-05-26  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Geoff.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9127
        Invoke capturing event listeners when AT_TARGET

        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::handleLocalEvents):
        Invoke capturing event listeners for the AT_TARGET phase. This violates the
        DOM spec but it's what Mozilla does.

LayoutTests:

2006-05-26  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Geoff.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9127
        Invoke capturing event listeners when AT_TARGET

        * dom/html/level2/events/dispatchEvent09-expected.txt:
        * dom/xhtml/level2/events/dispatchEvent09-expected.txt:
        These fail now.

        * fast/dom/capturing-event-listeners-expected.txt: Added.
        * fast/dom/capturing-event-listeners.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/dom/html/level2/events/dispatchEvent09-expected.txt
LayoutTests/dom/xhtml/level2/events/dispatchEvent09-expected.txt
LayoutTests/fast/dom/capturing-event-listeners-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/capturing-event-listeners.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/EventTargetNode.cpp

index 5c925c8865ace1a400bd42af4e2b869660cd11d3..5eea9c735c59797350ac5693ed55101163df55b4 100644 (file)
@@ -1,3 +1,17 @@
+2006-05-26  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Geoff.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=9127
+        Invoke capturing event listeners when AT_TARGET
+
+        * dom/html/level2/events/dispatchEvent09-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent09-expected.txt:
+        These fail now.
+        
+        * fast/dom/capturing-event-listeners-expected.txt: Added.
+        * fast/dom/capturing-event-listeners.html: Added.
+
 2006-05-25  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by hyatt.  Landed by eseidel.
index f79cf2b99d414891dd3fa1c0ca74515d16fb53fc..413ef99d7d9de43a6653e3ccbe410cecad83c71d 100644 (file)
@@ -1,2 +1,3 @@
-Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent09
-Status:        Success
+Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent09     
+Status:        failure
+Detail:        atCount: assertEquals failed, actual 1, expected 0.
index e2df0000e50a7fd680a340760fccaad38be372cc..f8df5178cf6c66f6b904e898d89d1b747d8aa853 100644 (file)
@@ -1,2 +1,3 @@
 Test   http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent09
-Status Success
+Status failure
+Message        atCount: assertEquals failed, actual 1, expected 0.
diff --git a/LayoutTests/fast/dom/capturing-event-listeners-expected.txt b/LayoutTests/fast/dom/capturing-event-listeners-expected.txt
new file mode 100644 (file)
index 0000000..179fb52
--- /dev/null
@@ -0,0 +1,3 @@
+This tests that capturing event listeners will be invoked by events dispatched to the target which it has been added to. 
+SUCCESS
+
diff --git a/LayoutTests/fast/dom/capturing-event-listeners.html b/LayoutTests/fast/dom/capturing-event-listeners.html
new file mode 100644 (file)
index 0000000..6742db1
--- /dev/null
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script>
+function debug(str) {
+       var d = document.getElementById('console');
+       d.appendChild(document.createTextNode(str + '\n'));
+}
+
+function handler(event) {
+    success = true;
+}
+
+function runTests() {
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    
+    var b = document.getElementById('theButton')
+    b.addEventListener('click', handler, true);
+    
+    success = false;
+    b.click();
+    if (success)
+        debug("SUCCESS")
+    else
+        debug("FAILURE: event handler wasn't called")
+}
+
+</script>
+</head>
+<body onload="runTests();">
+This tests that capturing event listeners will be invoked by events dispatched to the target which it has been added to.
+<input id="theButton" type="button">
+<pre id="console">
+</pre>
+</body>
+</html>
index 5efed57bd8384206cf38d5f03d3bfe2a2d8a76fb..b2c0b74c8f34ad1cc7a0d55e2540885f2a43080e 100644 (file)
@@ -1,3 +1,15 @@
+2006-05-26  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Geoff.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=9127
+        Invoke capturing event listeners when AT_TARGET
+        
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::handleLocalEvents):    
+        Invoke capturing event listeners for the AT_TARGET phase. This violates the
+        DOM spec but it's what Mozilla does.
+        
 2006-05-26  David Harrison  <harrison@apple.com>
 
         Reviewed by John Sullivan.
@@ -67,6 +79,7 @@
         (WebCore::createUnorderedListElement):
         * editing/htmlediting.h:
 
+>>>>>>> .r14614
 2006-05-26  Steve Falkenburg  <sfalken@apple.com>
 
         Reviewed by adele.
index 9260107b0d07aa9314bbae649b7a9779af9b273a..fe831f1428f7520960261467266a30a03af377e3 100644 (file)
@@ -195,6 +195,11 @@ bool EventTargetNode::dispatchGenericEvent(PassRefPtr<Event> e, ExceptionCode&,
     if (!evt->propagationStopped()) {
         evt->setEventPhase(Event::AT_TARGET);
         evt->setCurrentTarget(it.current());
+        
+        // We do want capturing event listeners to be invoked here, even though
+        // that violates the specification since Mozilla does it.
+        EventTargetNodeCast(it.current())->handleLocalEvents(evt.get(), true);
+        
         EventTargetNodeCast(it.current())->handleLocalEvents(evt.get(), false);
     }
     --it;