Bug 230845 - Remove Node::deprecatedIsInert
Summary: Remove Node::deprecatedIsInert
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Nguyen (:ntim)
URL:
Keywords: InRadar
: 237054 (view as bug list)
Depends on:
Blocks: dialog-element 165279
  Show dependency treegraph
 
Reported: 2021-09-27 09:26 PDT by Tim Nguyen (:ntim)
Modified: 2022-02-27 01:49 PST (History)
12 users (show)

See Also:


Attachments
Patch (10.35 KB, patch)
2022-02-01 01:22 PST, Tim Nguyen (:ntim)
koivisto: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
[fast-cq] Patch (15.06 KB, patch)
2022-02-26 02:34 PST, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Nguyen (:ntim) 2021-09-27 09:26:39 PDT
There's a invalidation bug in the cached computed style preventing the only usage of Node::deprecatedIsInert in Element::isFocusable in favor of RenderStyle::effectiveInert.
Comment 1 Radar WebKit Bug Importer 2021-10-01 02:21:24 PDT
<rdar://problem/83757966>
Comment 2 Ryosuke Niwa 2022-01-02 18:19:58 PST
yeah, I don't think we should do this. This would require that Element::isFocusable() to rely on the latest style information. That's not tenable given this function needs to be fast and avoid style recalc.

I really don't think we should have designed the concept of inert to rely on style resolution at all.
Comment 3 Tim Nguyen (:ntim) 2022-01-30 10:42:02 PST
(In reply to Ryosuke Niwa from comment #2)
> yeah, I don't think we should do this. This would require that
> Element::isFocusable() to rely on the latest style information. That's not
> tenable given this function needs to be fast and avoid style recalc.
> 
> I really don't think we should have designed the concept of inert to rely on
> style resolution at all.

The idea is to re-use isVisibleWithoutResolvingFullStyle (used by isFocusable), which does not resolve the full style. The problem is that the style is not invalidated correctly in some cases.

https://webkit-search.igalia.com/webkit/rev/fb57dd12e0db42483fce7f5e75a2e4ab66ae11a9/Source/WebCore/dom/Element.cpp#3553

So we already consult the style right now in Element::isFocusable for display/visibility, this would just add effectiveInert in it. I don't think this would be slower, since the style is already consulted for those 2 properties anyway.
Comment 4 Tim Nguyen (:ntim) 2022-01-30 10:43:59 PST
I would argue this would be faster, since effectiveInert is just a style bit that can be looked at once we consulted the style for display/visibility, while Node::deprecatedIsInert requires some DOM tree walks.
Comment 5 Tim Nguyen (:ntim) 2022-02-01 01:22:18 PST
Created attachment 450506 [details]
Patch
Comment 6 Antti Koivisto 2022-02-01 01:31:11 PST
Comment on attachment 450506 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450506&action=review

> LayoutTests/imported/w3c/ChangeLog:9
> +        This change unfortunately regresses focusability state when dynamically setting inert, due to a cached
> +        computed style invalidation bug.

Can you also explain why these regressions are minor in practice?
Comment 7 Tim Nguyen (:ntim) 2022-02-26 02:34:25 PST
Created attachment 453290 [details]
[fast-cq] Patch
Comment 8 EWS 2022-02-26 23:07:49 PST
Committed r290554 (247832@main): <https://commits.webkit.org/247832@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453290 [details].
Comment 9 Tim Nguyen (:ntim) 2022-02-27 01:48:29 PST
This actually fixed bug 237054!
Comment 10 Tim Nguyen (:ntim) 2022-02-27 01:49:07 PST
*** Bug 237054 has been marked as a duplicate of this bug. ***