<!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>[182349] 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/182349">182349</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-04-04 17:51:53 -0700 (Sat, 04 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard
https://bugs.webkit.org/show_bug.cgi?id=143406
rdar://problem/20407080
Reviewed by Ryosuke Niwa.
Source/WebCore:
We failed to remove elements from Document's m_wheelEventTargets HashSet when the
elements were destroyed with wheel handlers still on them. Fix by removing the
node from the set via Node::willBeDeletedFrom().
Tests: platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html
platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html
platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html
* dom/Document.cpp:
(WebCore::removeHandlerFromSet): Helper to remove one or all handlers on the given node.
(WebCore::Document::didRemoveWheelEventHandler): Add a parameter to specify whether we're
removing all handlers on the given node.
(WebCore::Document::didRemoveTouchEventHandler): Use removeHandlerFromSet().
* dom/Document.h:
* dom/Node.cpp:
(WebCore::Node::willBeDeletedFrom): Tell the document we're removing all handlers
for this node.
LayoutTests:
Test configurations of elements with different parenting and event handlers adding orders, and multiple handlers on
the same node.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.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="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroyelementwithmultiplehandlerscrashexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroyelementwithmultiplehandlerscrashhtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementcrashexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementcrashhtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementparentcrashexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementparentcrashhtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182348 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-05 00:19:29 UTC (rev 182348)
+++ trunk/LayoutTests/ChangeLog        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2015-04-04 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><ins>+ Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard
+ https://bugs.webkit.org/show_bug.cgi?id=143406
+ rdar://problem/20407080
+
+ Reviewed by Ryosuke Niwa.
+
+ Test configurations of elements with different parenting and event handlers adding orders, and multiple handlers on
+ the same node.
+
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html: Added.
+
+2015-04-04 Simon Fraser <simon.fraser@apple.com>
+
</ins><span class="cx"> REGRESSION (r182215): Feedly crashes when closing article
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=143405
</span><span class="cx"> rdar://problem/20382734, rdar://problem/20395497
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroyelementwithmultiplehandlerscrashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test passes if it does not crash.
+
+Iterations: 4
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroyelementwithmultiplehandlerscrashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .popover {
+ position: absolute;
+ z-index: 1;
+ top: 100px;
+ left: 100px;
+ width: 300px;
+ height: 200px;
+ border: 1px solid black;
+ }
+
+ .container {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ }
+
+ </style>
+
+ <script src="../../../../../resources/js-test-pre.js" type="text/javascript" charset="utf-8"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ var popover;
+ function createPopover()
+ {
+ popover = document.createElement('div');
+ popover.className = 'popover';
+ var container = document.createElement('div');
+ container.className = 'container';
+ popover.appendChild(container);
+ }
+
+ function doTest()
+ {
+ createPopover();
+ document.body.appendChild(popover);
+ popover.addEventListener("mousewheel", function() { }, true);
+ popover.addEventListener("mousewheel", function() { }, true);
+ window.setTimeout(dismiss, 0);
+ }
+
+ var count = 0;
+ function dismiss()
+ {
+ document.body.removeChild(popover);
+ gc();
+
+ document.getElementById('count').textContent = ++count;
+ if (count > 3) {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ doTest();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <p>Test that elements with multiple wheel event handlers are removed from the document's event handler set when the element is destroyed. Test passes if it does not crash.</p>
+<p>Iterations: <span id="count"></span></p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementcrashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test passes if it does not crash.
+
+Iterations: 4
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementcrashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .popover {
+ position: absolute;
+ z-index: 1;
+ top: 100px;
+ left: 100px;
+ width: 300px;
+ height: 200px;
+ border: 1px solid black;
+ }
+
+ .container {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ }
+
+ </style>
+
+ <script src="../../../../../resources/js-test-pre.js" type="text/javascript" charset="utf-8"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ var popover;
+ function createPopover()
+ {
+ popover = document.createElement('div');
+ popover.className = 'popover';
+ var container = document.createElement('div');
+ container.className = 'container';
+ popover.appendChild(container);
+ }
+
+ function doTest()
+ {
+ createPopover();
+ document.body.appendChild(popover);
+ popover.addEventListener("mousewheel", this, true);
+ window.setTimeout(dismiss, 0);
+ }
+
+ var count = 0;
+ function dismiss()
+ {
+ document.body.removeChild(popover);
+ gc();
+
+ document.getElementById('count').textContent = ++count;
+ if (count > 3) {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ doTest();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <p>Test that elements with wheel event handlers are removed from the document's event handler set when the element is destroyed. Test passes if it does not crash.</p>
+<p>Iterations: <span id="count"></span></p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementparentcrashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test passes if it does not crash.
+
+Iterations: 4
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiondestroywheelelementparentcrashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html (0 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .popover {
+ position: absolute;
+ z-index: 1;
+ top: 100px;
+ left: 100px;
+ width: 300px;
+ height: 200px;
+ border: 1px solid black;
+ }
+
+ .container {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ }
+
+ </style>
+
+ <script src="../../../../../resources/js-test-pre.js" type="text/javascript" charset="utf-8"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ var popover;
+ function createPopover()
+ {
+ popover = document.createElement('div');
+ popover.className = 'popover';
+ var container = document.createElement('div');
+ container.className = 'container';
+ container.addEventListener("mousewheel", this, true);
+ popover.appendChild(container);
+ }
+
+ function doTest()
+ {
+ createPopover();
+ document.body.appendChild(popover);
+ window.setTimeout(dismiss, 0);
+ }
+
+ var count = 0;
+ function dismiss()
+ {
+ document.body.removeChild(popover);
+ gc();
+
+ document.getElementById('count').textContent = ++count;
+ if (count > 3) {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ doTest();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<p>Test that elements with wheel event handlers are removed from the document's event handler set when the element is destroyed. Test passes if it does not crash.</p>
+<p>Iterations: <span id="count"></span></p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182348 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-05 00:19:29 UTC (rev 182348)
+++ trunk/Source/WebCore/ChangeLog        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2015-04-04 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><ins>+ Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard
+ https://bugs.webkit.org/show_bug.cgi?id=143406
+ rdar://problem/20407080
+
+ Reviewed by Ryosuke Niwa.
+
+ We failed to remove elements from Document's m_wheelEventTargets HashSet when the
+ elements were destroyed with wheel handlers still on them. Fix by removing the
+ node from the set via Node::willBeDeletedFrom().
+
+ Tests: platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html
+ platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html
+ platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html
+
+ * dom/Document.cpp:
+ (WebCore::removeHandlerFromSet): Helper to remove one or all handlers on the given node.
+ (WebCore::Document::didRemoveWheelEventHandler): Add a parameter to specify whether we're
+ removing all handlers on the given node.
+ (WebCore::Document::didRemoveTouchEventHandler): Use removeHandlerFromSet().
+ * dom/Document.h:
+ * dom/Node.cpp:
+ (WebCore::Node::willBeDeletedFrom): Tell the document we're removing all handlers
+ for this node.
+
+2015-04-04 Simon Fraser <simon.fraser@apple.com>
+
</ins><span class="cx"> REGRESSION (r182215): Feedly crashes when closing article
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=143405
</span><span class="cx"> rdar://problem/20382734, rdar://problem/20395497
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (182348 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-04-05 00:19:29 UTC (rev 182348)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -6003,13 +6003,24 @@
</span><span class="cx"> DebugPageOverlays::didChangeEventHandlers(*frame);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::didRemoveWheelEventHandler(Node& node)
</del><ins>+static bool removeHandlerFromSet(EventTargetSet& handlerSet, Node& node, EventHandlerRemoval removal)
</ins><span class="cx"> {
</span><ins>+ switch (removal) {
+ case EventHandlerRemoval::One:
+ return handlerSet.remove(&node);
+ case EventHandlerRemoval::All:
+ return handlerSet.removeAll(&node);
+ }
+ return false;
+}
+
+void Document::didRemoveWheelEventHandler(Node& node, EventHandlerRemoval removal)
+{
</ins><span class="cx"> if (!m_wheelEventTargets)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ASSERT(m_wheelEventTargets->contains(&node));
- m_wheelEventTargets->remove(&node);
</del><ins>+ if (!removeHandlerFromSet(*m_wheelEventTargets, node, removal))
+ return;
</ins><span class="cx">
</span><span class="cx"> if (Document* parent = parentDocument()) {
</span><span class="cx"> parent->didRemoveWheelEventHandler(*this);
</span><span class="lines">@@ -6056,14 +6067,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::didRemoveTouchEventHandler(Node& handler)
</del><ins>+void Document::didRemoveTouchEventHandler(Node& handler, EventHandlerRemoval removal)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx"> if (!m_touchEventTargets)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ASSERT(m_touchEventTargets->contains(&handler));
- m_touchEventTargets->remove(&handler);
</del><ins>+ removeHandlerFromSet(*m_touchEventTargets, handler, removal))
</ins><span class="cx">
</span><span class="cx"> if (Document* parent = parentDocument()) {
</span><span class="cx"> parent->didRemoveTouchEventHandler(*this);
</span><span class="lines">@@ -6084,6 +6094,7 @@
</span><span class="cx"> page->chrome().client().needTouchEvents(false);
</span><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(handler);
</span><ins>+ UNUSED_PARAM(removal);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -6139,7 +6150,7 @@
</span><span class="cx">
</span><span class="cx"> for (auto it : *targets) {
</span><span class="cx"> LayoutRect rootRelativeBounds;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (is<Document>(it.key)) {
</span><span class="cx"> Document* document = downcast<Document>(it.key);
</span><span class="cx"> if (document == this)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (182348 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2015-04-05 00:19:29 UTC (rev 182348)
+++ trunk/Source/WebCore/dom/Document.h        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -240,6 +240,7 @@
</span><span class="cx"> };
</span><span class="cx"> const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1;
</span><span class="cx">
</span><ins>+enum class EventHandlerRemoval { One, All };
</ins><span class="cx"> typedef HashCountedSet<Node*> EventTargetSet;
</span><span class="cx">
</span><span class="cx"> enum DocumentClass {
</span><span class="lines">@@ -1123,7 +1124,7 @@
</span><span class="cx"> void initDNSPrefetch();
</span><span class="cx">
</span><span class="cx"> void didAddWheelEventHandler(Node&);
</span><del>- void didRemoveWheelEventHandler(Node&);
</del><ins>+ void didRemoveWheelEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One);
</ins><span class="cx">
</span><span class="cx"> double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
</span><span class="cx"> void updateLastHandledUserGestureTimestamp();
</span><span class="lines">@@ -1139,7 +1140,7 @@
</span><span class="cx"> WEBCORE_EXPORT unsigned touchEventHandlerCount() const;
</span><span class="cx">
</span><span class="cx"> void didAddTouchEventHandler(Node&);
</span><del>- void didRemoveTouchEventHandler(Node&);
</del><ins>+ void didRemoveTouchEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One);
</ins><span class="cx">
</span><span class="cx"> void didRemoveEventTargetNode(Node&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (182348 => 182349)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2015-04-05 00:19:29 UTC (rev 182348)
+++ trunk/Source/WebCore/dom/Node.cpp        2015-04-05 00:51:53 UTC (rev 182349)
</span><span class="lines">@@ -328,8 +328,11 @@
</span><span class="cx"> void Node::willBeDeletedFrom(Document& document)
</span><span class="cx"> {
</span><span class="cx"> if (hasEventTargetData()) {
</span><ins>+ document.didRemoveWheelEventHandler(*this, EventHandlerRemoval::All);
</ins><span class="cx"> #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
</span><span class="cx"> document.removeTouchEventListener(this, true);
</span><ins>+#else
+ // FIXME: This should call didRemoveTouchEventHandler().
</ins><span class="cx"> #endif
</span><span class="cx"> clearEventTargetData();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>