Bug 231226

Summary: [css-grid] Recalculate grid's auto repeat columns when grid's relative width to its containing block width changes
Product: WebKit Reporter: zsun
Component: CSSAssignee: zsun
Status: NEW ---    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, glenn, jfernandez, kondapallykalyan, pdr, rbuis, rego, svillar, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch none

Description zsun 2021-10-05 04:13:46 PDT
We need to recalculate grid's auto repeat columns when the width/height of containing block changes. The grid has relative width/height to the containing block.
Comment 1 zsun 2021-10-05 04:21:22 PDT
Created attachment 440196 [details]
Patch
Comment 2 zsun 2021-10-05 06:23:59 PDT
Created attachment 440205 [details]
Patch
Comment 3 zsun 2021-10-08 06:30:57 PDT
Created attachment 440599 [details]
Patch
Comment 4 Rob Buis 2021-10-08 06:53:34 PDT
Comment on attachment 440599 [details]
Patch

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

> Source/WebCore/rendering/RenderBox.cpp:1099
> +    return style().paddingStart().isPercentOrCalculated() || style().paddingEnd().isPercentOrCalculated() || (isRenderGrid() && hasRelativeLogicalWidth()) || (style().hasAspectRatio() && (hasRelativeLogicalHeight() || (isFlexItem() && hasStretchedLogicalHeight())));

If you make a RenderGrid::needsPreferredWidthsRecalculation you can get rid of the isRenderGrid check and keep this simpler.
Comment 5 zsun 2021-10-11 03:13:01 PDT
Created attachment 440770 [details]
Patch
Comment 6 Rob Buis 2021-10-11 05:08:35 PDT
Comment on attachment 440770 [details]
Patch

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

> Source/WebCore/rendering/RenderGrid.h:209
> +    bool needsPreferredWidthsRecalculation() const final;

Nit: in WebKit we keep the member vars and methods separate. In this case the method should go directly below aspectRatioPrefersInline.
Comment 7 zsun 2021-10-11 05:15:13 PDT
Created attachment 440775 [details]
Patch
Comment 8 Radar WebKit Bug Importer 2021-10-12 04:14:15 PDT
<rdar://problem/84141634>
Comment 9 zsun 2022-05-13 03:27:59 PDT
I recall that we had an internal discussion with Javier on this patch and the solution here was not ideal. Make the patch as obselete.