<!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>[214879] branches/safari-603-branch</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/214879">214879</a></dd>
<dt>Author</dt> <dd>jmarcell@apple.com</dd>
<dt>Date</dt> <dd>2017-04-04 01:00:48 -0700 (Tue, 04 Apr 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/214819">r214819</a>. rdar://problem/31407633</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsChangeLog">branches/safari-603-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoreChangeLog">branches/safari-603-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoredomEventNamesh">branches/safari-603-branch/Source/WebCore/dom/EventNames.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoredomNodecpp">branches/safari-603-branch/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCorehtmlshadowSliderThumbElementcpp">branches/safari-603-branch/Source/WebCore/html/shadow/SliderThumbElement.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCorerenderingRenderLayercpp">branches/safari-603-branch/Source/WebCore/rendering/RenderLayer.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentsexpectedtxt">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentshtml">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentsexpectedtxt">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentshtml">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosslidernodemovebetweendocumentsexpectedtxt">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiosslidernodemovebetweendocumentshtml">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiostouchnodemovebetweendocumentsexpectedtxt">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsfasteventstouchiostouchnodemovebetweendocumentshtml">branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/ChangeLog (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/ChangeLog        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/LayoutTests/ChangeLog        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2017-04-03 Jason Marcell <jmarcell@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r214819. rdar://problem/31407633
+
+ 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.
+
+2017-04-03 Jason Marcell <jmarcell@apple.com>
+
</ins><span class="cx"> Cherry-pick r214640. rdar://problem/31408453
</span><span class="cx">
</span><span class="cx"> 2017-03-30 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents-expected.txt        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsfasteventstouchiosgesturenodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/gesture-node-move-between-documents.html        2017-04-04 08:00:48 UTC (rev 214879)
</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="branchessafari603branchLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents-expected.txt        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsfasteventstouchiosoverflownodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/overflow-node-move-between-documents.html        2017-04-04 08:00:48 UTC (rev 214879)
</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="branchessafari603branchLayoutTestsfasteventstouchiosslidernodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents-expected.txt        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsfasteventstouchiosslidernodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/slider-node-move-between-documents.html        2017-04-04 08:00:48 UTC (rev 214879)
</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="branchessafari603branchLayoutTestsfasteventstouchiostouchnodemovebetweendocumentsexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents-expected.txt        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test should not crash or assert.
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsfasteventstouchiostouchnodemovebetweendocumentshtml"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html (0 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html         (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/touch-node-move-between-documents.html        2017-04-04 08:00:48 UTC (rev 214879)
</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="branchessafari603branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/ChangeLog        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -1,5 +1,45 @@
</span><span class="cx"> 2017-04-03 Jason Marcell <jmarcell@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r214819. rdar://problem/31407633
+
+ 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):
+
+2017-04-03 Jason Marcell <jmarcell@apple.com>
+
</ins><span class="cx"> Cherry-pick r214703. rdar://problem/31407633
</span><span class="cx">
</span><span class="cx"> 2017-03-31 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoredomEventNamesh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/dom/EventNames.h (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/dom/EventNames.h        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/Source/WebCore/dom/EventNames.h        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -317,6 +317,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">@@ -357,6 +358,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="branchessafari603branchSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/dom/Node.cpp (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/dom/Node.cpp        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/Source/WebCore/dom/Node.cpp        2017-04-04 08:00:48 UTC (rev 214879)
</span><span class="lines">@@ -321,15 +321,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">@@ -1926,15 +1927,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">@@ -1944,6 +1961,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">@@ -1970,13 +1997,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">@@ -2011,13 +2038,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="branchessafari603branchSourceWebCorehtmlshadowSliderThumbElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/html/shadow/SliderThumbElement.cpp (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/html/shadow/SliderThumbElement.cpp        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/Source/WebCore/html/shadow/SliderThumbElement.cpp        2017-04-04 08:00:48 UTC (rev 214879)
</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="branchessafari603branchSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/rendering/RenderLayer.cpp (214878 => 214879)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/rendering/RenderLayer.cpp        2017-04-04 08:00:42 UTC (rev 214878)
+++ branches/safari-603-branch/Source/WebCore/rendering/RenderLayer.cpp        2017-04-04 08:00:48 UTC (rev 214879)
</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().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">@@ -2212,7 +2212,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>