Bug 235003 - Use IsNegation bit for more efficient pseudo-class style invalidation
Summary: Use IsNegation bit for more efficient pseudo-class style invalidation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antti Koivisto
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-08 06:11 PST by Antti Koivisto
Modified: 2022-01-09 04:54 PST (History)
11 users (show)

See Also:


Attachments
Patch (25.10 KB, patch)
2022-01-08 06:19 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch (24.95 KB, patch)
2022-01-08 06:42 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch (24.95 KB, patch)
2022-01-08 06:53 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch for landing (27.70 KB, patch)
2022-01-09 00:30 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2022-01-08 06:11:25 PST
We already use it for class invalidation.
Comment 1 Antti Koivisto 2022-01-08 06:19:44 PST
Created attachment 448668 [details]
Patch
Comment 2 Antti Koivisto 2022-01-08 06:42:29 PST
Created attachment 448669 [details]
Patch
Comment 3 Antti Koivisto 2022-01-08 06:53:32 PST
Created attachment 448670 [details]
Patch
Comment 4 Simon Fraser (smfr) 2022-01-08 10:17:21 PST
Comment on attachment 448670 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        We now know is an invaliation ruleset is for negated context. We can use this to avoid

Does not parse

> Source/WebCore/dom/Element.cpp:799
> +        Style::PseudoClassChangeInvalidation styleInvalidation(*this, CSSSelector::PseudoClassActive, flag, invalidationScope);

flag needs a better name

> Source/WebCore/dom/Element.cpp:851
> +    Style::PseudoClassChangeInvalidation focusStyleInvalidation(*this, { { CSSSelector::PseudoClassFocus, flag }, { CSSSelector::PseudoClassFocusVisible, flag } });

Ditto

> Source/WebCore/dom/Element.cpp:887
> +        Style::PseudoClassChangeInvalidation styleInvalidation(*this, CSSSelector::PseudoClassFocusWithin, flag);

Ditto

> Source/WebCore/dom/Element.cpp:897
> +        Style::PseudoClassChangeInvalidation styleInvalidation(*this, CSSSelector::PseudoClassHover, flag, invalidationScope);

Ditto

> Source/WebCore/dom/Element.cpp:910
> +    Style::PseudoClassChangeInvalidation styleInvalidation(*this, CSSSelector::PseudoClassDrag, flag);

Ditto

> Source/WebCore/html/HTMLInputElement.cpp:978
> -void HTMLInputElement::setChecked(bool nowChecked)
> +void HTMLInputElement::setChecked(bool newChecked)

The rename doesn't really help. why not just isChecked or checked?
Comment 5 Antti Koivisto 2022-01-09 00:30:06 PST
Created attachment 448696 [details]
Patch for landing
Comment 6 EWS 2022-01-09 01:02:54 PST
Committed r287818 (245870@main): <https://commits.webkit.org/245870@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 448696 [details].
Comment 7 Radar WebKit Bug Importer 2022-01-09 01:03:18 PST
<rdar://problem/87304694>
Comment 8 Emilio Cobos Álvarez (:emilio) 2022-01-09 02:45:05 PST
Comment on attachment 448696 [details]
Patch for landing

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

> Source/WebCore/dom/Element.cpp:852
> +    document().userActionElements().setFocused(*this, value);

Probably a bug: this is not the value that ends up getting passed to setHasFocusVisible
Comment 9 Antti Koivisto 2022-01-09 04:54:31 PST
Comment on attachment 448696 [details]
Patch for landing

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

>> Source/WebCore/dom/Element.cpp:852
>> +    document().userActionElements().setFocused(*this, value);
> 
> Probably a bug: this is not the value that ends up getting passed to setHasFocusVisible

True though I think it just causes unnecessary invalidation in some cases (when focus changes but focus-visible stays the same).