Skip to content
Permalink
Browse files
Update query container layout unconditionally when ancestor style cha…
…nges

https://bugs.webkit.org/show_bug.cgi?id=241302

Reviewed by Alan Bujtas.

In some cases we incorrectly optimize away the layout.

* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/display-none-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/pseudo-elements-004-expected.txt:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveComposedTree):

Do the query container update even when shouldIterateChildren is false. While there is no reason to iterate children
now there may be after the query container layout has been updated.

Canonical link: https://commits.webkit.org/251310@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
anttijk committed Jun 4, 2022
1 parent 941eb3e commit c225c9933b539cfcd9a6fc5384bd637b9ebdbec0
Showing 3 changed files with 9 additions and 11 deletions.
@@ -16,5 +16,5 @@ PASS getComputedStyle when ::before is display:none
PASS getComputedStyle when originating element is display:none
PASS getComputedStyle on ::before when ancestor element is display:none
PASS getComputedStyle on ::before when container is display:none
FAIL getComputedStyle when in display:none with layout dirty outer element assert_equals: expected "50" but got ""
PASS getComputedStyle when in display:none with layout dirty outer element

@@ -5,10 +5,10 @@ PASS Initial color for ::marker
PASS Initial color for ::first-line
PASS Initial color for ::first-letter
PASS Initial color for ::backdrop
FAIL Color for ::before depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
FAIL Color for ::after depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
FAIL Color for ::marker depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
FAIL Color for ::first-line depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
FAIL Color for ::first-letter depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
FAIL Color for ::backdrop depending on container assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
PASS Color for ::before depending on container
PASS Color for ::after depending on container
PASS Color for ::marker depending on container
PASS Color for ::first-line depending on container
PASS Color for ::first-letter depending on container
PASS Color for ::backdrop depending on container

@@ -836,10 +836,8 @@ void TreeResolver::resolveComposedTree()

bool shouldIterateChildren = style && (element.childNeedsStyleRecalc() || descendantsToResolve != DescendantsToResolve::None);

if (shouldIterateChildren) {
if (updateQueryContainer(element, *style, previousContainerType) == QueryContainerAction::Layout)
shouldIterateChildren = false;
}
if (style && updateQueryContainer(element, *style, previousContainerType) == QueryContainerAction::Layout)
shouldIterateChildren = false;

if (!m_didSeePendingStylesheet)
m_didSeePendingStylesheet = hasLoadingStylesheet(m_document.styleScope(), element, !shouldIterateChildren);

0 comments on commit c225c99

Please sign in to comment.