Bug 235896

Summary: [CSS Container Queries] Ensure query containers have valid layout before resolving the subtree
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, esprehn+autocc, ews-watchlist, kangil.han, 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
Patch for landing none

Description Antti Koivisto 2022-01-31 10:11:29 PST
Bounce between style and layout to ensure query containers have valid style.
Comment 1 Radar WebKit Bug Importer 2022-01-31 10:27:39 PST
<rdar://problem/88279976>
Comment 2 Antti Koivisto 2022-02-01 05:07:03 PST
Created attachment 450518 [details]
Patch
Comment 3 zalan 2022-02-01 10:38:52 PST
Comment on attachment 450518 [details]
Patch

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

> Source/WebCore/ChangeLog:24
> +        Don't run post-layout tasks when resolving query containers.

yeah, I wish there was a disposable layout type of thing where we could just run layout on the tree, produce geometry and let the rest of the update flow take care of the "final" layout including paint invalidation etc. Running the post layout tasks (even on a subsequent runloop) may also produce some unexpected results.

> Source/WebCore/dom/Document.cpp:2063
> +            if (frameView.layoutContext().isLayoutPending() || renderView()->needsLayout())

I'd just check FrameViewLayoutContext::needsLayout() (in addition to ^^, it also covers things like subtree layout, which may get triggered by containment)
Comment 4 Antti Koivisto 2022-02-01 11:23:31 PST
Created attachment 450553 [details]
Patch for landing
Comment 5 EWS 2022-02-01 12:35:41 PST
Committed r288906 (246648@main): <https://commits.webkit.org/246648@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450553 [details].