Bug 239028 - Clean up Element::isFocusableWithoutResolvingFullStyle()
Summary: Clean up Element::isFocusableWithoutResolvingFullStyle()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Nguyen (:ntim)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-09 06:49 PDT by Tim Nguyen (:ntim)
Modified: 2022-04-19 02:30 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.36 KB, patch)
2022-04-09 06:52 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (2.30 KB, patch)
2022-04-18 12:13 PDT, Tim Nguyen (:ntim)
koivisto: review+
Details | Formatted Diff | Diff
[fast-cq] Patch (2.31 KB, patch)
2022-04-19 02:24 PDT, 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) 2022-04-09 06:49:35 PDT
Clean up isFocusableWithoutResolvingFullStyle() by using a shared lambda for different checks.
Comment 1 Tim Nguyen (:ntim) 2022-04-09 06:52:24 PDT
Created attachment 457161 [details]
Patch
Comment 2 Darin Adler 2022-04-11 14:28:28 PDT
Comment on attachment 457161 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:3560
> +    auto isFocusableStyle = [](const RenderStyle* style) -> bool {

Since this won’t work on null, it should take RenderStyle&, not *.

> Source/WebCore/dom/Element.cpp:3568
> +        return isFocusableStyle(renderStyle());

And we would put the * here at the call site.
Comment 3 Radar WebKit Bug Importer 2022-04-16 06:50:13 PDT
<rdar://problem/91848897>
Comment 4 Tim Nguyen (:ntim) 2022-04-18 12:13:28 PDT
Created attachment 457814 [details]
Patch
Comment 5 Tim Nguyen (:ntim) 2022-04-18 12:14:17 PDT
(In reply to Darin Adler from comment #2)
> Comment on attachment 457161 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=457161&action=review
> 
> > Source/WebCore/dom/Element.cpp:3560
> > +    auto isFocusableStyle = [](const RenderStyle* style) -> bool {
> 
> Since this won’t work on null, it should take RenderStyle&, not *.

Yeah, the previous version crashed as EWS showed, made it check for the style's existence as well so I don't duplicate it.
Comment 6 Antti Koivisto 2022-04-19 01:58:44 PDT
Comment on attachment 457814 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:3560
> +    auto isFocusableStyle = [](const RenderStyle* style) -> bool {

->bool is not necessary
Comment 7 Tim Nguyen (:ntim) 2022-04-19 02:24:55 PDT
Created attachment 457868 [details]
[fast-cq] Patch
Comment 8 EWS 2022-04-19 02:30:08 PDT
Committed r293011 (249750@main): <https://commits.webkit.org/249750@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457868 [details].