| Summary: | [CSS Container Queries] Add ContainerQueryEvaluator | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Antti Koivisto <koivisto> | ||||||||
| Component: | CSS | Assignee: | Antti Koivisto <koivisto> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | darin, webkit-bug-importer | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=236256 | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 229659 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Antti Koivisto
2022-02-03 11:55:27 PST
Created attachment 451087 [details]
Patch
Created attachment 451091 [details]
Patch
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. Created attachment 451098 [details]
Patch for landing
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 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>. > 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?
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. |