Bug 237079

Summary: [CSS Container Queries] offsetWidth/Height and similar should update layout for container queries
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: Layout and RenderingAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, esprehn+autocc, ews-watchlist, kangil.han, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 229659    
Attachments:
Description Flags
Patch none

Description Antti Koivisto 2022-02-23 05:14:43 PST
css/css-contain/container-queries/inline-size-containment.html
css/css-contain/container-queries/inline-size-containment-vertical-rl.html
Comment 1 Antti Koivisto 2022-02-23 05:18:57 PST
Created attachment 452966 [details]
Patch
Comment 2 Simon Fraser (smfr) 2022-02-23 09:26:36 PST
Comment on attachment 452966 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=452966&action=review

> Source/WebCore/dom/Document.cpp:2218
> +    while (styleScope().updateQueryContainerState(queryContainerUpdateContext)) {
> +        updateStyleIfNeeded();
> +
> +        if (!frameView->layoutContext().needsLayout())
> +            break;
> +
> +        frameView->layoutContext().layout();

This makes me nervous that we could get into an infinite loop here. Should we bail after N iterations?
Comment 3 Antti Koivisto 2022-02-23 09:42:24 PST
> This makes me nervous that we could get into an infinite loop here. Should
> we bail after N iterations?

The queryContainerUpdateContext thing does prevent infinite looping (since in worst case you'll eventually have every element in that set and won't invalidate anything any more).
Comment 4 EWS 2022-02-23 10:16:26 PST
Committed r290380 (247695@main): <https://commits.webkit.org/247695@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 452966 [details].
Comment 5 Radar WebKit Bug Importer 2022-02-23 10:17:18 PST
<rdar://problem/89363521>