<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214819] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214819">214819</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2017-04-03 10:51:29 -0700 (Mon, 03 Apr 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Clean up touch event handler registration when moving nodes between documents
https://bugs.webkit.org/show_bug.cgi?id=170384
rdar://problem/30816694
Reviewed by Chris Dumez.
Source/WebCore:
Make sure that Node::didMoveToNewDocument() does the correct unregistration on the
old document, and registration on the new document for nodes with touch event listeners,
and gesture event listeners. Touch "handler" nodes (those for overflow and sliders) are
already correctly moved via renderer-related teardown.
Add assertions that fire when removal was not complete.
Use references in more places.
Tests: fast/events/touch/ios/gesture-node-move-between-documents.html
fast/events/touch/ios/overflow-node-move-between-documents.html
fast/events/touch/ios/slider-node-move-between-documents.html
fast/events/touch/ios/touch-node-move-between-documents.html
* dom/EventNames.h:
(WebCore::EventNames::gestureEventNames):
* dom/Node.cpp:
(WebCore::Node::willBeDeletedFrom):
(WebCore::Node::didMoveToNewDocument):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::registerForTouchEvents):
(WebCore::SliderThumbElement::unregisterForTouchEvents):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::registerAsTouchEventListenerForScrolling):
(WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling):
LayoutTests:
Tests for moving nodes with various listener/handler combinations between documents.
* fast/events/touch/ios/gesture-node-move-between-documents-expected.txt: Added.
* fast/events/touch/ios/gesture-node-move-between-documents.html: Added.
* fast/events/touch/ios/overflow-node-move-between-documents-expected.txt: Added.
* fast/events/touch/ios/overflow-node-move-between-documents.html: Added.
* fast/events/touch/ios/slider-node-move-between-documents-expected.txt: Added.
* fast/events/touch/ios/slider-node-move-between-documents.html: Added.
* fast/events/touch/ios/touch-node-move-between-documents-expected.txt: Added.
* fast/events/touch/ios/touch-node-move-between-documents.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomEventNamesh">trunk/Source/WebCore/dom/EventNames.h</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowSliderThumbElementcpp">trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentsexpectedtxt">trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentshtml">trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentsexpectedtxt">trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentshtml">trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiosslidernodemovebetweendocumentsexpectedtxt">trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiosslidernodemovebetweendocumentshtml">trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiostouchnodemovebetweendocumentsexpectedtxt">trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiostouchnodemovebetweendocumentshtml">trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/LayoutTests/ChangeLog        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-04-01 Simon Fraser <simon.fraser@apple.com>
+
+ Clean up touch event handler registration when moving nodes between documents
+ https://bugs.webkit.org/show_bug.cgi?id=170384
+ rdar://problem/30816694
+
+ Reviewed by Chris Dumez.
+
+ Tests for moving nodes with various listener/handler combinations between documents.
+
+ * fast/events/touch/ios/gesture-node-move-between-documents-expected.txt: Added.
+ * fast/events/touch/ios/gesture-node-move-between-documents.html: Added.
+ * fast/events/touch/ios/overflow-node-move-between-documents-expected.txt: Added.
+ * fast/events/touch/ios/overflow-node-move-between-documents.html: Added.
+ * fast/events/touch/ios/slider-node-move-between-documents-expected.txt: Added.
+ * fast/events/touch/ios/slider-node-move-between-documents.html: Added.
+ * fast/events/touch/ios/touch-node-move-between-documents-expected.txt: Added.
+ * fast/events/touch/ios/touch-node-move-between-documents.html: Added.
+
</ins><span class="cx"> 2017-04-03 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [SOUP] URI Fragment is lost after redirect
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src="../../../../resources/js-test-pre.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ var iframe = document.querySelector('iframe');
+
+ var node = iframe.contentDocument.createElement('div');
+ node.addEventListener('gesturestart', function() { }, false);
+ node.addEventListener('gestureend', function() { }, false);
+ node.textContent = 'test node';
+ iframe.contentDocument.body.appendChild(node);
+
+ document.body.appendChild(node);
+
+ node.remove();
+
+ window.setTimeout(removeFrameAndGC, 0)
+ }
+
+ function removeFrameAndGC()
+ {
+ var iframe = document.querySelector('iframe');
+ iframe.remove();
+ iframe = undefined;
+
+ gc();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ This test should not crash or assert.
+ <iframe srcdoc="<body></body>"></iframe>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 100px;
+ width: 100px;
+ overflow: scroll;
+ border: 1px solid black;
+ }
+
+ .contents {
+ height: 400px;
+ background-color: silver;
+ }
+ </style>
+ <script src="../../../../resources/js-test-pre.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ var iframe = document.querySelector('iframe');
+
+ var node = iframe.contentDocument.createElement('div');
+ node.className = 'container';
+ node.addEventListener('touchstart', function() { }, false);
+ node.addEventListener('gesturestart', function() { }, false);
+
+ var contents = iframe.contentDocument.createElement('div');
+ contents.className = 'contents';
+ node.appendChild(contents);
+
+ iframe.contentDocument.body.appendChild(node);
+ iframe.contentDocument.body.offsetWidth;
+
+ document.body.appendChild(node);
+ document.body.offsetWidth;
+
+ node.remove();
+
+ window.setTimeout(removeFrameAndGC, 0)
+ }
+
+ function removeFrameAndGC()
+ {
+ var iframe = document.querySelector('iframe');
+ iframe.remove();
+ iframe = undefined;
+
+ gc();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ This test should not crash or assert.
+ <iframe srcdoc="<style>
+ .container {
+ height: 100px;
+ width: 100px;
+ overflow: scroll;
+ border: 1px solid black;
+ }
+
+ .contents {
+ height: 400px;
+ background-color: silver;
+ }
+ </style>"
+ ></iframe>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosslidernodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiosslidernodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src="../../../../resources/js-test-pre.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ var iframe = document.querySelector('iframe');
+
+ var node = iframe.contentDocument.createElement('input');
+ node.setAttribute('type', 'range');
+
+ iframe.contentDocument.body.appendChild(node);
+ iframe.contentDocument.body.offsetWidth;
+
+ document.body.appendChild(node);
+ document.body.offsetWidth;
+ node.remove();
+
+ window.setTimeout(removeFrameAndGC, 0)
+ }
+
+ function removeFrameAndGC()
+ {
+ var iframe = document.querySelector('iframe');
+ iframe.remove();
+ iframe = undefined;
+
+ gc();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ This test should not crash or assert.
+ <iframe srcdoc="<body></body>"></iframe>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiostouchnodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiostouchnodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html (0 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html         (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src="../../../../resources/js-test-pre.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ var iframe = document.querySelector('iframe');
+
+ var node = iframe.contentDocument.createElement('div');
+ node.addEventListener('touchstart', function() { }, false);
+ node.addEventListener('touchstart', function() { }, false);
+ node.addEventListener('touchmove', function() { }, false);
+ node.addEventListener('touchend', function() { }, false);
+ node.textContent = 'test node';
+ iframe.contentDocument.body.appendChild(node);
+
+ document.body.appendChild(node);
+
+ node.remove();
+
+ window.setTimeout(removeFrameAndGC, 0)
+ }
+
+ function removeFrameAndGC()
+ {
+ var iframe = document.querySelector('iframe');
+ iframe.remove();
+ iframe = undefined;
+
+ gc();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ This test should not crash or assert.
+ <iframe srcdoc="<body></body>"></iframe>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/Source/WebCore/ChangeLog        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2017-04-01 Simon Fraser <simon.fraser@apple.com>
+
+ Clean up touch event handler registration when moving nodes between documents
+ https://bugs.webkit.org/show_bug.cgi?id=170384
+ rdar://problem/30816694
+
+ Reviewed by Chris Dumez.
+
+ Make sure that Node::didMoveToNewDocument() does the correct unregistration on the
+ old document, and registration on the new document for nodes with touch event listeners,
+ and gesture event listeners. Touch "handler" nodes (those for overflow and sliders) are
+ already correctly moved via renderer-related teardown.
+
+ Add assertions that fire when removal was not complete.
+
+ Use references in more places.
+
+ Tests: fast/events/touch/ios/gesture-node-move-between-documents.html
+ fast/events/touch/ios/overflow-node-move-between-documents.html
+ fast/events/touch/ios/slider-node-move-between-documents.html
+ fast/events/touch/ios/touch-node-move-between-documents.html
+
+ * dom/EventNames.h:
+ (WebCore::EventNames::gestureEventNames):
+ * dom/Node.cpp:
+ (WebCore::Node::willBeDeletedFrom):
+ (WebCore::Node::didMoveToNewDocument):
+ (WebCore::tryAddEventListener):
+ (WebCore::tryRemoveEventListener):
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::registerForTouchEvents):
+ (WebCore::SliderThumbElement::unregisterForTouchEvents):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::registerAsTouchEventListenerForScrolling):
+ (WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling):
+
</ins><span class="cx"> 2017-04-03 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><span class="cx"> captureStream is getting black frames with webgl canvas
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventNames.h (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventNames.h        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/Source/WebCore/dom/EventNames.h        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -319,6 +319,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> std::array<std::reference_wrapper<const AtomicString>, 5> touchEventNames() const;
</span><ins>+ std::array<std::reference_wrapper<const AtomicString>, 3> gestureEventNames() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> EventNames(); // Private to prevent accidental call to EventNames() instead of eventNames().
</span><span class="lines">@@ -359,6 +360,11 @@
</span><span class="cx"> return { { touchstartEvent, touchmoveEvent, touchendEvent, touchcancelEvent, touchforcechangeEvent } };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline std::array<std::reference_wrapper<const AtomicString>, 3> EventNames::gestureEventNames() const
+{
+ return { { gesturestartEvent, gesturechangeEvent, gestureendEvent } };
+}
+
</ins><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><span class="cx"> inline bool EventNames::isGamepadEventType(const AtomicString& eventType) const
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/Source/WebCore/dom/Node.cpp        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -315,15 +315,16 @@
</span><span class="cx"> {
</span><span class="cx"> if (hasEventTargetData()) {
</span><span class="cx"> document.didRemoveWheelEventHandler(*this, EventHandlerRemoval::All);
</span><del>-#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
- document.removeTouchEventListener(this, true);
-#else
- // FIXME: This should call didRemoveTouchEventHandler().
</del><ins>+#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(IOS)
+ document.removeTouchEventListener(*this, EventHandlerRemoval::All);
</ins><span class="cx"> #endif
</span><ins>+ document.didRemoveTouchEventHandler(*this, EventHandlerRemoval::All);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
</span><del>- document.removeTouchEventHandler(this, true);
</del><ins>+ document.removeTouchEventHandler(*this, EventHandlerRemoval::All);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> if (AXObjectCache* cache = document.existingAXObjectCache())
</span><span class="lines">@@ -1919,15 +1920,31 @@
</span><span class="cx"> document().didAddWheelEventHandler(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned numTouchEventHandlers = 0;
</del><ins>+ unsigned numTouchEventListeners = 0;
</ins><span class="cx"> for (auto& name : eventNames().touchEventNames())
</span><del>- numTouchEventHandlers += eventListeners(name).size();
</del><ins>+ numTouchEventListeners += eventListeners(name).size();
</ins><span class="cx">
</span><del>- for (unsigned i = 0; i < numTouchEventHandlers; ++i) {
</del><ins>+ for (unsigned i = 0; i < numTouchEventListeners; ++i) {
</ins><span class="cx"> oldDocument.didRemoveTouchEventHandler(*this);
</span><span class="cx"> document().didAddTouchEventHandler(*this);
</span><ins>+
+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
+ oldDocument.removeTouchEventListener(*this);
+ document().addTouchEventListener(*this);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(TOUCH_EVENTS) && ENABLE(IOS_GESTURE_EVENTS)
+ unsigned numGestureEventListeners = 0;
+ for (auto& name : eventNames().gestureEventNames())
+ numGestureEventListeners += eventListeners(name).size();
+
+ for (unsigned i = 0; i < numGestureEventListeners; ++i) {
+ oldDocument.removeTouchEventHandler(*this);
+ document().addTouchEventHandler(*this);
+ }
+#endif
+
</ins><span class="cx"> if (auto* registry = mutationObserverRegistry()) {
</span><span class="cx"> for (auto& registration : *registry)
</span><span class="cx"> document().addMutationObserverTypes(registration->mutationTypes());
</span><span class="lines">@@ -1937,6 +1954,16 @@
</span><span class="cx"> for (auto& registration : *transientRegistry)
</span><span class="cx"> document().addMutationObserverTypes(registration->mutationTypes());
</span><span class="cx"> }
</span><ins>+
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
+ ASSERT_WITH_SECURITY_IMPLICATION(!oldDocument.touchEventListenersContain(*this));
+ ASSERT_WITH_SECURITY_IMPLICATION(!oldDocument.touchEventHandlersContain(*this));
+#endif
+#if ENABLE(TOUCH_EVENTS) && ENABLE(IOS_GESTURE_EVENTS)
+ ASSERT_WITH_SECURITY_IMPLICATION(!oldDocument.touchEventTargetsContain(*this));
+#endif
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eventType, Ref<EventListener>&& listener, const EventTarget::AddEventListenerOptions& options)
</span><span class="lines">@@ -1963,13 +1990,13 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx"> if (eventNames().isTouchEventType(eventType))
</span><del>- targetNode->document().addTouchEventListener(targetNode);
</del><ins>+ targetNode->document().addTouchEventListener(*targetNode);
</ins><span class="cx"> #endif
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IOS_GESTURE_EVENTS) && ENABLE(TOUCH_EVENTS)
</span><span class="cx"> if (eventNames().isGestureEventType(eventType))
</span><del>- targetNode->document().addTouchEventHandler(targetNode);
</del><ins>+ targetNode->document().addTouchEventHandler(*targetNode);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="lines">@@ -2004,13 +2031,13 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx"> if (eventNames().isTouchEventType(eventType))
</span><del>- targetNode->document().removeTouchEventListener(targetNode);
</del><ins>+ targetNode->document().removeTouchEventListener(*targetNode);
</ins><span class="cx"> #endif
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IOS_GESTURE_EVENTS) && ENABLE(TOUCH_EVENTS)
</span><span class="cx"> if (eventNames().isGestureEventType(eventType))
</span><del>- targetNode->document().removeTouchEventHandler(targetNode);
</del><ins>+ targetNode->document().removeTouchEventHandler(*targetNode);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowSliderThumbElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -549,7 +549,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(shouldAcceptTouchEvents());
</span><span class="cx">
</span><del>- document().addTouchEventHandler(this);
</del><ins>+ document().addTouchEventHandler(*this);
</ins><span class="cx"> m_isRegisteredAsTouchEventListener = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -561,7 +561,7 @@
</span><span class="cx"> clearExclusiveTouchIdentifier();
</span><span class="cx"> stopDragging();
</span><span class="cx">
</span><del>- document().removeTouchEventHandler(this);
</del><ins>+ document().removeTouchEventHandler(*this);
</ins><span class="cx"> m_isRegisteredAsTouchEventListener = false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (214818 => 214819)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-04-03 17:40:06 UTC (rev 214818)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-04-03 17:51:29 UTC (rev 214819)
</span><span class="lines">@@ -2194,7 +2194,7 @@
</span><span class="cx"> if (!renderer().element() || m_registeredAsTouchEventListenerForScrolling)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- renderer().document().addTouchEventHandler(renderer().element());
</del><ins>+ renderer().document().addTouchEventHandler(*renderer().element());
</ins><span class="cx"> m_registeredAsTouchEventListenerForScrolling = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2203,7 +2203,7 @@
</span><span class="cx"> if (!renderer().element() || !m_registeredAsTouchEventListenerForScrolling)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- renderer().document().removeTouchEventHandler(renderer().element());
</del><ins>+ renderer().document().removeTouchEventHandler(*renderer().element());
</ins><span class="cx"> m_registeredAsTouchEventListenerForScrolling = false;
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(IOS_TOUCH_EVENTS)
</span></span></pre>
</div>
</div>
</body>
</html>