Skip to content

Implement focus fixup rule - #6069

Closed
nt1m wants to merge 1 commit into
WebKit:mainfrom
nt1m:eng/focus-fixup-rule
Closed

nt1m wants to merge 1 commit into
WebKit:mainfrom
nt1m:eng/focus-fixup-rule

Conversation

@nt1m

@nt1m nt1m commented Nov 3, 2022 •

Copy link
Copy Markdown
Member

f67e8bf

Implement focus fixup rule
https://bugs.webkit.org/show_bug.cgi?id=237273
rdar://89902824

Reviewed by NOBODY (OOPS!).

It's currently specced at whatwg/html#8392 as a rendering step after requestAnimationFrame callbacks.

* LayoutTests/imported/w3c/web-platform-tests/inert/dynamic-inert-on-focused-element-expected.txt:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateRendering):
(WebCore::operator<<):
* Source/WebCore/page/Page.h:

f67e8bf

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 🧪 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl ❌ 🧪 ios-wk2 ✅ 🛠 mac-AS-debug ✅ 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 api-mac ✅ 🧪 api-gtk
✅ 🛠 tv ❌ 🧪 mac-wk1
✅ 🛠 tv-sim ❌ 🧪 mac-wk2
✅ 🛠 watch ❌ 🧪 mac-AS-debug-wk2
✅ 🛠 watch-sim ✅ 🧪 mac-wk2-stress

https://bugs.webkit.org/show_bug.cgi?id=237273
rdar://89902824

Reviewed by NOBODY (OOPS!).

It's currently specced at whatwg/html#8392 as a rendering step after requestAnimationFrame callbacks.

* LayoutTests/imported/w3c/web-platform-tests/inert/dynamic-inert-on-focused-element-expected.txt:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateRendering):
(WebCore::operator<<):
* Source/WebCore/page/Page.h:
@nt1m
nt1m requested a review from cdumez as a code owner November 3, 2022 01:51
@nt1m nt1m self-assigned this Nov 3, 2022
@nt1m nt1m added DOM For bugs specific to XML/HTML DOM elements (including parsing). WebKit Nightly Build labels Nov 3, 2022
@nt1m
nt1m requested review from rniwa, smfr and whsieh November 3, 2022 01:54
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 3, 2022
@nt1m
nt1m marked this pull request as draft November 4, 2022 05:13
});

runProcessingStep(RenderingUpdateStep::FocusFixupRule, [] (Document& document) {
if (auto* activeElement = document.activeElement()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use RefPtr.


runProcessingStep(RenderingUpdateStep::FocusFixupRule, [] (Document& document) {
if (auto* activeElement = document.activeElement()) {
if (auto* root = activeElement->shadowRoot(); root && root->activeElement())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right. This root's activeElement may in turn be inside another shadow root.

We clearly need more tests. One where there are multiple nested shadow trees.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should probably start from document.focusedElement() and walk the tree upwards instead. Instead of keep walking up the tree multiple times in TreeScope::focusedElementInScope()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That may be the source of the test failures I'm seeing.


runProcessingStep(RenderingUpdateStep::FocusFixupRule, [] (Document& document) {
if (auto* activeElement = document.activeElement()) {
if (auto* root = activeElement->shadowRoot(); root && root->activeElement())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right. This root's activeElement may in turn be inside another shadow root.

We clearly need more tests. One where there are multiple nested shadow trees.

@nt1m

nt1m commented Feb 8, 2023 •

Copy link
Copy Markdown
Member Author

Superseded by #9835

@nt1m nt1m closed this Feb 8, 2023
@nt1m
nt1m deleted the eng/focus-fixup-rule branch February 8, 2023 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DOM For bugs specific to XML/HTML DOM elements (including parsing). merging-blocked Applied to prevent a change from being merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants