Bug 236096 - [CSS Container Queries] Add ContainerQueryEvaluator
Summary: [CSS Container Queries] Add ContainerQueryEvaluator
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: 229659
  Show dependency treegraph
 
Reported: 2022-02-03 11:55 PST by Antti Koivisto
Modified: 2022-02-07 13:43 PST (History)
2 users (show)

See Also:


Attachments
Patch (70.06 KB, patch)
2022-02-07 06:24 PST, Antti Koivisto
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (72.07 KB, patch)
2022-02-07 06:46 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch for landing (71.95 KB, patch)
2022-02-07 07:52 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-02-03 11:55:27 PST
Add evaluator type,
Comment 1 Antti Koivisto 2022-02-07 06:24:46 PST
Created attachment 451087 [details]
Patch
Comment 2 Antti Koivisto 2022-02-07 06:46:13 PST
Created attachment 451091 [details]
Patch
Comment 3 Darin Adler 2022-02-07 07:39:05 PST
Comment on attachment 451091 [details]
Patch

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

> Source/WebCore/style/ContainerQueryEvaluator.cpp:2
> + * Copyright (C) 2021 Apple Inc. All rights reserved.

2022?

> Source/WebCore/style/ContainerQueryEvaluator.h:2
> + * Copyright (C) 2021 Apple Inc. All rights reserved.

2022?

> Source/WebCore/style/ContainerQueryEvaluator.h:35
> +    ContainerQueryEvaluator(const Vector<Ref<const Element>>& containers);

Can this take a Span instead of a const Vector&? Should be just as efficient for creating a new vector copy and can pass things without having to create a vector.

> Source/WebCore/style/ElementRuleCollector.cpp:513
> +    ContainerQueryEvaluator evaluator(m_selectorMatchingState->queryContainers);

Here we copy the vector of containers but we don’t need to. I suppose it’s safer but it’s also an extra malloc/delete and reference count churn for all the containers.
Comment 4 Antti Koivisto 2022-02-07 07:52:24 PST
Created attachment 451098 [details]
Patch for landing
Comment 5 EWS 2022-02-07 08:23:03 PST
Committed r289222 (246907@main): <https://commits.webkit.org/246907@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 451098 [details].
Comment 6 Radar WebKit Bug Importer 2022-02-07 08:24:21 PST
<rdar://problem/88573017>
Comment 7 Darin Adler 2022-02-07 12:10:06 PST
Comment on attachment 451098 [details]
Patch for landing

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

> Source/WebCore/style/ContainerQueryEvaluator.h:35
> +    ContainerQueryEvaluator(const Vector<Ref<const Element>>& containers);

I missed this. To use Vector<> and Ref<> this file should include <wtf/Forward.h>.
Comment 8 Antti Koivisto 2022-02-07 12:32:19 PST
> I missed this. To use Vector<> and Ref<> this file should include <wtf/Forward.h>.

I have never used <wtf/Forward.h> anywhere. In what sort of cases should it be used?
Comment 9 Darin Adler 2022-02-07 12:47:22 PST
Principle is that headers need to include what they use. This header uses WTF::Vector so it needs to include a declaration of WTF::Vector. That narrows it down to either Forward.h if we only need a declaration of WTF::Vector, or Vector.h if we need the definition. Forward.h is analogous to writing "class Vector" where Vector.h is analogous to include the entire class definition.

Same story for Ref, Forward.h vs. Ref.h.

Without the include of Forward.h, any file including this has to include <wtf/Forward.h> and that is not currently included in our "config.h" files.