1[CSS Container Queries] Correctly resolve queries when container size is affected by a subsequent sibling
2https://bugs.webkit.org/show_bug.cgi?id=241457
3
4Reviewed by NOBODY (OOPS!).
5
6We currently only take style changes before the container into account.
7
8This patch changes the query container resolution so that whenever we encounter a query container
9we skip the subtree and restart the resolution from the main resolution loop. This way we
10can optimize away unnecessary layouts while also handling backward dependencies.
11
12* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/sibling-layout-dependency-expected.txt:
13* Source/WebCore/dom/Document.cpp:
14(WebCore::Document::resolveStyle):
15
16Loop also when there are no style changes to apply but there are unresolved container. In this case we just resume
17the style resolution where we left it.
18
19* Source/WebCore/dom/Element.cpp:
20(WebCore::Element::invalidateForQueryContainerChange):
21
22Invalidate all descendants when a query container is resized. In practice we ended up computing them all anyway.
23
24* Source/WebCore/style/StyleChange.cpp:
25(WebCore::Style::determineChange):
26* Source/WebCore/style/StyleChange.h:
27
28Add new Descendants value for when container type or name changes.
29
30* Source/WebCore/style/StyleTreeResolver.cpp:
31(WebCore::Style::TreeResolver::computeDescendantsToResolve):
32(WebCore::Style::TreeResolver::pushParent):
33(WebCore::Style::TreeResolver::popParent):
34(WebCore::Style::TreeResolver::resolveComposedTree):
35(WebCore::Style::TreeResolver::determineQueryContainerAction):
36
37Use two buckets for unresolved and resolved containers. Use the resolved bucket to avoid
38recomputing containers we have resolved already.
39
40(WebCore::Style::TreeResolver::resolve):
41
42Move the containers from the unresolved to resolved bucket in the beginning.
43
44(WebCore::Style::TreeResolver::updateQueryContainer): Deleted.
45* Source/WebCore/style/StyleTreeResolver.h: