<!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>[209780] 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/209780">209780</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-13 15:22:03 -0800 (Tue, 13 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>:hover rule causes a single tap to not activate a slotted anchor element
https://bugs.webkit.org/show_bug.cgi?id=165551
Reviewed by Antti Koivisto.
Source/WebCore:
Fixed a bug in ancestorRespondingToClickEvents that we were traversing the ancestor nodes without taking
shadow roots and slots into account. This prevented tapping on a text node assigned to a slot inside
an anchor element to activate the hyperlink on iOS.
This bug was supposed to be fixed in <a href="http://trac.webkit.org/projects/webkit/changeset/206605">r206605</a>, and it was still broken on iOS due to the bug in
ancestorRespondingToClickEvents. It is now tested by click-text-inside-linked-slot.html.
Tests: fast/shadow-dom/click-on-slotted-anchor-with-hover.html
fast/shadow-dom/click-text-inside-linked-slot.html
* page/ios/FrameIOS.mm:
(WebCore::ancestorRespondingToClickEvents):
(WebCore::Frame::qualifyingNodeAtViewportLocation):
LayoutTests:
Added a test for tapping on an anchor element assigned to a slot, which has been fixed in <a href="http://trac.webkit.org/projects/webkit/changeset/209065">r209065</a>.
Also added a new helper JS wrapepr, UIHelper, defined inside LayoutTests/resources/js-helper.js
to provide an abstraction around EventSender and UIScriptController.
Fixed click-text-inside-linked-slot.html on iOS using UIHelper.
* fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt: Added.
* fast/shadow-dom/click-on-slotted-anchor-with-hover.html: Added.
* fast/shadow-dom/click-text-inside-linked-slot.html:
* platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt: Added.
* resources/ui-helper.js: Added.
(window.UIHelper.isIOS):
(window.UIHelper.activateAt.return.new.Promise):
(window.UIHelper.activateAt):
(window.UIHelper.wait):
(window.UIHelper):
* platform/ios-simulator-wk2/TestExpectations: Skip the test in the open source iOS's WebKit2.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastshadowdomclicktextinsidelinkedslothtml">trunk/LayoutTests/fast/shadow-dom/click-text-inside-linked-slot.html</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageiosFrameIOSmm">trunk/Source/WebCore/page/ios/FrameIOS.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastshadowdomclickonslottedanchorwithhoverexpectedtxt">trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshadowdomclickonslottedanchorwithhoverhtml">trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover.html</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorfastshadowdomclicktextinsidelinkedslotexpectedtxt">trunk/LayoutTests/platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt</a></li>
<li><a href="#trunkLayoutTestsresourcesuihelperjs">trunk/LayoutTests/resources/ui-helper.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209779 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-13 22:56:28 UTC (rev 209779)
+++ trunk/LayoutTests/ChangeLog        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-12-13 Ryosuke Niwa <rniwa@webkit.org>
+
+ :hover rule causes a single tap to not activate a slotted anchor element
+ https://bugs.webkit.org/show_bug.cgi?id=165551
+
+ Reviewed by Antti Koivisto.
+
+ Added a test for tapping on an anchor element assigned to a slot, which has been fixed in r209065.
+
+ Also added a new helper JS wrapepr, UIHelper, defined inside LayoutTests/resources/js-helper.js
+ to provide an abstraction around EventSender and UIScriptController.
+
+ Fixed click-text-inside-linked-slot.html on iOS using UIHelper.
+
+ * fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt: Added.
+ * fast/shadow-dom/click-on-slotted-anchor-with-hover.html: Added.
+ * fast/shadow-dom/click-text-inside-linked-slot.html:
+ * platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt: Added.
+ * resources/ui-helper.js: Added.
+ (window.UIHelper.isIOS):
+ (window.UIHelper.activateAt.return.new.Promise):
+ (window.UIHelper.activateAt):
+ (window.UIHelper.wait):
+ (window.UIHelper):
+ * platform/ios-simulator-wk2/TestExpectations: Skip the test in the open source iOS's WebKit2.
+
</ins><span class="cx"> 2016-12-13 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Eliminate SVGPaint and SVGColor
</span></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomclickonslottedanchorwithhoverexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt (0 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Tests for tapping or clicking on an anchor element assigned to a slot with :hover rule.
+Tapping on "Tap me" below exactly once should activate the hyperlink.
+
+Tap me
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomclickonslottedanchorwithhoverhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover.html (0 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover.html         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/click-on-slotted-anchor-with-hover.html        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<p>Tests for tapping or clicking on an anchor element assigned to a slot with :hover rule.<br>
+Tapping on "Tap me" below exactly once should activate the hyperlink.</p>
+<div id="host"><a href="#" onclick="activated();">Tap me</a></div>
+<div id="result">FAIL</div>
+<script src="../../resources/ui-helper.js"></script>
+<script>
+
+let shadowHost = document.getElementById('host');
+shadowHost.attachShadow({mode: 'closed'}).innerHTML = '<slot></slot>';
+
+function activated() {
+ document.getElementById('result').textContent = 'PASS';
+}
+
+document.onclick = function () {
+ document.getElementById('result').style.display = null;
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ UIHelper.wait(UIHelper.activateAt(shadowHost.offsetLeft + 5, shadowHost.offsetTop + 5));
+} else
+ document.getElementById('result').style.display = 'none';
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomclicktextinsidelinkedslothtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shadow-dom/click-text-inside-linked-slot.html (209779 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/click-text-inside-linked-slot.html        2016-12-13 22:56:28 UTC (rev 209779)
+++ trunk/LayoutTests/fast/shadow-dom/click-text-inside-linked-slot.html        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <body>
</span><span class="cx"> <p>This tests clicking on a Text node assigned to a slot inside an anchor element. The link should be activated.<br>
</span><span class="cx"> To manually test, click "here" below and you should see "PASS" and the mouse cursor should indicate it's a hyperlink, not text:</p>
</span><ins>+<script src="../../resources/ui-helper.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx">
</span><span class="cx"> var shadowHost = document.createElement('div');
</span><span class="lines">@@ -24,9 +25,7 @@
</span><span class="cx"> testRunner.dumpAsText();
</span><span class="cx"> document.getElementById('activation').textContent = 'FAIL';
</span><span class="cx"> document.write('<div>Cursor: <span id="cursor">FAIL<span></div>');
</span><del>- eventSender.mouseMoveTo(shadowHost.offsetLeft + 5, shadowHost.offsetTop + 5);
- eventSender.mouseDown();
- eventSender.mouseUp();
</del><ins>+ UIHelper.wait(UIHelper.activateAt(shadowHost.offsetLeft + 5, shadowHost.offsetTop + 5));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfastshadowdomclicktextinsidelinkedslotexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt (0 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This tests clicking on a Text node assigned to a slot inside an anchor element. The link should be activated.
+To manually test, click "here" below and you should see "PASS" and the mouse cursor should indicate it's a hyperlink, not text:
+
+click here
+Activation: PASS
+Cursor: FAIL: Cursor details not available on this platform.
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (209779 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-13 22:56:28 UTC (rev 209779)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -1777,6 +1777,7 @@
</span><span class="cx"> fast/loader/location-hash-user-gesture.html [ Skip ]
</span><span class="cx"> imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
</span><span class="cx"> fast/dom/Window/post-message-user-action.html [ Skip ]
</span><ins>+fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
</ins><span class="cx"> fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
</span><span class="cx"> fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html
</span><span class="cx"> fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesuihelperjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/resources/ui-helper.js (0 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/ui-helper.js         (rev 0)
+++ trunk/LayoutTests/resources/ui-helper.js        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+
+window.UIHelper = class UIHelper {
+ static isIOS()
+ {
+ return navigator.userAgent.includes('iPhone');
+ }
+
+ static activateAt(x, y)
+ {
+ if (!testRunner.runUIScript || !this.isIOS()) {
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ return Promise.resolve();
+ }
+
+ return new Promise((resolve) => {
+ testRunner.runUIScript(`
+ uiController.singleTapAtPoint(${x}, ${y}, function() {
+ uiController.uiScriptComplete('Done');
+ });`, resolve);
+ });
+ }
+
+ static wait(promise)
+ {
+ testRunner.waitUntilDone();
+ return promise.then(
+ function () { testRunner.notifyDone(); },
+ function (error) { testRunner.notifyDone(); return Promise.reject(error); });
+ }
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209779 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-13 22:56:28 UTC (rev 209779)
+++ trunk/Source/WebCore/ChangeLog        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-12-13 Ryosuke Niwa <rniwa@webkit.org>
+
+ :hover rule causes a single tap to not activate a slotted anchor element
+ https://bugs.webkit.org/show_bug.cgi?id=165551
+
+ Reviewed by Antti Koivisto.
+
+ Fixed a bug in ancestorRespondingToClickEvents that we were traversing the ancestor nodes without taking
+ shadow roots and slots into account. This prevented tapping on a text node assigned to a slot inside
+ an anchor element to activate the hyperlink on iOS.
+
+ This bug was supposed to be fixed in r206605, and it was still broken on iOS due to the bug in
+ ancestorRespondingToClickEvents. It is now tested by click-text-inside-linked-slot.html.
+
+ Tests: fast/shadow-dom/click-on-slotted-anchor-with-hover.html
+ fast/shadow-dom/click-text-inside-linked-slot.html
+
+ * page/ios/FrameIOS.mm:
+ (WebCore::ancestorRespondingToClickEvents):
+ (WebCore::Frame::qualifyingNodeAtViewportLocation):
+
</ins><span class="cx"> 2016-12-13 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Eliminate SVGPaint and SVGColor
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (209779 => 209780)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ios/FrameIOS.mm        2016-12-13 22:56:28 UTC (rev 209779)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm        2016-12-13 23:22:03 UTC (rev 209780)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> #import "RenderTextControl.h"
</span><span class="cx"> #import "RenderView.h"
</span><span class="cx"> #import "RenderedDocumentMarker.h"
</span><ins>+#import "ShadowRoot.h"
</ins><span class="cx"> #import "TextBoundaries.h"
</span><span class="cx"> #import "TextIterator.h"
</span><span class="cx"> #import "VisiblePosition.h"
</span><span class="lines">@@ -258,8 +259,8 @@
</span><span class="cx"> *nodeBounds = IntRect();
</span><span class="cx">
</span><span class="cx"> Node* pointerCursorNode = nullptr;
</span><del>- for (Node* node = hitTestResult.innerNode(); node && node != terminationNode; node = node->parentNode()) {
- ASSERT(!node->isInShadowTree());
</del><ins>+ for (Node* node = hitTestResult.innerNode(); node && node != terminationNode; node = node->parentInComposedTree()) {
+ ASSERT(!node->isInShadowTree() || node->containingShadowRoot()->mode() != ShadowRootMode::UserAgent);
</ins><span class="cx">
</span><span class="cx"> // We only accept pointer nodes before reaching the body tag.
</span><span class="cx"> if (node->hasTagName(HTMLNames::bodyTag)) {
</span><span class="lines">@@ -405,7 +406,7 @@
</span><span class="cx"> Node* failedNode = candidate;
</span><span class="cx">
</span><span class="cx"> while (candidate && !candidate->isElementNode())
</span><del>- candidate = candidate->parentNode();
</del><ins>+ candidate = candidate->parentInComposedTree();
</ins><span class="cx">
</span><span class="cx"> if (candidate)
</span><span class="cx"> failedNode = candidate;
</span></span></pre>
</div>
</div>
</body>
</html>