RESOLVED FIXED 203139
Implement new autofocus behavior
https://bugs.webkit.org/show_bug.cgi?id=203139
Summary Implement new autofocus behavior
Ryosuke Niwa
Reported 2019-10-17 22:07:56 PDT
autofocus processing model has been updated in https://github.com/whatwg/html/pull/4763 and https://github.com/whatwg/html/pull/5015 Implement that in WebKit.
Attachments
WIP (35.87 KB, patch)
2021-09-13 16:38 PDT, Ryosuke Niwa
no flags
Patch (44.57 KB, patch)
2021-09-27 11:54 PDT, Brent Fulgham
no flags
Patch (35.02 KB, patch)
2021-10-05 03:47 PDT, Tim Nguyen (:ntim)
ews-feeder: commit-queue-
Patch (37.98 KB, patch)
2021-10-05 05:54 PDT, Tim Nguyen (:ntim)
no flags
Patch (39.09 KB, patch)
2021-10-05 07:42 PDT, Tim Nguyen (:ntim)
no flags
Patch (40.14 KB, patch)
2021-10-05 07:48 PDT, Tim Nguyen (:ntim)
no flags
Patch (43.09 KB, patch)
2021-10-06 14:16 PDT, Tim Nguyen (:ntim)
no flags
Patch (44.87 KB, patch)
2021-10-07 00:55 PDT, Tim Nguyen (:ntim)
no flags
Patch (46.02 KB, patch)
2021-10-08 10:41 PDT, Tim Nguyen (:ntim)
no flags
Patch (45.99 KB, patch)
2021-10-08 10:50 PDT, Tim Nguyen (:ntim)
no flags
Patch (45.77 KB, patch)
2021-10-11 08:08 PDT, Tim Nguyen (:ntim)
no flags
Patch (45.94 KB, patch)
2021-10-11 11:55 PDT, Tim Nguyen (:ntim)
no flags
Radar WebKit Bug Importer
Comment 1 2019-10-17 22:09:20 PDT
Ryosuke Niwa
Comment 2 2019-10-17 22:11:13 PDT
*** Bug 129743 has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 3 2019-10-17 22:11:26 PDT
*** Bug 82778 has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 4 2020-09-26 15:25:25 PDT
*** Bug 213982 has been marked as a duplicate of this bug. ***
Kent Tamura
Comment 5 2020-12-09 00:34:40 PST
*** Bug 202651 has been marked as a duplicate of this bug. ***
Kent Tamura
Comment 6 2020-12-09 00:35:06 PST
*** Bug 200913 has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 7 2021-09-13 16:38:33 PDT
Created attachment 438089 [details] WIP Here's some work-in-progress patch.
Brent Fulgham
Comment 8 2021-09-27 11:54:11 PDT
Brent Fulgham
Comment 9 2021-09-27 11:54:47 PDT
Rebased patch for EWS.
Tim Nguyen (:ntim)
Comment 11 2021-10-05 03:47:59 PDT
Tim Nguyen (:ntim)
Comment 12 2021-10-05 05:54:15 PDT
Tim Nguyen (:ntim)
Comment 13 2021-10-05 07:42:30 PDT
Tim Nguyen (:ntim)
Comment 14 2021-10-05 07:48:23 PDT
Simon Fraser (smfr)
Comment 15 2021-10-05 09:01:50 PDT
Comment on attachment 440213 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440213&action=review > Source/WebCore/ChangeLog:9 > + Make WebKit match the new autofocus spec: You should summarize how the old behavior differs from the new behavior here, and what code changes were necessary to implement the new behavior.
Tim Nguyen (:ntim)
Comment 16 2021-10-06 14:16:44 PDT
Tim Nguyen (:ntim)
Comment 17 2021-10-07 00:55:06 PDT
Wenson Hsieh
Comment 18 2021-10-07 19:58:22 PDT
Comment on attachment 440485 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440485&action=review Seems reasonable to me, but it would be good if Simon or Chris could take a look as well. (Also, do we know why form-submission-crash-3.html is timing out on the Windows bot?) > Source/WebCore/dom/Document.cpp:4481 > + m_autofocusCandidates.appendOrMoveToLast(candidate); Should we clear this out elsewhere as well? (e.g. `destroyRenderTree()` or `commonTeardown()`?) > Source/WebCore/dom/Document.cpp:4491 > + for (; !m_autofocusCandidates.isEmpty(); m_autofocusCandidates.removeFirst()) { > + Ref element = m_autofocusCandidates.first(); Nit - I think this might be a bit cleaner with a `while (!m_autofocusCandidates.isEmpty())` loop and `takeFirst()`.
Tim Nguyen (:ntim)
Comment 19 2021-10-08 00:29:02 PDT
(In reply to Wenson Hsieh from comment #18) > Comment on attachment 440485 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=440485&action=review > > Seems reasonable to me, but it would be good if Simon or Chris could take a > look as well. > > (Also, do we know why form-submission-crash-3.html is timing out on the > Windows bot?) Another race between the first rendering update and the onload event :) > > Source/WebCore/dom/Document.cpp:4481 > > + m_autofocusCandidates.appendOrMoveToLast(candidate); > > Should we clear this out elsewhere as well? (e.g. `destroyRenderTree()` or > `commonTeardown()`?) I guess we could clear it in commonTeardown().
Tim Nguyen (:ntim)
Comment 20 2021-10-08 10:41:12 PDT
Tim Nguyen (:ntim)
Comment 21 2021-10-08 10:50:30 PDT
Tim Nguyen (:ntim)
Comment 22 2021-10-11 08:08:21 PDT
Chris Dumez
Comment 23 2021-10-11 08:36:41 PDT
Comment on attachment 440795 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440795&action=review > Source/WebCore/dom/Document.h:1809 > + ListHashSet<Ref<Element>> m_autofocusCandidates; Does this really need to hold a strong ref to the elements? Seems like it shouldn't and it would be less leak-prone to hold WeakPtrs. > Source/WebCore/dom/Document.h:1810 > + bool m_isAutofocusProcessed { false }; Please move this bool next to some other boolean data members for better packing.
Tim Nguyen (:ntim)
Comment 24 2021-10-11 11:55:34 PDT
EWS
Comment 25 2021-10-11 13:59:51 PDT
Committed r283935 (242794@main): <https://commits.webkit.org/242794@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 440812 [details].
Note You need to log in before you can comment on or make changes to this bug.