<!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>[200414] 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/200414">200414</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-05-04 05:51:28 -0700 (Wed, 04 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clicks inside button elements are sometimes discarded when the mouse moves
https://bugs.webkit.org/show_bug.cgi?id=39620

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/events/click-over-descendant-elements.html

* dom/Node.cpp:
(WebCore::ancestor):
(WebCore::commonAncestor): Method inspired from
http://src.chromium.org/viewvc/blink?view=revision&amp;revision=162081.
(WebCore::commonAncestorCrossingShadowBoundary): Helper routine
that handles the case of nodes into a shadow node.
* dom/Node.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent): Selecting click event
target node according commonAncestorOverShadowBoundary method.
(WebCore::EventHandler::targetNodeForClickEvent): Deleted.

LayoutTests:

Test coming from http://src.chromium.org/viewvc/blink?view=revision&amp;revision=162081.
Modified to ensure click events do not end up being considered as double click events.

* fast/events/click-over-descendant-elements-expected.txt: Added.
* fast/events/click-over-descendant-elements.html: Added.
* platform/ios-simulator/TestExpectations: Marked new test as failing.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsclickoverdescendantelementsexpectedtxt">trunk/LayoutTests/fast/events/click-over-descendant-elements-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsclickoverdescendantelementshtml">trunk/LayoutTests/fast/events/click-over-descendant-elements.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/LayoutTests/ChangeLog        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-05-04  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        Clicks inside button elements are sometimes discarded when the mouse moves
+        https://bugs.webkit.org/show_bug.cgi?id=39620
+
+        Reviewed by Darin Adler.
+
+        Test coming from http://src.chromium.org/viewvc/blink?view=revision&amp;revision=162081.
+        Modified to ensure click events do not end up being considered as double click events.
+
+        * fast/events/click-over-descendant-elements-expected.txt: Added.
+        * fast/events/click-over-descendant-elements.html: Added.
+        * platform/ios-simulator/TestExpectations: Marked new test as failing.
+
</ins><span class="cx"> 2016-05-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsclickoverdescendantelementsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/click-over-descendant-elements-expected.txt (0 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/click-over-descendant-elements-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/click-over-descendant-elements-expected.txt        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+Check if any mousedown-mouseup pairs in one element dispatch click events.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Very normal click on container:
+PASS lastClickTarget is container
+Move inside container:
+PASS lastClickTarget is container
+Move from container to a child:
+PASS lastClickTarget is container
+Move from a child to container:
+PASS lastClickTarget is container
+Move from a child to another child:
+PASS lastClickTarget is container
+Move out from a child:
+PASS lastClickTarget is document.body
+Removing a child element in the light DOM during a click:
+FAIL lastClickTarget should be null. Was [object HTMLDivElement].
+Click on escaping button content:
+PASS lastClickTarget is button1
+Click on disappearing INPUT value:
+PASS lastClickTarget is input1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsclickoverdescendantelementshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/click-over-descendant-elements.html (0 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/click-over-descendant-elements.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/click-over-descendant-elements.html        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+body {
+    margin: 0;
+    padding: 0;
+    -webkit-user-select: none;
+}
+
+#container {
+    padding: 40px;
+}
+
+#inner1, #inner2 {
+    height: 40px;
+}
+
+#button1 {
+    padding-top: 4px;
+}
+#button1:active {
+    padding-top: 40px;
+}
+&lt;/style&gt;
+&lt;div id=&quot;container&quot;&gt;
+&lt;div id=&quot;inner1&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;inner2&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;button id=&quot;button1&quot;&gt;&lt;span id=&quot;button-span&quot;&gt;Click me&lt;/span&gt;&lt;/button&gt;
+&lt;input id=&quot;input1&quot; value=&quot;A quick brown fox jumps over the lazy dog. A quick brown fox jumps over the lazy dog.&quot;&gt;
+&lt;!-- Avoid to create a console element before the above elements --&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description('Check if any mousedown-mouseup pairs in one element dispatch click events.');
+if (!window.eventSender)
+    debug('This test needs to run in a test environment.');
+
+var container = document.getElementById('container');
+var containerRect = container.getBoundingClientRect();
+var inner1 = document.getElementById('inner1');
+var inner1Rect = inner1.getBoundingClientRect();
+var inner2 = document.getElementById('inner2');
+var inner2Rect = inner2.getBoundingClientRect();
+var x = (containerRect.left + containerRect.right) / 2;
+var inContainer = (containerRect.top + inner1Rect.top) / 2;
+var inInner1 = (inner1Rect.top + inner1Rect.bottom) / 2;
+var inInner2 = (inner2Rect.top + inner2Rect.bottom) / 2;
+
+var lastClickTarget = null;
+document.addEventListener('click', function(event) {
+    lastClickTarget = event.target;
+}, false);
+
+function clearClick()
+{
+    eventSender.mouseMoveTo(0, 0);
+    eventSender.mouseDown(1);
+    eventSender.mouseUp(1);
+    lastClickTarget;
+}
+
+
+debug('Very normal click on container:');
+eventSender.mouseMoveTo(x, inContainer);
+eventSender.mouseDown();
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'container');
+clearClick();
+
+debug('Move inside container:');
+eventSender.mouseMoveTo(x, inContainer);
+eventSender.mouseDown();
+eventSender.mouseMoveTo(x + 10, inContainer);
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'container');
+clearClick();
+
+debug('Move from container to a child:');
+eventSender.mouseMoveTo(x, inContainer);
+eventSender.mouseDown();
+eventSender.mouseMoveTo(x, inInner1);
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'container');
+clearClick();
+
+debug('Move from a child to container:');
+eventSender.mouseMoveTo(x, inInner1);
+eventSender.mouseDown();
+eventSender.mouseMoveTo(x, inContainer);
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'container');
+clearClick();
+
+debug('Move from a child to another child:');
+eventSender.mouseMoveTo(x, inInner1);
+eventSender.mouseDown();
+eventSender.mouseMoveTo(x, inInner2);
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'container');
+clearClick();
+
+debug('Move out from a child:');
+eventSender.mouseMoveTo(x, inInner1);
+eventSender.mouseDown();
+eventSender.mouseMoveTo(x, containerRect.bottom + 10);
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'document.body');
+clearClick();
+
+debug('Removing a child element in the light DOM during a click:');
+eventSender.mouseMoveTo(x, inInner2);
+eventSender.mouseDown();
+inner2.remove();
+eventSender.mouseUp();
+shouldBeNull('lastClickTarget');
+clearClick();
+
+debug('Click on escaping button content:');
+var button1 = document.getElementById(&quot;button1&quot;);
+var spanRect = document.getElementById('button-span').getBoundingClientRect();
+eventSender.mouseMoveTo((spanRect.left + spanRect.right) / 2, spanRect.top + 1);
+eventSender.mouseDown();
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'button1');
+clearClick();
+
+debug('Click on disappearing INPUT value:');
+var input1 = document.getElementById('input1');
+input1.addEventListener('focus', function() { input1.value = &quot;&quot;; }, false);
+var inputRect = input1.getBoundingClientRect();
+eventSender.mouseMoveTo(inputRect.left + 8, (inputRect.top + inputRect.bottom) / 2);
+eventSender.mouseDown();
+eventSender.mouseUp();
+shouldBe('lastClickTarget', 'input1');
+clearClick();
+
+container.remove();
+button1.remove();
+input1.remove();
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -1665,6 +1665,7 @@
</span><span class="cx"> fast/events/show-modal-dialog-onblur-onfocus.html [ Failure ]
</span><span class="cx"> fast/events/tab-focus-link-in-canvas.html [ Failure ]
</span><span class="cx"> fast/events/tabindex-focus-blur-all.html [ Failure ]
</span><ins>+fast/events/click-over-descendant-elements.html [ Failure ]
</ins><span class="cx"> 
</span><span class="cx"> # Ref-test imported from W3C that is failing because type=image input elements have rounded corners on iOS.
</span><span class="cx"> imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/image01.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/Source/WebCore/ChangeLog        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-05-04  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        Clicks inside button elements are sometimes discarded when the mouse moves
+        https://bugs.webkit.org/show_bug.cgi?id=39620
+
+        Reviewed by Darin Adler.
+
+        Test: fast/events/click-over-descendant-elements.html
+
+        * dom/Node.cpp:
+        (WebCore::ancestor):
+        (WebCore::commonAncestor): Method inspired from
+        http://src.chromium.org/viewvc/blink?view=revision&amp;revision=162081.
+        (WebCore::commonAncestorCrossingShadowBoundary): Helper routine
+        that handles the case of nodes into a shadow node.
+        * dom/Node.h:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMouseReleaseEvent): Selecting click event
+        target node according commonAncestorOverShadowBoundary method.
+        (WebCore::EventHandler::targetNodeForClickEvent): Deleted.
+
</ins><span class="cx"> 2016-05-04  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fixing crashing GTK+ tests after r200407.
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/Source/WebCore/dom/Node.cpp        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -952,6 +952,65 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline Node* ancestor(Node* node, unsigned depth)
+{
+    for (unsigned i = 0; i &lt; depth; ++i)
+        node = node-&gt;parentNode();
+    return node;
+}
+
+Node* commonAncestor(Node&amp; thisNode, Node&amp; otherNode)
+{
+    unsigned thisDepth = 0;
+    for (auto node = &amp;thisNode; node; node = node-&gt;parentNode()) {
+        if (node == &amp;otherNode)
+            return node;
+        thisDepth++;
+    }
+    unsigned otherDepth = 0;
+    for (auto node = &amp;otherNode; node; node = node-&gt;parentNode()) {
+        if (node == &amp;thisNode)
+            return &amp;thisNode;
+        otherDepth++;
+    }
+
+    Node* thisAncestor = &amp;thisNode;
+    Node* otherAncestor = &amp;otherNode;
+    if (thisDepth &gt; otherDepth)
+        thisAncestor = ancestor(thisAncestor, thisDepth - otherDepth);
+    else if (otherDepth &gt; thisDepth)
+        otherAncestor = ancestor(otherAncestor, otherDepth - thisDepth);
+
+    for (; thisAncestor; thisAncestor = thisAncestor-&gt;parentNode()) {
+        if (thisAncestor == otherAncestor)
+            return thisAncestor;
+        otherAncestor = otherAncestor-&gt;parentNode();
+    }
+    ASSERT(!otherAncestor);
+    return nullptr;
+}
+
+Node* commonAncestorCrossingShadowBoundary(Node&amp; node, Node&amp; other)
+{
+    if (&amp;node == &amp;other)
+        return &amp;node;
+
+    Element* shadowHost = node.shadowHost();
+    // FIXME: This test might be wrong for user-authored shadow trees.
+    if (shadowHost &amp;&amp; shadowHost == other.shadowHost())
+        return shadowHost;
+
+    TreeScope* scope = commonTreeScope(&amp;node, &amp;other);
+    if (!scope)
+        return nullptr;
+
+    Node* parentNode = scope-&gt;ancestorInThisScope(&amp;node);
+    ASSERT(parentNode);
+    Node* parentOther = scope-&gt;ancestorInThisScope(&amp;other);
+    ASSERT(parentOther);
+    return commonAncestor(*parentNode, *parentOther);
+}
+
</ins><span class="cx"> Node* Node::pseudoAwarePreviousSibling() const
</span><span class="cx"> {
</span><span class="cx">     Element* parentOrHost = is&lt;PseudoElement&gt;(*this) ? downcast&lt;PseudoElement&gt;(*this).hostElement() : parentElement();
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/Source/WebCore/dom/Node.h        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -783,6 +783,9 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+Node* commonAncestor(Node&amp;, Node&amp;);
+Node* commonAncestorCrossingShadowBoundary(Node&amp;, Node&amp;);
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (200413 => 200414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2016-05-04 10:26:29 UTC (rev 200413)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2016-05-04 12:51:28 UTC (rev 200414)
</span><span class="lines">@@ -1949,24 +1949,6 @@
</span><span class="cx">     m_clickNode = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Node* targetNodeForClickEvent(Node* mousePressNode, Node* mouseReleaseNode)
-{
-    if (!mousePressNode || !mouseReleaseNode)
-        return nullptr;
-
-    if (mousePressNode == mouseReleaseNode)
-        return mouseReleaseNode;
-
-    Element* mouseReleaseShadowHost = mouseReleaseNode-&gt;shadowHost();
-    if (mouseReleaseShadowHost &amp;&amp; mouseReleaseShadowHost == mousePressNode-&gt;shadowHost()) {
-        // We want to dispatch the click to the shadow tree host element to give listeners the illusion that the
-        // shadom tree is a single element. For example, we want to give the illusion that &lt;input type=&quot;range&quot;&gt;
-        // is a single element even though it is a composition of multiple shadom tree elements.
-        return mouseReleaseShadowHost;
-    }
-    return nullptr;
-}
-
</del><span class="cx"> bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent&amp; platformMouseEvent)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;FrameView&gt; protector(m_frame.view());
</span><span class="lines">@@ -2028,7 +2010,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool contextMenuEvent = platformMouseEvent.button() == RightButton;
</span><span class="cx"> 
</span><del>-    Node* nodeToClick = targetNodeForClickEvent(m_clickNode.get(), mouseEvent.targetNode());
</del><ins>+    Node* targetNode = mouseEvent.targetNode();
+    Node* nodeToClick = (m_clickNode &amp;&amp; targetNode) ? commonAncestorCrossingShadowBoundary(*m_clickNode, *targetNode) : nullptr;
</ins><span class="cx">     bool swallowClickEvent = m_clickCount &gt; 0 &amp;&amp; !contextMenuEvent &amp;&amp; nodeToClick &amp;&amp; !dispatchMouseEvent(eventNames().clickEvent, nodeToClick, true, m_clickCount, platformMouseEvent, true);
</span><span class="cx"> 
</span><span class="cx">     if (m_resizeLayer) {
</span></span></pre>
</div>
</div>

</body>
</html>