Title: [250823] trunk/LayoutTests
Revision
250823
Author
[email protected]
Date
2019-10-08 06:56:50 -0700 (Tue, 08 Oct 2019)

Log Message

Import autofocus Web Platform Tests
https://bugs.webkit.org/show_bug.cgi?id=202641

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import web platform tests for autofocus, and remove duplicated test from
http/wpt/html/semantics/forms/autofocus.

* resources/import-expectations.json:
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus-expected.txt: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub-expected.txt.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html: Copied from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/resources/child-autofocus.html.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css: Added.
(#first):
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js: Added.
(waitForEvent):
(timeOut):
(async.waitUntilStableAutofocusState):
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/w3c-import.log: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html: Added.
* web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log: Added.

LayoutTests:

* platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.

Modified Paths

Added Paths

Removed Paths

  • trunk/LayoutTests/http/wpt/html/semantics/forms/

Diff

Modified: trunk/LayoutTests/ChangeLog (250822 => 250823)


--- trunk/LayoutTests/ChangeLog	2019-10-08 12:51:36 UTC (rev 250822)
+++ trunk/LayoutTests/ChangeLog	2019-10-08 13:56:50 UTC (rev 250823)
@@ -1,3 +1,13 @@
+2019-10-08  Ali Juma  <[email protected]>
+
+        Import autofocus Web Platform Tests
+        https://bugs.webkit.org/show_bug.cgi?id=202641
+
+        Reviewed by Ryosuke Niwa.
+
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.
+        * platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.
+
 2019-10-08  Antti Koivisto  <[email protected]>
 
         [CSS Shadow Parts] Implement style invalidation

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (250822 => 250823)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-08 12:51:36 UTC (rev 250822)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-08 13:56:50 UTC (rev 250823)
@@ -1,3 +1,66 @@
+2019-10-08  Ali Juma  <[email protected]>
+
+        Import autofocus Web Platform Tests
+        https://bugs.webkit.org/show_bug.cgi?id=202641
+
+        Reviewed by Ryosuke Niwa.
+
+        Import web platform tests for autofocus, and remove duplicated test from
+        http/wpt/html/semantics/forms/autofocus.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus-expected.txt: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub-expected.txt.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html: Copied from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/resources/child-autofocus.html.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css: Added.
+        (#first):
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js: Added.
+        (waitForEvent):
+        (timeOut):
+        (async.waitUntilStableAutofocusState):
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/w3c-import.log: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html: Renamed from LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html: Added.
+        * web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log: Added.
+
 2019-10-08  Rob Buis  <[email protected]>
 
         Fetch: data: URL HEAD request should result in empty response body

Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (250822 => 250823)


--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2019-10-08 12:51:36 UTC (rev 250822)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2019-10-08 13:56:50 UTC (rev 250823)
@@ -199,6 +199,7 @@
     "web-platform-tests/html/iana": "skip", 
     "web-platform-tests/html/infrastructure": "skip", 
     "web-platform-tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers": "skip", 
+    "web-platform-tests/html/interaction/focus/the-autofocus-attribute": "import", 
     "web-platform-tests/html/obsolete": "skip", 
     "web-platform-tests/html/rendering": "skip", 
     "web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives": "skip", 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,3 @@
+
+PASS Autofocus element in not-fully-active document should not be queued. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  let doc = document.cloneNode(false);
+  doc.appendChild(doc.createElement('html'))
+  doc.firstChild.innerHTML = '<body><input autofocus/></body>';
+  await waitUntilStableAutofocusState();
+  assert_equals(doc.activeElement, doc.body);
+}, 'Autofocus element in not-fully-active document should not be queued.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+PASS Autofocus should work if an element with autofocus is inserted into a document which was loaded some time ago. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<body>
+<script>
+'use strict';
+
+promise_test(async t => {
+  await waitForLoad(window);
+  await timeOut(t, 1000);
+  let element = document.createElement('input');
+  element.autofocus = true;
+  document.body.appendChild(element);
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, element);
+}, 'Autofocus should work if an element with autofocus is inserted into a ' +
+    'document which was loaded some time ago.');
+</script>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+ 
+
+FAIL The first autofocus element in the document should win. assert_equals: expected Element node <input autofocus=""></input> but got Element node <input autofocus=""></input>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+PASS The second autofocus element wins if the first autofocus element was disconnected and reconnected before flushing the autofocus candidates. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script src=""
+
+<input autofocus id="i1">
+<input autofocus id="i2">
+<script>
+"use strict";
+
+promise_test(async () => {
+  const input1 = document.querySelector("#i1");
+  const input2 = document.querySelector("#i2");
+  input1.remove();
+  input2.parentNode.insertBefore(input1, input2);
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input2);
+}, 'The second autofocus element wins if the first autofocus element was ' +
+   'disconnected and reconnected before flushing the autofocus candidates.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+PASS The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree</title>
+<link rel="help" href=""
+<link rel="author" title="Domenic Denicola" href=""
+
+<script src=""
+<script src=""
+<script src=""
+
+<input autofocus>
+
+<script>
+"use strict";
+
+promise_test(async () => {
+  const input1 = document.querySelector("input");
+  const input2 = document.createElement("input");
+  input2.autofocus = true;
+  document.body.prepend(input2);
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input1);
+  assert_not_equals(document.activeElement, input2);
+}, 'The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+  
+
+FAIL The first autofocus in the document wins, even if elements are inserted later. assert_equals: expected Element node <input autofocus=""></input> but got Element node <input autofocus=""></input>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>The first autofocus in the document wins, even if elements are inserted later</title>
+<link rel="help" href=""
+<link rel="author" title="Domenic Denicola" href=""
+
+<script src=""
+<script src=""
+<script src=""
+
+<input autofocus>
+
+<script>
+"use strict";
+
+promise_test(async () => {
+  const input1 = document.querySelector("input");
+  const input2 = document.createElement("input");
+  input2.autofocus = true;
+  document.body.appendChild(input2);
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input1);
+  assert_not_equals(document.activeElement, input2);
+}, 'The first autofocus in the document wins, even if elements are inserted later.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>The first autofocus in the document wins</title>
+<link rel="help" href=""
+<link rel="author" title="Domenic Denicola" href=""
+
+<script src=""
+<script src=""
+<script src=""
+
+<input autofocus>
+<input autofocus>
+
+<script>
+"use strict";
+
+promise_test(async () => {
+  const [input1, input2] = document.querySelectorAll("input");
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input1);
+  assert_not_equals(document.activeElement, input2);
+}, 'The first autofocus element in the document should win.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+  
+
+FAIL If topDocument's focused area is not topDocument, autofocus is not processed. assert_equals: activeElement should not be changed expected Element node <iframe srcdoc="<input><script>document.querySelector('in... but got Element node <input autofocus=""></input>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<iframe srcdoc="<input><script>document.querySelector('input').focus();</script>"></iframe>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  await waitForLoad(window);
+  let iframe = document.querySelector('iframe');
+  assert_equals(document.activeElement, iframe, 'Prereq: IFRAME should be focused');
+
+  let input = document.createElement('input');
+  input.autofocus = true;
+  document.body.appendChild(input);
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, iframe, 'activeElement should not be changed');
+  assert_not_equals(document.activeElement, input);
+}, 'If topDocument\'s focused area is not topDocument, autofocus is not processed.');
+</script>

Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus-expected.txt (from rev 250822, trunk/LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub-expected.txt) (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: Blocked autofocusing on a form control in a cross-origin subframe.
+Autofocus shouldn't work in cross-origin iframe.
+
+
+
+PASS Autofocus shouldn't work in cross-origin iframe 
+

Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html (from rev 250822, trunk/LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html) (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+  <h1>Autofocus shouldn't work in cross-origin iframe.</h1>
+  <iframe id="child" width="200" height="100"></iframe>
+
+  <script>
+    let parent_loaded = false;
+    let child_loaded = false;
+
+    async_test(function(t) {
+      function pingChildIfBothFramesLoaded() {
+        if (parent_loaded && child_loaded)
+          frames[0].postMessage("report_focus_state", "*");
+      }
+
+      window.addEventListener("load", t.step_func(event => {
+        parent_loaded = true;
+        pingChildIfBothFramesLoaded();
+      }));
+
+      window.addEventListener("message", t.step_func(event => {
+        if (event.data == "child_loaded") {
+          child_loaded = true;
+          pingChildIfBothFramesLoaded();
+        } else if (event.data == "child_is_focused") {
+          assert_unreached("The iframe shouldn't get focus");
+        } else if (event.data == "child_is_not_focused") {
+          t.done();
+        }
+      }));
+      document.getElementById("child").src =
+          get_host_info().HTTP_REMOTE_ORIGIN + "/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html";
+    }, "Autofocus shouldn't work in cross-origin iframe");
+  </script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.
+
+
+PASS If the sandboxed automatic features browsing context flag is set, autofocus in the browsing context should not be handled. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<iframe sandbox srcdoc="<input autofocus>"></iframe>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  await waitForLoad(window);
+  await waitUntilStableAutofocusState();
+  assert_not_equals(document.activeElement, document.querySelector('iframe'));
+}, 'If the sandboxed automatic features browsing context flag is set, ' +
+    'autofocus in the browsing context should not be handled.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+ 
+
+PASS The element is not focused during the initial parsing task 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>The element is not focused during the initial parsing task</title>
+<link rel="help" href=""
+<link rel="author" title="Domenic Denicola" href=""
+
+<script src=""
+<script src=""
+
+<input autofocus>
+<input autofocus>
+
+<script>
+"use strict";
+
+const input = document.querySelector("input");
+
+assert_equals(document.activeElement, document.body);
+assert_not_equals(document.activeElement, input);
+
+done();
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+ 
+
+FAIL If the first autofocus element is not focusable, but becomes focusable before a frame, it should be focused. assert_equals: expected Element node <textarea autofocus=""></textarea> but got Element node <select autofocus=""></select>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<textarea autofocus disabled></textarea>
+<select autofocus></select>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  const [textarea, select] = document.querySelectorAll('[autofocus]');
+  textarea.disabled = false;
+
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, textarea);
+  assert_not_equals(document.activeElement, select);
+}, 'If the first autofocus element is not focusable, but becomes focusable before a frame, it should be focused.');
+</script>

Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html (from rev 250822, trunk/LayoutTests/http/wpt/html/semantics/forms/autofocus/resources/child-autofocus.html) (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<input id="target" value="This should be unfocused!" autofocus></input>
+
+<script>
+  let got_focus = false;
+  document.getElementById("target").addEventListener("focus", () => {
+    got_focus = true;
+  });
+
+  window.addEventListener("load", () => {
+    parent.postMessage("child_loaded", "*");
+  });
+
+  window.addEventListener("message", event => {
+    if (event.data == "report_focus_state") {
+      let msg = got_focus ? "child_is_focused" : "child_is_not_focused";
+      parent.postMessage(msg, "*");
+    }
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src=""
+<iframe id="iframe" width="200" height="100"></iframe>
+
+<script>
+  iframe.src =
+    get_host_info().ORIGIN + "/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html";
+  window.addEventListener("message", event => {
+    if (event.data == "grand_child_loaded") {
+      parent.postMessage("ready", "*");
+    } else if (event.data == "report_focus_state") {
+      frames[0].postMessage("report_focus_state", "*");
+    } else if (event.data == "grand_child_is_focused" ||
+               event.data == "grand_child_is_not_focused") {
+      parent.postMessage(event.data, "*");
+    }
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,3 @@
+#first {
+  display: none;
+}

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<body>
+<div id="anchor1"></div>
+<input autofocus>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<input id="target" value="This should be focused!" autofocus></input>
+
+<script>
+  let got_focus = false;
+  target.addEventListener("focus", () => got_focus = true);
+
+  window.addEventListener("load", () => {
+    parent.postMessage("grand_child_loaded", "*");
+  });
+
+  window.addEventListener("message", event => {
+    if (event.data == "report_focus_state") {
+      let msg = got_focus ? "grand_child_is_focused" : "grand_child_is_not_focused";
+      parent.postMessage(msg, "*");
+    }
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<body>
+<script>
+const input = document.createElement('input');
+input.autofocus = true;
+document.body.appendChild(input);
+input.autofocus = false;
+window.opener.document.body.appendChild(input);
+</script>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,42 @@
+'use strict';
+
+function waitForEvent(target, type, options) {
+  return new Promise((resolve, reject) => {
+    target.addEventListener(type, resolve, options);
+  });
+}
+
+function waitForAnimationFrame(w) {
+  let targetWindow = w || window;
+  return new Promise((resolve, reject) => {
+    targetWindow.requestAnimationFrame(resolve);
+  });
+}
+
+function waitForEvent(target, type, options) {
+  return new Promise((resolve, reject) => {
+    target.addEventListener(type, resolve, options);
+  });
+}
+
+function waitForLoad(target) {
+  return waitForEvent(target, 'load');
+}
+
+function timeOut(test, ms) {
+  return new Promise((resolve, reject) => {
+    test.step_timeout(resolve, ms);
+  });
+}
+
+// If an element with autofocus is connected to a document and this function
+// is called, the autofocus result is deterministic after returning from the
+// function.
+// Exception: If the document has script-blocking style sheets, this function
+// doesn't work well.
+async function waitUntilStableAutofocusState(w) {
+  let targetWindow = w || window;
+  // Awaiting two animation frames is an easy way to determine autofocus state.
+  await waitForAnimationFrame(targetWindow);
+  await waitForAnimationFrame(targetWindow);
+}

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/w3c-import.log (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/w3c-import.log	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,23 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-autofocus.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/erase-first.css
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/frame-with-autofocus-element.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/moving-autofocus-to-parent.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/resources/utils.js

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,6 @@
+Autofocus should work in the same origin grand child iframe.
+
+
+
+PASS Autofocus should work in the same origin grand child iframe 
+

Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html (from rev 250822, trunk/LayoutTests/http/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html) (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="assert" content="`autofocus` should work in the same origin iframe even if there is a cross-origin iframe between the parent and the same origin iframe">
+<title>autofocus in the same origin grand child iframe</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+  <h1>Autofocus should work in the same origin grand child iframe.</h1>
+  <iframe id="child" width="200" height="100"></iframe>
+  <script>
+    let parent_loaded = false;
+    let grand_child_loaded = false;
+
+    async_test(function(t) {
+      function pingChildIfBothFramesLoaded() {
+        if (parent_loaded && grand_child_loaded)
+          frames[0].postMessage("report_focus_state", "*");
+      }
+
+      window.addEventListener("load", t.step_func(event => {
+        parent_loaded = true;
+        pingChildIfBothFramesLoaded();
+      }));
+
+      window.addEventListener("message", t.step_func(event => {
+        if (event.data == "ready") {
+          grand_child_loaded = true;
+          pingChildIfBothFramesLoaded();
+        } else if (event.data == "grand_child_is_focused") {
+          t.done();
+        } else if (event.data == "grand_child_is_not_focused") {
+          assert_unreached("The iframe shouldn't get focus");
+        }
+      }));
+      document.getElementById("child").src =
+          get_host_info().HTTP_NOTSAMESITE_ORIGIN + "/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html";
+    }, "Autofocus should work in the same origin grand child iframe");
+  </script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+PASS Autofocus elements queued in another top-level browsing context's documents should be skipped. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+<script>
+'use strict';
+
+promise_test(async () => {
+  let w = window.open('resources/moving-autofocus-to-parent.html');
+  await waitForLoad(w);
+  await waitUntilStableAutofocusState(w);
+  assert_equals(w.document.activeElement, w.document.body);
+  assert_equals(document.activeElement, document.body);
+  w.close();
+}, 'Autofocus elements queued in another top-level browsing context\'s ' +
+   'documents should be skipped.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,9 @@
+ 
+
+FAIL Autofocus elements in iframed documents with URL fragments should be skipped. assert_equals: Autofocus elements in iframes should not be focused. expected Element node <body><iframe src="" but got Element node <iframe src=""
+FAIL Autofocus elements in top-level browsing context's documents with URI fragments should be skipped. assert_equals: expected Element node <body>
+<div id="anchor1"></div>
+<input autofocus="">
+
+</b... but got Element node <input autofocus=""></input>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<iframe src=""
+<iframe src=""
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  await waitForLoad(window);
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, document.body,
+      'Autofocus elements in iframes should not be focused.');
+
+  let input = document.createElement('input');
+  input.autofocus = true;
+  document.body.appendChild(input);
+  await waitUntilStableAutofocusState();
+  assert_equals(document.activeElement, input);
+}, 'Autofocus elements in iframed documents with URL fragments should be skipped.');
+
+promise_test(async () => {
+  let w = window.open('resources/frame-with-autofocus-element.html#xpointer(//body)');
+  await waitForLoad(w);
+  await waitUntilStableAutofocusState(w);
+  assert_equals(w.document.activeElement, w.document.body);
+  w.close();
+}, 'Autofocus elements in top-level browsing context\'s documents with URI fragments should be skipped.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+ 
+
+PASS Non-focusable autofocus element is skipped. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<textarea autofocus disabled></textarea>
+<select autofocus></select>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  const [textarea, select] = document.querySelectorAll('[autofocus]');
+
+  await waitUntilStableAutofocusState();
+  assert_not_equals(document.activeElement, textarea);
+  assert_equals(document.activeElement, select);
+}, 'Non-focusable autofocus element is skipped.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,3 @@
+
+PASS Autofocus element in not-fully-active document should be skipped while flusing. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+
+<iframe srcdoc="<input autofocus><script>window.frameElement.remove();</script>"></iframe>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  let iframe = document.querySelector('iframe');
+  let iframeDocument = iframe.contentDocument;
+  await waitForLoad(window);
+  assert_not_equals(document.activeElement, iframe);
+  assert_equals(iframeDocument.activeElement, iframeDocument.body);
+}, 'Autofocus element in not-fully-active document should be skipped while flusing.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+PASS Script-blocking style sheet should pause flushing autofocus candidates. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+<link rel="stylesheet" href=""
+
+<input id="first" autofocus>
+<input id="second" autofocus>
+
+<script>
+'use strict';
+
+promise_test(async () => {
+  await waitForEvent(document.body, 'focus', {capture:true});
+  assert_equals(document.activeElement.id, 'second');
+}, 'Script-blocking style sheet should pause flushing autofocus candidates.');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,5 @@
+
+FAIL Contenteditable element should support autofocus assert_equals: expected "DIV" but got "BODY"
+FAIL Element with tabindex should support autofocus assert_equals: expected "SPAN" but got "BODY"
+PASS Non-HTMLElement should not support autofocus 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script src=""
+<script>
+"use strict";
+
+promise_test(async t => {
+  let w = window.open('/common/blank.html');
+  await waitForLoad(w);
+  t.add_cleanup(() => { w.close(); });
+  w.document.body.innerHTML = '<div contenteditable=true autofocus></div>';
+  await waitUntilStableAutofocusState(w);
+  assert_equals(w.document.activeElement.tagName, 'DIV');
+}, 'Contenteditable element should support autofocus');
+
+promise_test(async t => {
+  let w = window.open('/common/blank.html');
+  await waitForLoad(w);
+  t.add_cleanup(() => { w.close(); });
+  w.document.body.innerHTML = '<span tabindex=0 autofocus></span>';
+  await waitUntilStableAutofocusState(w);
+  assert_equals(w.document.activeElement.tagName, 'SPAN');
+}, 'Element with tabindex should support autofocus');
+
+promise_test(async t => {
+  let w = window.open('/common/blank.html');
+  await waitForLoad(w);
+  t.add_cleanup(() => { w.close(); });
+  let element = w.document.createElementNS('uri1', 'prefix:local');
+  element.setAttribute('autofocus', '');
+  w.document.body.appendChild(element);
+  await waitUntilStableAutofocusState(w);
+  assert_equals(w.document.activeElement.tagName, 'BODY');
+}, 'Non-HTMLElement should not support autofocus');
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+FAIL "Flush autofocus candidates" should be happen after the first animation frame callbacks, and before a resize event in the next iteration of window event loop. assert_array_equals: lengths differ, expected 3 got 4
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<link rel="help" href=""
+
+<body>
+<script>
+'use strict';
+
+async_test(t => {
+  t.events = [];
+
+  let iframe = document.createElement('iframe');
+  iframe.addEventListener('load', t.step_func(() => {
+    let w = iframe.contentWindow;
+    w.requestAnimationFrame(t.step_func(() => {
+      t.events.push('animationFrame');
+      w.requestAnimationFrame(t.step_func(() => {
+        t.events.push('animationFrame-should-not-be-recorded');
+      }));
+    }));
+    let element = w.document.createElement('input');
+    element.autofocus = true;
+    element.addEventListener('focus', t.step_func(() => {
+      t.events.push('autofocus');
+      iframe.style.width = '71px';
+    }));
+
+    w.addEventListener('resize', t.step_func_done(() => {
+      t.events.push('resize');
+      assert_array_equals(t.events, ['animationFrame', 'autofocus', 'resize']);
+    }));
+
+    w.document.body.appendChild(element);
+  }));
+  document.body.appendChild(iframe);
+}, '"Flush autofocus candidates" should be happen after the first animation ' +
+    'frame callbacks, and before a resize event in the next iteration of ' +
+    'window event loop.');
+</script>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log (0 => 250823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,35 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-in-not-fully-active-document.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-on-stable-document.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-reconnected.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first-when-later.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/first.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-cross-origin-autofocus.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/no-sandboxed-automatic-features.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/not-on-first-task.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/queue-non-focusable.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/same-origin-autofocus.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-document-with-fragment.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-non-focusable.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/skip-not-fully-active.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/spin-by-blocking-style-sheet.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/supported-elements.html
+/LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html

Added: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt (0 => 250823)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+FAIL "Flush autofocus candidates" should be happen after the first animation frame callbacks, and before a resize event in the next iteration of window event loop. assert_array_equals: property 0, expected "animationFrame" but got "autofocus"
+

Added: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt (0 => 250823)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/update-the-rendering-expected.txt	2019-10-08 13:56:50 UTC (rev 250823)
@@ -0,0 +1,4 @@
+
+
+FAIL "Flush autofocus candidates" should be happen after the first animation frame callbacks, and before a resize event in the next iteration of window event loop. assert_array_equals: lengths differ, expected 3 got 2
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to