Bug 234959 - Make separate invalidation rulesets for negated selectors (inside :not())
Summary: Make separate invalidation rulesets for negated selectors (inside :not())
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-07 08:11 PST by Antti Koivisto
Modified: 2022-01-07 11:40 PST (History)
3 users (show)

See Also:


Attachments
Patch (22.42 KB, patch)
2022-01-07 08:29 PST, Antti Koivisto
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (22.48 KB, patch)
2022-01-07 08:33 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch (22.46 KB, patch)
2022-01-07 08:43 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch for landing (22.46 KB, patch)
2022-01-07 10:33 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-07 08:11:58 PST
With this information we can reduce invalidation traversal by half.
Comment 1 Antti Koivisto 2022-01-07 08:29:12 PST
Created attachment 448594 [details]
Patch
Comment 2 Antti Koivisto 2022-01-07 08:33:13 PST
Created attachment 448596 [details]
Patch
Comment 3 Antti Koivisto 2022-01-07 08:43:53 PST
Created attachment 448601 [details]
Patch
Comment 4 Darin Adler 2022-01-07 09:52:03 PST
Comment on attachment 448601 [details]
Patch

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

> Source/WebCore/style/ClassChangeInvalidation.cpp:37
> +enum class ClassChangeType { Add, Remove };

Consider ": bool"?

> Source/WebCore/style/ClassChangeInvalidation.cpp:41
> +    AtomStringImpl* className;
> +    ClassChangeType type;

Consider providing default values rather than leaving these scalars uninitialized?

> Source/WebCore/style/ClassChangeInvalidation.cpp:118
> +    auto invalidateBeforeChange = [](ClassChangeType classChangeType, IsNegation isNegation) {

I think calling the local just "type" makes it slightly easier to read.

> Source/WebCore/style/ClassChangeInvalidation.cpp:121
> +        if (classChangeType == ClassChangeType::Remove)
> +            return isNegation == IsNegation::No;
> +        return isNegation == IsNegation::Yes;

I’d wish for a simpler way to write this; I kind of feel like it’s a boolean maze right now. But I can’t think of anything obviously better.

> Source/WebCore/style/StyleScopeRuleSets.h:49
> +    Vector<const CSSSelector*> invalidationSelectors { };

Do we really need the "{ }" here? A workaround for a compiler bug?
Comment 5 Simon Fraser (smfr) 2022-01-07 09:54:46 PST
Comment on attachment 448601 [details]
Patch

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

> Source/WebCore/style/StyleScopeRuleSets.h:48
> +    IsNegation isNegation;
> +    RefPtr<RuleSet> ruleSet;

There will be some padding here.
Comment 6 Antti Koivisto 2022-01-07 09:58:22 PST
> Do we really need the "{ }" here? A workaround for a compiler bug?

Yeah, in the EWS compiler version. We talked about this earlier.
Comment 7 Antti Koivisto 2022-01-07 10:33:01 PST
Created attachment 448608 [details]
Patch for landing
Comment 8 EWS 2022-01-07 11:39:54 PST
Committed r287772 (245832@main): <https://commits.webkit.org/245832@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 448608 [details].
Comment 9 Radar WebKit Bug Importer 2022-01-07 11:40:25 PST
<rdar://problem/87264291>