Title: [210254] trunk
Revision
210254
Author
[email protected]
Date
2017-01-03 15:51:39 -0800 (Tue, 03 Jan 2017)

Log Message

Make setting Event's cancelBubble to false a no-op
https://bugs.webkit.org/show_bug.cgi?id=166018

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Merge https://github.com/w3c/web-platform-tests/pull/4304 to extend / fix
test coverage.

* web-platform-tests/dom/events/Event-cancelBubble-expected.txt: Added.
* web-platform-tests/dom/events/Event-cancelBubble.html: Added.
* web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt: Added.
* web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html: Added.
* web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt: Added.
* web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html: Added.
* web-platform-tests/dom/events/Event-initEvent.html:
* web-platform-tests/dom/events/Event-propagation-expected.txt:
* web-platform-tests/dom/events/Event-propagation.html:
* web-platform-tests/dom/events/w3c-import.log:

Source/WebCore:

Align behavior of Event.cancelBubble with the latest DOM specification:
- https://dom.spec.whatwg.org/#dom-event-cancelbubble

Setting it to true sets the 'stop propagation' flag to true and setting
it to false is now a no-op.

Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
       imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
       imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html

* Modules/indexeddb/IDBEventDispatcher.cpp:
(WebCore::IDBEventDispatcher::dispatch):
* dom/Event.h:
(WebCore::Event::cancelBubble):
(WebCore::Event::setCancelBubble):
* dom/EventDispatcher.cpp:
(WebCore::dispatchEventInDOM):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (210253 => 210254)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-03 23:51:39 UTC (rev 210254)
@@ -1,3 +1,24 @@
+2017-01-03  Chris Dumez  <[email protected]>
+
+        Make setting Event's cancelBubble to false a no-op
+        https://bugs.webkit.org/show_bug.cgi?id=166018
+
+        Reviewed by Ryosuke Niwa.
+
+        Merge https://github.com/w3c/web-platform-tests/pull/4304 to extend / fix
+        test coverage.
+
+        * web-platform-tests/dom/events/Event-cancelBubble-expected.txt: Added.
+        * web-platform-tests/dom/events/Event-cancelBubble.html: Added.
+        * web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt: Added.
+        * web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html: Added.
+        * web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt: Added.
+        * web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html: Added.
+        * web-platform-tests/dom/events/Event-initEvent.html:
+        * web-platform-tests/dom/events/Event-propagation-expected.txt:
+        * web-platform-tests/dom/events/Event-propagation.html:
+        * web-platform-tests/dom/events/w3c-import.log:
+
 2016-12-20  Alex Christensen  <[email protected]>
 
         Remove initEvent quirk

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble-expected.txt (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble-expected.txt	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,10 @@
+
+PASS cancelBubble must be false when an event is initially created. 
+PASS Initializing an event must set cancelBubble to false. 
+PASS stopPropagation() must set cancelBubble to true. 
+PASS stopImmediatePropagation() must set cancelBubble to true. 
+PASS Event.cancelBubble=false must have no effect. 
+PASS Event.cancelBubble=false must have no effect during event propagation. 
+PASS cancelBubble must be false after an event has been dispatched. 
+PASS Event.cancelBubble=true must set the stop propagation flag. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Event.cancelBubble</title>
+  <link rel="author" title="Chris Rebert" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="dom">
+  <script src=""
+  <script src=""
+</head>
+<body>
+  <div id="outer">
+    <div id="middle">
+      <div id="inner"></div>
+    </div>
+  </div>
+  <script>
+test(function () {
+  // See https://dom.spec.whatwg.org/#stop-propagation-flag
+  var e = document.createEvent('Event');
+  assert_false(e.cancelBubble, "cancelBubble must be false after event creation.");
+}, "cancelBubble must be false when an event is initially created.");
+
+test(function () {
+  // See https://dom.spec.whatwg.org/#concept-event-initialize
+
+  // Event which bubbles.
+  var _one_ = document.createEvent('Event');
+  one.cancelBubble = true;
+  one.initEvent('foo', true/*bubbles*/, false/*cancelable*/);
+  assert_false(one.cancelBubble, "initEvent() must set cancelBubble to false. [bubbles=true]");
+  // Re-initialization.
+  one.cancelBubble = true;
+  one.initEvent('foo', true/*bubbles*/, false/*cancelable*/);
+  assert_false(one.cancelBubble, "2nd initEvent() call must set cancelBubble to false. [bubbles=true]");
+
+  // Event which doesn't bubble.
+  var two = document.createEvent('Event');
+  two.cancelBubble = true;
+  two.initEvent('foo', false/*bubbles*/, false/*cancelable*/);
+  assert_false(two.cancelBubble, "initEvent() must set cancelBubble to false. [bubbles=false]");
+  // Re-initialization.
+  two.cancelBubble = true;
+  two.initEvent('foo', false/*bubbles*/, false/*cancelable*/);
+  assert_false(two.cancelBubble, "2nd initEvent() call must set cancelBubble to false. [bubbles=false]");
+}, "Initializing an event must set cancelBubble to false.");
+
+test(function () {
+  // See https://dom.spec.whatwg.org/#dom-event-stoppropagation
+  var e = document.createEvent('Event');
+  e.stopPropagation();
+  assert_true(e.cancelBubble, "stopPropagation() must set cancelBubble to true.");
+}, "stopPropagation() must set cancelBubble to true.");
+
+test(function () {
+  // See https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
+  var e = document.createEvent('Event');
+  e.stopImmediatePropagation();
+  assert_true(e.cancelBubble, "stopImmediatePropagation() must set cancelBubble to true.");
+}, "stopImmediatePropagation() must set cancelBubble to true.");
+
+test(function () {
+  var _one_ = document.createEvent('Event');
+  one.stopPropagation();
+  one.cancelBubble = false;
+  assert_true(one.cancelBubble, "cancelBubble must still be true after attempting to set it to false.");
+}, "Event.cancelBubble=false must have no effect.");
+
+test(function (t) {
+  var outer = document.getElementById('outer');
+  var middle = document.getElementById('middle');
+  var inner = document.getElementById('inner');
+
+  outer.addEventListener('barbaz', t.step_func(function () {
+    assert_unreached("Setting Event.cancelBubble=false after setting Event.cancelBubble=true should have no effect.");
+  }), false/*useCapture*/);
+
+  middle.addEventListener('barbaz', function (e) {
+    e.cancelBubble = true;// Stop propagation.
+    e.cancelBubble = false;// Should be a no-op.
+  }, false/*useCapture*/);
+
+  var barbazEvent = document.createEvent('Event');
+  barbazEvent.initEvent('barbaz', true/*bubbles*/, false/*cancelable*/);
+  inner.dispatchEvent(barbazEvent);
+}, "Event.cancelBubble=false must have no effect during event propagation.");
+
+test(function () {
+  // See https://dom.spec.whatwg.org/#concept-event-dispatch
+  // "14. Unset event’s [...] stop propagation flag,"
+  var e = document.createEvent('Event');
+  e.initEvent('foobar', true/*bubbles*/, true/*cancelable*/);
+  document.body.addEventListener('foobar', function listener(e) {
+    e.stopPropagation();
+  });
+  document.body.dispatchEvent(e);
+  assert_false(e.cancelBubble, "cancelBubble must be false after an event has been dispatched.");
+}, "cancelBubble must be false after an event has been dispatched.");
+
+test(function (t) {
+  var outer = document.getElementById('outer');
+  var middle = document.getElementById('middle');
+  var inner = document.getElementById('inner');
+
+  var propagationStopper = function (e) {
+    e.cancelBubble = true;
+  };
+
+  // Bubble phase
+  middle.addEventListener('bar', propagationStopper, false/*useCapture*/);
+  outer.addEventListener('bar', t.step_func(function listenerOne() {
+    assert_unreached("Setting cancelBubble=true should stop the event from bubbling further.");
+  }), false/*useCapture*/);
+
+  var barEvent = document.createEvent('Event');
+  barEvent.initEvent('bar', true/*bubbles*/, false/*cancelable*/);
+  inner.dispatchEvent(barEvent);
+
+  // Capture phase
+  outer.addEventListener('qux', propagationStopper, true/*useCapture*/);
+  middle.addEventListener('qux', t.step_func(function listenerTwo() {
+    assert_unreached("Setting cancelBubble=true should stop the event from propagating further, including during the Capture Phase.");
+  }), true/*useCapture*/);
+
+  var quxEvent = document.createEvent('Event');
+  quxEvent.initEvent('qux', false/*bubbles*/, false/*cancelable*/);
+  inner.dispatchEvent(quxEvent);
+}, "Event.cancelBubble=true must set the stop propagation flag.");
+  </script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,3 @@
+
+PASS Setting cancelBubble=true prior to dispatchEvent() 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Setting cancelBubble=true prior to dispatchEvent()</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="log"></div>
+
+<table id="table" border="1" style="display: none">
+    <tbody id="table-body">
+    <tr id="table-row">
+        <td id="table-cell">Shady Grove</td>
+        <td>Aeolian</td>
+    </tr>
+    <tr id="parent">
+        <td id="target">Over the river, Charlie</td>
+        <td>Dorian</td>
+    </tr>
+    </tbody>
+</table>
+
+<script>
+test(function() {
+    var event = "foo";
+    var target = document.getElementById("target");
+    var parent = document.getElementById("parent");
+    var tbody = document.getElementById("table-body");
+    var table = document.getElementById("table");
+    var body = document.body;
+    var html = document.documentElement;
+    var current_targets = [window, document, html, body, table, tbody, parent, target];
+    var expected_targets = [];
+    var actual_targets = [];
+    var expected_phases = [];
+    var actual_phases = [];
+
+    var test_event = function(evt) {
+        actual_targets.push(evt.currentTarget);
+        actual_phases.push(evt.eventPhase);
+    };
+
+    for (var i = 0; i < current_targets.length; ++i) {
+        current_targets[i].addEventListener(event, test_event, true);
+        current_targets[i].addEventListener(event, test_event, false);
+    }
+
+    var evt = document.createEvent("Event");
+    evt.initEvent(event, true, true);
+    evt.cancelBubble = true;
+    target.dispatchEvent(evt);
+
+    assert_array_equals(actual_targets, expected_targets, "actual_targets");
+    assert_array_equals(actual_phases, expected_phases, "actual_phases");
+});
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,3 @@
+
+PASS Multiple dispatchEvent() and cancelBubble 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html (0 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html	2017-01-03 23:51:39 UTC (rev 210254)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Multiple dispatchEvent() and cancelBubble</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id=log></div>
+
+<div id="parent" style="display: none">
+    <input id="target" type="hidden" value=""/>
+</div>
+
+<script>
+test(function() {
+    var event_type = "foo";
+    var target = document.getElementById("target");
+    var parent = document.getElementById("parent");
+    var actual_result;
+    var test_event = function(evt) {
+        actual_result.push(evt.currentTarget);
+
+        if (parent == evt.currentTarget) {
+            evt.cancelBubble = true;
+        }
+    };
+
+    var evt = document.createEvent("Event");
+    evt.initEvent(event_type, true, true);
+
+    target.addEventListener(event_type, test_event, false);
+    parent.addEventListener(event_type, test_event, false);
+    document.addEventListener(event_type, test_event, false);
+    window.addEventListener(event_type, test_event, false);
+
+    actual_result = [];
+    target.dispatchEvent(evt);
+    assert_array_equals(actual_result, [target, parent]);
+
+    actual_result = [];
+    parent.dispatchEvent(evt);
+    assert_array_equals(actual_result, [parent]);
+
+    actual_result = [];
+    document.dispatchEvent(evt);
+    assert_array_equals(actual_result, [document, window]);
+});
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-initEvent.html (210253 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-initEvent.html	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-initEvent.html	2017-01-03 23:51:39 UTC (rev 210254)
@@ -85,6 +85,7 @@
   var target = document.createElement("div")
   var called = false
   target.addEventListener("type", function() { called = true }, false)
+  assert_false(e.cancelBubble, "cancelBubble must be false")
   assert_true(target.dispatchEvent(e), "dispatchEvent must return true")
   assert_true(called, "Listener must be called")
 }, "Calling initEvent must unset the stop propagation flag.")

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation-expected.txt (210253 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation-expected.txt	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation-expected.txt	2017-01-03 23:51:39 UTC (rev 210254)
@@ -4,4 +4,6 @@
 PASS Reinitialized after stopPropagation() 
 PASS After stopImmediatePropagation() 
 PASS Reinitialized after stopImmediatePropagation() 
+PASS After cancelBubble=true 
+PASS Reinitialized after cancelBubble=true 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation.html (210253 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation.html	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation.html	2017-01-03 23:51:39 UTC (rev 210254)
@@ -38,4 +38,11 @@
 testPropagationFlag(ev, false, "After stopImmediatePropagation()");
 ev.initEvent("foo", true, false);
 testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");
+
+var ev = document.createEvent("Event");
+ev.initEvent("foo", true, false);
+ev.cancelBubble = true;
+testPropagationFlag(ev, false, "After cancelBubble=true");
+ev.initEvent("foo", true, false);
+testPropagationFlag(ev, true, "Reinitialized after cancelBubble=true");
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log (210253 => 210254)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log	2017-01-03 23:51:39 UTC (rev 210254)
@@ -18,15 +18,18 @@
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-once.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-passive.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/CustomEvent.html
+/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-constants.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-constructors.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-defaultPrevented-after-dispatch.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-defaultPrevented.html
+/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-click.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-detached-click.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-handlers-changed.html
+/LayoutTests/imported/w3c/web-platform-tests/dom/events/dom/events/Event-dispatch-multiple-cancelBubble.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-omitted-capture.html
 /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-order.html

Modified: trunk/Source/WebCore/ChangeLog (210253 => 210254)


--- trunk/Source/WebCore/ChangeLog	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/Source/WebCore/ChangeLog	2017-01-03 23:51:39 UTC (rev 210254)
@@ -1,3 +1,28 @@
+2017-01-03  Chris Dumez  <[email protected]>
+
+        Make setting Event's cancelBubble to false a no-op
+        https://bugs.webkit.org/show_bug.cgi?id=166018
+
+        Reviewed by Ryosuke Niwa.
+
+        Align behavior of Event.cancelBubble with the latest DOM specification:
+        - https://dom.spec.whatwg.org/#dom-event-cancelbubble
+
+        Setting it to true sets the 'stop propagation' flag to true and setting
+        it to false is now a no-op.
+
+        Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
+               imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
+               imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html
+
+        * Modules/indexeddb/IDBEventDispatcher.cpp:
+        (WebCore::IDBEventDispatcher::dispatch):
+        * dom/Event.h:
+        (WebCore::Event::cancelBubble):
+        (WebCore::Event::setCancelBubble):
+        * dom/EventDispatcher.cpp:
+        (WebCore::dispatchEventInDOM):
+
 2017-01-03  Jer Noble  <[email protected]>
 
         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBEventDispatcher.cpp (210253 => 210254)


--- trunk/Source/WebCore/Modules/indexeddb/IDBEventDispatcher.cpp	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBEventDispatcher.cpp	2017-01-03 23:51:39 UTC (rev 210254)
@@ -52,7 +52,7 @@
     event.setEventPhase(Event::AT_TARGET);
     event.setCurrentTarget(eventTargets[0].get());
     eventTargets[0]->fireEventListeners(event);
-    if (event.propagationStopped() || !event.bubbles() || event.cancelBubble())
+    if (event.propagationStopped() || !event.bubbles())
         goto doneDispatching;
 
     event.setEventPhase(Event::BUBBLING_PHASE);
@@ -59,7 +59,7 @@
     for (size_t i = 1; i < size; ++i) { // Don't do the first element.
         event.setCurrentTarget(eventTargets[i].get());
         eventTargets[i]->fireEventListeners(event);
-        if (event.propagationStopped() || event.cancelBubble())
+        if (event.propagationStopped())
             goto doneDispatching;
     }
 

Modified: trunk/Source/WebCore/dom/Event.h (210253 => 210254)


--- trunk/Source/WebCore/dom/Event.h	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/Source/WebCore/dom/Event.h	2017-01-03 23:51:39 UTC (rev 210254)
@@ -176,8 +176,8 @@
 
     void setInPassiveListener(bool value) { m_isExecutingPassiveEventListener = value; }
 
-    bool cancelBubble() const { return m_cancelBubble; }
-    void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
+    bool cancelBubble() const { return propagationStopped(); }
+    void setCancelBubble(bool);
 
     Event* underlyingEvent() const { return m_underlyingEvent.get(); }
     void setUnderlyingEvent(Event*);
@@ -207,7 +207,6 @@
     bool m_immediatePropagationStopped { false };
     bool m_defaultPrevented { false };
     bool m_defaultHandled { false };
-    bool m_cancelBubble { false };
     bool m_isTrusted { false };
     bool m_isExecutingPassiveEventListener { false };
 
@@ -226,6 +225,12 @@
     m_immediatePropagationStopped = false;
 }
 
+inline void Event::setCancelBubble(bool cancel)
+{
+    if (cancel)
+        m_propagationStopped = true;
+}
+
 } // namespace WebCore
 
 #define SPECIALIZE_TYPE_TRAITS_EVENT(ToValueTypeName) \

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (210253 => 210254)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2017-01-03 23:18:45 UTC (rev 210253)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2017-01-03 23:51:39 UTC (rev 210254)
@@ -97,7 +97,7 @@
         const EventContext& eventContext = path.contextAt(i);
         if (eventContext.currentTargetSameAsTarget())
             event.setEventPhase(Event::AT_TARGET);
-        else if (event.bubbles() && !event.cancelBubble())
+        else if (event.bubbles())
             event.setEventPhase(Event::BUBBLING_PHASE);
         else
             continue;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to