WebKit should unset event propagation flags after dispatch
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2016 15:36:55 +0000 (15:36 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2016 15:36:55 +0000 (15:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160853

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

* web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation-expected.txt:
* web-platform-tests/dom/events/Event-initEvent-expected.txt:
* web-platform-tests/dom/events/Event-propagation-expected.txt:

Source/WebCore:

WebKit should unset event propagation flags after dispatch to reflect
the latest DOM specification:
- https://github.com/whatwg/dom/commit/806d4aab584f6fc38c21f8e088b51b8ba3e27e20

No new tests, rebaselined existing tests.

* dom/Event.h:
(WebCore::Event::resetPropagationFlags):
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
* dom/EventTarget.cpp:
(WebCore::EventTarget::dispatchEvent):

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

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Event.h
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/EventTarget.cpp

index 853e441..22239b3 100644 (file)
@@ -1,3 +1,16 @@
+2016-08-19  Chris Dumez  <cdumez@apple.com>
+
+        WebKit should unset event propagation flags after dispatch
+        https://bugs.webkit.org/show_bug.cgi?id=160853
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline several W3C tests now that more checks are passing.
+
+        * web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation-expected.txt:
+        * web-platform-tests/dom/events/Event-initEvent-expected.txt:
+        * web-platform-tests/dom/events/Event-propagation-expected.txt:
+
 2016-08-18  Chris Dumez  <cdumez@apple.com>
 
         Move prefix / namespaceURI / localName attributes from Node to Attr / Element
index 8ccecd0..af04247 100644 (file)
@@ -1,7 +1,7 @@
 
 PASS Newly-created Event 
-FAIL After stopPropagation() assert_equals: Propagation flag after first dispatch expected true but got false
+PASS After stopPropagation() 
 PASS Reinitialized after stopPropagation() 
-FAIL After stopImmediatePropagation() assert_equals: Propagation flag after first dispatch expected true but got false
+PASS After stopImmediatePropagation() 
 PASS Reinitialized after stopImmediatePropagation() 
 
index ee54a2e..cef8da6 100644 (file)
@@ -1,3 +1,23 @@
+2016-08-19  Chris Dumez  <cdumez@apple.com>
+
+        WebKit should unset event propagation flags after dispatch
+        https://bugs.webkit.org/show_bug.cgi?id=160853
+
+        Reviewed by Ryosuke Niwa.
+
+        WebKit should unset event propagation flags after dispatch to reflect
+        the latest DOM specification:
+        - https://github.com/whatwg/dom/commit/806d4aab584f6fc38c21f8e088b51b8ba3e27e20
+
+        No new tests, rebaselined existing tests.
+
+        * dom/Event.h:
+        (WebCore::Event::resetPropagationFlags):
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchEvent):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::dispatchEvent):
+
 2016-08-18  Daniel Bates  <dabates@apple.com>
 
         Ld warns of non-existent PrivateFrameworks directory when building WebKit with the public iOS 9.3 SDK
index 054ba35..e99da50 100644 (file)
@@ -166,6 +166,8 @@ public:
     bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
     bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
 
+    void resetPropagationFlags();
+
     bool defaultPrevented() const { return m_defaultPrevented; }
     void preventDefault()
     {
@@ -227,6 +229,12 @@ private:
     RefPtr<Event> m_underlyingEvent;
 };
 
+inline void Event::resetPropagationFlags()
+{
+    m_propagationStopped = false;
+    m_immediatePropagationStopped = false;
+}
+
 } // namespace WebCore
 
 #define SPECIALIZE_TYPE_TRAITS_EVENT(ToValueTypeName) \
index 7088017..5d06a00 100644 (file)
@@ -186,7 +186,8 @@ bool EventDispatcher::dispatchEvent(Node* origin, Event& event)
 
     event.setTarget(EventPath::eventTargetRespectingTargetRules(*node));
     event.setCurrentTarget(nullptr);
-    event.setEventPhase(0);
+    event.resetPropagationFlags();
+    event.setEventPhase(Event::NONE);
 
     if (clickHandlingState.stateful)
         downcast<HTMLInputElement>(*node).didDispatchClickEvent(event, clickHandlingState);
index bae3ec2..f6555ee 100644 (file)
@@ -162,7 +162,8 @@ bool EventTarget::dispatchEvent(Event& event)
     event.setCurrentTarget(this);
     event.setEventPhase(Event::AT_TARGET);
     bool defaultPrevented = fireEventListeners(event);
-    event.setEventPhase(0);
+    event.resetPropagationFlags();
+    event.setEventPhase(Event::NONE);
     return defaultPrevented;
 }