RESOLVED FIXED 233252
Updating grid gap value does not recalculate styles
https://bugs.webkit.org/show_bug.cgi?id=233252
Summary Updating grid gap value does not recalculate styles
Brad Frost
Reported 2021-11-17 06:32:13 PST
When updating the grid-gap (or gap, column-gap, row-gap, etc.) by editing the style attribute of the element, the styles are not recalculated and element does not change. This also happens when editing the grid-gap value in Safari Inspector. In other browsers, the styles are recalculated and the layout is updated. Here is an example showing the behavior: https://jsbin.com/guhufuk/1/edit?css,js,output
Attachments
Test reduction (531 bytes, text/html)
2022-02-07 10:06 PST, zalan
no flags
Patch (3.75 KB, patch)
2022-02-07 11:01 PST, zalan
simon.fraser: review+
ews-feeder: commit-queue-
[fast-cq]Patch (4.56 KB, patch)
2022-02-07 11:46 PST, zalan
no flags
Radar WebKit Bug Importer
Comment 1 2021-11-24 06:33:21 PST
shuangqiu2
Comment 2 2022-01-14 00:33:59 PST
In case the example above doesn't load, this is another repro: https://codesandbox.io/s/eager-lederberg-vx8pg?file=/src/App.js
Simon Fraser (smfr)
Comment 3 2022-02-02 11:51:34 PST
cc'd the Igalia grid layout experts.
zalan
Comment 4 2022-02-07 10:06:01 PST
Created attachment 451120 [details] Test reduction
zalan
Comment 5 2022-02-07 10:18:39 PST
This looks like a styleAdjuster bug. We get the setStyle call right after the gap value change but we compute the diff to be Equal -> no layout. If I force the diff to Layout, the jsbin example starts working.
zalan
Comment 6 2022-02-07 10:40:14 PST
This affects flex gaps too.
zalan
Comment 7 2022-02-07 10:44:51 PST
@@ -664,6 +664,9 @@ static bool rareNonInheritedDataChangeRequiresLayout(const StyleRareNonInherited if (first.flexibleBox != second.flexibleBox) return true; + if (first.columnGap != second.columnGap || first.rowGap != second.rowGap) + return true; + if (first.order != second.order || first.alignContent != second.alignContent || first.alignItems != second.alignItems fixes both grid and flex. patch is coming up.
zalan
Comment 8 2022-02-07 11:01:09 PST
zalan
Comment 9 2022-02-07 11:09:08 PST
will fix the "!=" older compiler vs. auto generating now issue
zalan
Comment 10 2022-02-07 11:46:25 PST
Created attachment 451129 [details] [fast-cq]Patch
EWS
Comment 11 2022-02-07 14:28:47 PST
Committed r289241 (246925@main): <https://commits.webkit.org/246925@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 451129 [details].
Brad Frost
Comment 12 2022-02-07 14:38:44 PST
Thank you all for addressing this! Looking forward to the release.
zalan
Comment 13 2022-02-07 14:53:34 PST
(In reply to Brad Frost from comment #12) > Thank you all for addressing this! Looking forward to the release. Thank you for filing it!
Note You need to log in before you can comment on or make changes to this bug.