Bug 231226 - [css-grid] Recalculate grid's auto repeat columns when grid's relative width to its containing block width changes
Summary: [css-grid] Recalculate grid's auto repeat columns when grid's relative width ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zsun
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-05 04:13 PDT by zsun
Modified: 2022-05-13 03:28 PDT (History)
11 users (show)

See Also:


Attachments
Patch (4.00 KB, patch)
2021-10-05 04:21 PDT, zsun
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (4.19 KB, patch)
2021-10-05 06:23 PDT, zsun
no flags Details | Formatted Diff | Diff
Patch (3.59 KB, patch)
2021-10-08 06:30 PDT, zsun
no flags Details | Formatted Diff | Diff
Patch (3.88 KB, patch)
2021-10-11 03:13 PDT, zsun
no flags Details | Formatted Diff | Diff
Patch (3.93 KB, text/plain)
2021-10-11 05:15 PDT, zsun
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.