Ignore:
Timestamp:
Jun 3, 2022, 2:54:36 AM (3 years ago)
Author:
Antti Koivisto
Message:

Re-evaluate queries after subframe size changes
https://bugs.webkit.org/show_bug.cgi?id=241225

Reviewed by Alan Bujtas.

Container queries in frames don't react to frame size changes.

  • LayoutTests/TestExpectations:

Mark imported/w3c/web-platform-tests/css/css-contain/container-queries/inline-size-bfc-floats.html as failure, it has ever
been passing by fluke (there are some containment issues with floats).

  • LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/iframe-in-container-invalidation-expected.txt:
  • LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/iframe-invalidation-expected.txt:
  • Source/WebCore/css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::propertyValue):

Ensure we update layout when there are container queries in a subframe, similar to media queries.

  • Source/WebCore/dom/Document.cpp:

(WebCore::Document::resolveStyle):
(WebCore::Document::updateLayout):

  • Source/WebCore/page/FrameView.cpp:

(WebCore::FrameView::updateContentsSize):
(WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):

  • Source/WebCore/page/FrameViewLayoutContext.cpp:

(WebCore::FrameViewLayoutContext::layout):

Move the container query invalidation loop to the main layout function so all paths are covered.

(WebCore::FrameViewLayoutContext::performLayout):

  • Source/WebCore/page/FrameViewLayoutContext.h:
  • Source/WebCore/style/StyleScopeRuleSets.cpp:

(WebCore::Style::ScopeRuleSets::hasContainerQueries const):

  • Source/WebCore/style/StyleScopeRuleSets.h:

Canonical link: https://commits.webkit.org/251257@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r295049 r295200  
    28962896        style = computeRenderStyleForProperty(*styledElement, m_pseudoElementSpecifier, propertyID, ownedStyle, styledRenderer());
    28972897
    2898         // FIXME: Some of these cases could be narrowed down or optimized better.
    2899         forceFullLayout = isLayoutDependent(propertyID, style, styledRenderer())
    2900             || styledElement->isInShadowTree()
    2901             || (document.styleScope().resolverIfExists() && document.styleScope().resolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement());
     2898        forceFullLayout = [&] {
     2899            // FIXME: Some of these cases could be narrowed down or optimized better.
     2900            if (isLayoutDependent(propertyID, style, styledRenderer()))
     2901                return true;
     2902            // FIXME: Why?
     2903            if (styledElement->isInShadowTree())
     2904                return true;
     2905            if (!document.ownerElement())
     2906                return false;
     2907            if (!document.styleScope().resolverIfExists())
     2908                return false;
     2909            auto& ruleSets = document.styleScope().resolverIfExists()->ruleSets();
     2910            return ruleSets.hasViewportDependentMediaQueries() || ruleSets.hasContainerQueries();
     2911        }();
    29022912
    29032913        if (forceFullLayout)
Note: See TracChangeset for help on using the changeset viewer.