Title: [285449] trunk
Revision
285449
Author
[email protected]
Date
2021-11-08 17:04:43 -0800 (Mon, 08 Nov 2021)

Log Message

REGRESSION (r283935): [ macOS wk1 ] imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=231918
<rdar://problem/84393055>

Reviewed by Wenson Hsieh.

Source/WebCore:

Our "flush autofocus candidates" algorithm wasn't quite matching the specification [1].
In particular, we were incorrectly removing a candidate from the list when not ready
to autofocus due to loading CSS stylesheets.

The spec says to remove the candidate from the list at step 5.6. We should check the stylesheet
counter at step 5.5, and return early, *before* removing the candidate from the list.

[1] https://html.spec.whatwg.org/multipage/interaction.html#flush-autofocus-candidates

No new tests, unskipped existing test.

* dom/Document.cpp:
(WebCore::Document::flushAutofocusCandidates):

LayoutTests:

Unskip test that should no longer be flaky.

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285448 => 285449)


--- trunk/LayoutTests/ChangeLog	2021-11-09 00:59:13 UTC (rev 285448)
+++ trunk/LayoutTests/ChangeLog	2021-11-09 01:04:43 UTC (rev 285449)
@@ -1,3 +1,15 @@
+2021-11-08  Chris Dumez  <[email protected]>
+
+        REGRESSION (r283935): [ macOS wk1 ] imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=231918
+        <rdar://problem/84393055>
+
+        Reviewed by Wenson Hsieh.
+
+        Unskip test that should no longer be flaky.
+
+        * platform/mac-wk1/TestExpectations:
+
 2021-11-08  Devin Rousso  <[email protected]>
 
         [Payment Request] Add a new payment method for showing AMS UI

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (285448 => 285449)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-11-09 00:59:13 UTC (rev 285448)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-11-09 01:04:43 UTC (rev 285449)
@@ -783,11 +783,8 @@
 
 webkit.org/b/184456 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-in-object-fallback.html [ Pass Failure ]
 
-webkit.org/b/231918 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html [ Pass Failure ]
 webkit.org/b/231918 imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/focus-autofocus.html [ Pass Failure ]
 
-webkit.org/b/232042 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.html [ Pass Failure ] 
-
 webkit.org/b/184569 [ Debug ] animations/missing-from-to.html [ Skip ]
 
 webkit.org/b/184458 media/remote-control-command-is-user-gesture.html [ Pass Timeout ]

Modified: trunk/Source/WebCore/ChangeLog (285448 => 285449)


--- trunk/Source/WebCore/ChangeLog	2021-11-09 00:59:13 UTC (rev 285448)
+++ trunk/Source/WebCore/ChangeLog	2021-11-09 01:04:43 UTC (rev 285449)
@@ -1,3 +1,25 @@
+2021-11-08  Chris Dumez  <[email protected]>
+
+        REGRESSION (r283935): [ macOS wk1 ] imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=231918
+        <rdar://problem/84393055>
+
+        Reviewed by Wenson Hsieh.
+
+        Our "flush autofocus candidates" algorithm wasn't quite matching the specification [1].
+        In particular, we were incorrectly removing a candidate from the list when not ready
+        to autofocus due to loading CSS stylesheets.
+
+        The spec says to remove the candidate from the list at step 5.6. We should check the stylesheet
+        counter at step 5.5, and return early, *before* removing the candidate from the list.
+
+        [1] https://html.spec.whatwg.org/multipage/interaction.html#flush-autofocus-candidates
+
+        No new tests, unskipped existing test.
+
+        * dom/Document.cpp:
+        (WebCore::Document::flushAutofocusCandidates):
+
 2021-11-08  Devin Rousso  <[email protected]>
 
         [Payment Request] Add a new payment method for showing AMS UI

Modified: trunk/Source/WebCore/dom/Document.cpp (285448 => 285449)


--- trunk/Source/WebCore/dom/Document.cpp	2021-11-09 00:59:13 UTC (rev 285448)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-11-09 01:04:43 UTC (rev 285449)
@@ -4526,11 +4526,14 @@
     if (m_isAutofocusProcessed)
         return;
     while (!m_autofocusCandidates.isEmpty()) {
-        RefPtr element = m_autofocusCandidates.takeFirst().get();
-        if (!element || !element->document().isFullyActive() || &element->document().topDocument() != this)
+        RefPtr element = m_autofocusCandidates.first().get();
+        if (!element || !element->document().isFullyActive() || &element->document().topDocument() != this) {
+            m_autofocusCandidates.removeFirst();
             continue;
+        }
         if (auto* parser = scriptableDocumentParser(); parser && parser->hasScriptsWaitingForStylesheets())
             break;
+        m_autofocusCandidates.removeFirst();
         // FIXME: Need to ignore if the inclusive ancestor documents has a target element.
         // FIXME: Use the result of getting the focusable area for element if element is not focusable.
         if (element->isFocusable()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to