RESOLVED FIXED 231802
[css-grid] update the content-sized grid width before laying out a grid item with block constraints and aspect-ratio
https://bugs.webkit.org/show_bug.cgi?id=231802
Summary [css-grid] update the content-sized grid width before laying out a grid item ...
zsun
Reported 2021-10-15 02:53:38 PDT
We need to relayout grid items when the grid width changes due to the change on item size.
Attachments
Patch (7.43 KB, patch)
2021-10-15 03:33 PDT, zsun
no flags
Patch (7.39 KB, patch)
2021-10-15 06:52 PDT, zsun
no flags
Patch (10.45 KB, patch)
2021-11-05 08:10 PDT, zsun
ews-feeder: commit-queue-
Patch (10.41 KB, patch)
2021-11-05 08:51 PDT, zsun
no flags
Patch (11.62 KB, patch)
2021-11-08 02:41 PST, zsun
no flags
Patch (12.20 KB, patch)
2021-11-08 07:51 PST, zsun
no flags
Patch (14.19 KB, patch)
2021-11-08 11:42 PST, zsun
no flags
zsun
Comment 1 2021-10-15 03:33:12 PDT
Sergio Villar Senin
Comment 2 2021-10-15 04:33:04 PDT
Comment on attachment 441359 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441359&action=review > Source/WebCore/rendering/RenderGrid.cpp:974 > + child->layoutIfNeeded(); We shouldn't layout the item twice. If you need to recompute the preferred width then just do it before the child->layoutIfNeeded() call above and do the layout just once.
zsun
Comment 3 2021-10-15 06:38:45 PDT
Recompute the preferred with before laying out a grid item with block constraints
zsun
Comment 4 2021-10-15 06:52:10 PDT
Sergio Villar Senin
Comment 5 2021-10-15 07:13:11 PDT
Comment on attachment 441373 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441373&action=review > Source/WebCore/rendering/RenderGrid.cpp:972 > + updateLogicalWidth(); The part I don't understand is that you mention that you need to recompute the preferred width of the item but you call updateLogicalWidth() in the grid. This means that we're recomputing the width of the grid in the middle of the the layout of the items. That's problematic, note that some items might be laid out with the old grid width while some others will use the updated one.
Radar WebKit Bug Importer
Comment 6 2021-10-22 02:54:16 PDT
Frédéric Wang (:fredw)
Comment 7 2021-10-28 07:00:19 PDT
Comment on attachment 441373 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441373&action=review > Source/WebCore/ChangeLog:14 > + IOS platform. However, we noticed that they also fail for GTK at iOS* > Source/WebCore/rendering/RenderGrid.cpp:970 > + // We need to recompute the preferred width for gird items with block constraints. grid*
zsun
Comment 8 2021-11-05 08:10:11 PDT
zsun
Comment 9 2021-11-05 08:51:29 PDT
Javier Fernandez
Comment 10 2021-11-08 01:05:15 PST
Comment on attachment 443397 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=443397&action=review > Source/WebCore/rendering/RenderGrid.cpp:282 > + updateLogicalWidth(); I don't understand why this solves the issue. I thought we needed to repeat the track sizing algorithm; don't we ? Additionally, wouldn't we need to call setPreferredLogicalWidthsDirty for the grid container so that we run the track sizing algorithm again to adjust its intrinsic size ?
zsun
Comment 11 2021-11-08 02:41:08 PST
zsun
Comment 12 2021-11-08 07:51:55 PST
Javier Fernandez
Comment 13 2021-11-08 09:49:19 PST
Comment on attachment 443546 [details] Patch The change looks good, but I think we should add the new test that we discussed today; the one to verify that we update the tracks after applying the aspect ratio.
zsun
Comment 14 2021-11-08 11:42:18 PST
EWS Watchlist
Comment 15 2021-11-08 11:43:04 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Javier Fernandez
Comment 16 2021-11-09 00:59:39 PST
Comment on attachment 443579 [details] Patch r=me Please, ensure the new test is exported to the WPT repository.
EWS
Comment 17 2021-11-09 06:48:10 PST
Committed r285497 (244021@main): <https://commits.webkit.org/244021@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 443579 [details].
Note You need to log in before you can comment on or make changes to this bug.