RESOLVED FIXED 236096
[CSS Container Queries] Add ContainerQueryEvaluator
https://bugs.webkit.org/show_bug.cgi?id=236096
Summary [CSS Container Queries] Add ContainerQueryEvaluator
Antti Koivisto
Reported 2022-02-03 11:55:27 PST
Add evaluator type,
Attachments
Patch (70.06 KB, patch)
2022-02-07 06:24 PST, Antti Koivisto
ews-feeder: commit-queue-
Patch (72.07 KB, patch)
2022-02-07 06:46 PST, Antti Koivisto
no flags
Patch for landing (71.95 KB, patch)
2022-02-07 07:52 PST, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2022-02-07 06:24:46 PST
Antti Koivisto
Comment 2 2022-02-07 06:46:13 PST
Darin Adler
Comment 3 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.
Antti Koivisto
Comment 4 2022-02-07 07:52:24 PST
Created attachment 451098 [details] Patch for landing
EWS
Comment 5 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].
Radar WebKit Bug Importer
Comment 6 2022-02-07 08:24:21 PST
Darin Adler
Comment 7 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>.
Antti Koivisto
Comment 8 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?
Darin Adler
Comment 9 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.
Note You need to log in before you can comment on or make changes to this bug.