- Revision
- 209833
- Author
- [email protected]
- Date
- 2016-12-14 13:57:37 -0800 (Wed, 14 Dec 2016)
Log Message
iOS: An element with tabindex is not focusable unless there is no mouse event handler
https://bugs.webkit.org/show_bug.cgi?id=165843
Reviewed by Antti Koivisto.
Source/WebCore:
The bug was caused by ancestorRespondingToClickEvents not checking the precense of tabindex attribute.
Check that condition along with event listeners.
Test: fast/events/focusing-element-with-tabindex-by-tap-or-click.html
* page/ios/FrameIOS.mm:
(WebCore::ancestorRespondingToClickEvents):
Tools:
Add testRunner.isWebKit2 which is always true in WebKitTestRunner.
Without this, it's really hard to reliably differentiate DumpRenderTree and WebKitTestRunner,
and DumpRenderTree's runUIScript would hit an assertion :(
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::isWebKit2):
LayoutTests:
Added a regression test for focusing an element with just tabindex using UIHelper.
Also fixed UIHelper to work in iOS DumpRenderTree which was hitting an assertion
by explicitly checking testRunner.isWebKit2. Prior to fixing this, it was hitting
an assertion in RunLoop::main() which was asserting that there is a runloop,
which doesn't exist in DumpRenderTree.
* fast/events/focusing-element-with-tabindex-by-tap-or-click-expected.txt: Added.
* fast/events/focusing-element-with-tabindex-by-tap-or-click.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* resources/ui-helper.js:
(window.UIHelper.isWebKit2):
(window.UIHelper.wait): Added the support for js-test.js / js-test-pre.js style tests.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (209832 => 209833)
--- trunk/LayoutTests/ChangeLog 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/LayoutTests/ChangeLog 2016-12-14 21:57:37 UTC (rev 209833)
@@ -1,3 +1,24 @@
+2016-12-14 Ryosuke Niwa <[email protected]>
+
+ iOS: An element with tabindex is not focusable unless there is no mouse event handler
+ https://bugs.webkit.org/show_bug.cgi?id=165843
+
+ Reviewed by Antti Koivisto.
+
+ Added a regression test for focusing an element with just tabindex using UIHelper.
+
+ Also fixed UIHelper to work in iOS DumpRenderTree which was hitting an assertion
+ by explicitly checking testRunner.isWebKit2. Prior to fixing this, it was hitting
+ an assertion in RunLoop::main() which was asserting that there is a runloop,
+ which doesn't exist in DumpRenderTree.
+
+ * fast/events/focusing-element-with-tabindex-by-tap-or-click-expected.txt: Added.
+ * fast/events/focusing-element-with-tabindex-by-tap-or-click.html: Added.
+ * platform/ios-simulator-wk2/TestExpectations:
+ * resources/ui-helper.js:
+ (window.UIHelper.isWebKit2):
+ (window.UIHelper.wait): Added the support for js-test.js / js-test-pre.js style tests.
+
2016-12-14 Dave Hyatt <[email protected]>
[CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
Added: trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click-expected.txt (0 => 209833)
--- trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click-expected.txt 2016-12-14 21:57:37 UTC (rev 209833)
@@ -0,0 +1,15 @@
+This tests tapping or clicking on an element with tabindex would focus the element.
+To manually test, tap or click on each element below. Each element should be focused
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS "Activated contentEditableElement"; document.activeElement is contentEditableElement
+PASS "Activated elementWithTabIndexAndClickHandler"; document.activeElement is elementWithTabIndexAndClickHandler
+PASS "Activated elementWithTabIndex"; document.activeElement is elementWithTabIndex
+PASS successfullyParsed is true
+
+TEST COMPLETE
+An element with contenteditable attribute
+An element with click event handler and tabindex attribute
+An element with tabindex attribute
Added: trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click.html (0 => 209833)
--- trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click.html (rev 0)
+++ trunk/LayoutTests/fast/events/focusing-element-with-tabindex-by-tap-or-click.html 2016-12-14 21:57:37 UTC (rev 209833)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<div id="contentEditableElement" contenteditable>An element with contenteditable attribute</div>
+<section id="elementWithTabIndexAndClickHandler" _onclick_="false" tabindex="0">An element with click event handler and tabindex attribute</section>
+<main id="elementWithTabIndex" tabindex="0">An element with tabindex attribute</main>
+<style>
+div:focus {
+ background: #9cf;
+}
+</style>
+<script>
+
+description('This tests tapping or clicking on an element with tabindex would focus the element.<br>'
+ + 'To manually test, tap or click on each element below. Each element should be focused');
+jsTestIsAsync = true;
+
+async function runTests() {
+ await UIHelper.activateAt(contentEditableElement.offsetLeft + 5, contentEditableElement.offsetTop + 5);
+ shouldBe('"Activated contentEditableElement"; document.activeElement', 'contentEditableElement');
+
+ await UIHelper.activateAt(elementWithTabIndexAndClickHandler.offsetLeft + 5, elementWithTabIndexAndClickHandler.offsetTop + 5);
+ shouldBe('"Activated elementWithTabIndexAndClickHandler"; document.activeElement', 'elementWithTabIndexAndClickHandler');
+
+ await UIHelper.activateAt(elementWithTabIndex.offsetLeft + 5, elementWithTabIndex.offsetTop + 5);
+ shouldBe('"Activated elementWithTabIndex"; document.activeElement', 'elementWithTabIndex');
+}
+
+UIHelper.wait(runTests());
+
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (209832 => 209833)
--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2016-12-14 21:57:37 UTC (rev 209833)
@@ -1774,6 +1774,7 @@
webkit.org/b/123431 http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html [ Pass Failure ]
# eventSender.mouseDown is not implemented
+fast/events/focusing-element-with-tabindex-by-tap-or-click.html [ Skip ]
fast/loader/location-hash-user-gesture.html [ Skip ]
imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
fast/dom/Window/post-message-user-action.html [ Skip ]
@@ -1780,10 +1781,10 @@
fast/images/image-usemap-parsing.html [ Skip ]
fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
-fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html
-fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html
-fast/shadow-dom/fullscreen-in-slot-fullscreenElement.html
-fast/shadow-dom/fullscreen-in-slot-webkitCurrentFullScreenElement.html
+fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html [ Skip ]
+fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html [ Skip ]
+fast/shadow-dom/fullscreen-in-slot-fullscreenElement.html [ Skip ]
+fast/shadow-dom/fullscreen-in-slot-webkitCurrentFullScreenElement.html [ Skip ]
# No touch events
http/tests/contentdispositionattachmentsandbox/referer-header-stripped-with-meta-referer-always.html [ Skip ]
Modified: trunk/LayoutTests/resources/ui-helper.js (209832 => 209833)
--- trunk/LayoutTests/resources/ui-helper.js 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/LayoutTests/resources/ui-helper.js 2016-12-14 21:57:37 UTC (rev 209833)
@@ -5,9 +5,14 @@
return navigator.userAgent.includes('iPhone');
}
+ static isWebKit2()
+ {
+ return window.testRunner.isWebKit2;
+ }
+
static activateAt(x, y)
{
- if (!testRunner.runUIScript || !this.isIOS()) {
+ if (!this.isWebKit2() || !this.isIOS()) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
@@ -25,8 +30,16 @@
static wait(promise)
{
testRunner.waitUntilDone();
- return promise.then(
- function () { testRunner.notifyDone(); },
- function (error) { testRunner.notifyDone(); return Promise.reject(error); });
+ if (window.finishJSTest)
+ window.jsTestIsAsync = true;
+
+ let finish = () => {
+ if (window.finishJSTest)
+ finishJSTest();
+ else
+ testRunner.notifyDone();
+ }
+
+ return promise.then(finish, finish);
}
}
Modified: trunk/Source/WebCore/ChangeLog (209832 => 209833)
--- trunk/Source/WebCore/ChangeLog 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/Source/WebCore/ChangeLog 2016-12-14 21:57:37 UTC (rev 209833)
@@ -1,3 +1,18 @@
+2016-12-14 Ryosuke Niwa <[email protected]>
+
+ iOS: An element with tabindex is not focusable unless there is no mouse event handler
+ https://bugs.webkit.org/show_bug.cgi?id=165843
+
+ Reviewed by Antti Koivisto.
+
+ The bug was caused by ancestorRespondingToClickEvents not checking the precense of tabindex attribute.
+ Check that condition along with event listeners.
+
+ Test: fast/events/focusing-element-with-tabindex-by-tap-or-click.html
+
+ * page/ios/FrameIOS.mm:
+ (WebCore::ancestorRespondingToClickEvents):
+
2016-12-14 Alex Christensen <[email protected]>
Progress towards using ANGLE to do WebGL rendering
Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (209832 => 209833)
--- trunk/Source/WebCore/page/ios/FrameIOS.mm 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm 2016-12-14 21:57:37 UTC (rev 209833)
@@ -260,8 +260,6 @@
Node* pointerCursorNode = nullptr;
for (Node* node = hitTestResult.innerNode(); node && node != terminationNode; node = node->parentInComposedTree()) {
- ASSERT(!node->isInShadowTree() || node->containingShadowRoot()->mode() != ShadowRootMode::UserAgent);
-
// We only accept pointer nodes before reaching the body tag.
if (node->hasTagName(HTMLNames::bodyTag)) {
#if USE(UIKIT_EDITING)
@@ -284,7 +282,7 @@
else if (pointerCursorNode)
pointerCursorStillValid = false;
- if (node->willRespondToMouseClickEvents() || node->willRespondToMouseMoveEvents()) {
+ if (node->willRespondToMouseClickEvents() || node->willRespondToMouseMoveEvents() || (is<Element>(*node) && downcast<Element>(*node).isMouseFocusable())) {
// If we're at the body or higher, use the pointer cursor node (which may be null).
if (bodyHasBeenReached)
node = pointerCursorNode;
Modified: trunk/Tools/ChangeLog (209832 => 209833)
--- trunk/Tools/ChangeLog 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/Tools/ChangeLog 2016-12-14 21:57:37 UTC (rev 209833)
@@ -1,3 +1,18 @@
+2016-12-14 Ryosuke Niwa <[email protected]>
+
+ iOS: An element with tabindex is not focusable unless there is no mouse event handler
+ https://bugs.webkit.org/show_bug.cgi?id=165843
+
+ Reviewed by Antti Koivisto.
+
+ Add testRunner.isWebKit2 which is always true in WebKitTestRunner.
+ Without this, it's really hard to reliably differentiate DumpRenderTree and WebKitTestRunner,
+ and DumpRenderTree's runUIScript would hit an assertion :(
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ (WTR::TestRunner::isWebKit2):
+
2016-12-14 Brady Eidson <[email protected]>
IndexedDB 2.0: Massively speedup IDBIndex.get().
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (209832 => 209833)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-12-14 21:57:37 UTC (rev 209833)
@@ -24,6 +24,8 @@
*/
interface TestRunner {
+ readonly attribute boolean isWebKit2;
+
// The basics.
void dumpAsText(boolean dumpPixels);
void dumpChildFramesAsText();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (209832 => 209833)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-12-14 21:45:28 UTC (rev 209832)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-12-14 21:57:37 UTC (rev 209833)
@@ -60,6 +60,8 @@
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
+ bool isWebKit2() const { return true; }
+
// The basics.
WKURLRef testURL() const { return m_testURL.get(); }
void setTestURL(WKURLRef url) { m_testURL = url; }