RESOLVED FIXED 209461
[css-grid] Grid layout unstable with percentage margin
https://bugs.webkit.org/show_bug.cgi?id=209461
Summary [css-grid] Grid layout unstable with percentage margin
Carlos Alberto Lopez Perez
Reported 2020-03-23 20:37:18 PDT
What steps will reproduce the problem? 1. Visit test case: https://jsfiddle.net/xm7rn3wj/ 2. Move the mouse pointer on and off the text ("Hover here.") several times. What is the expected result? The text should not continuously move towards the bottom right. What happens instead of that? Every time the mouse pointer moves on and off the text it moves further towards the bottom right. Firefox does it right and Chrome does it since crbug.com/834643
Attachments
Patch (123.08 KB, patch)
2020-05-15 16:50 PDT, Oriol Brufau
no flags
Patch (123.11 KB, patch)
2020-05-18 12:03 PDT, Oriol Brufau
no flags
Patch (29.89 KB, patch)
2020-09-23 11:10 PDT, Oriol Brufau
no flags
Patch (29.89 KB, patch)
2020-09-23 14:37 PDT, Oriol Brufau
no flags
Carlos Alberto Lopez Perez
Comment 1 2020-03-23 20:40:42 PDT
This is covered by WPT tests: css/css-grid/grid-items/grid-items-percentage-margins-???.html css/css-grid/grid-items/grid-items-percentage-paddings-???.html css/css-grid/grid-items/grid-item-dynamic-min-contribution-001.html
Carlos Alberto Lopez Perez
Comment 2 2020-03-23 20:46:19 PDT
Also consider https://bugs.chromium.org/p/chromium/issues/detail?id=808758 which added WPT tests: css/css-grid/grid-items/grid-items-percentage-margins-vertical-lr-???.html css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-???.html
Oriol Brufau
Comment 3 2020-05-15 16:50:42 PDT
Oriol Brufau
Comment 4 2020-05-15 16:53:23 PDT
The patch is a port of these Chromium commits: https://chromium-review.googlesource.com/c/chromium/src/+/1796323 https://chromium-review.googlesource.com/c/chromium/src/+/2033507 But the base code in WebKit was a slightly different so I had to improvise a bit.
Manuel Rego Casasnovas
Comment 5 2020-05-17 23:54:02 PDT
Comment on attachment 399527 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399527&action=review This looks good, I have a question inline but otherwise r=me. Please clarify that before landing. > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:920 > + GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForRows); Why you need this here and not before?
Oriol Brufau
Comment 6 2020-05-18 12:03:09 PDT
Oriol Brufau
Comment 7 2020-05-18 12:09:50 PDT
(In reply to Manuel Rego Casasnovas from comment #5) > Comment on attachment 399527 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=399527&action=review > > This looks good, I have a question inline but otherwise r=me. > Please clarify that before landing. > > > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:920 > > + GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForRows); > > Why you need this here and not before? Good catch, the previous call needs to use childInlineDirection instead of ForColumns, I missed it since grid-items-minimum-width-orthogonal-001.html only covers the other axis.
EWS
Comment 8 2020-05-18 17:52:27 PDT
Committed r261841: <https://trac.webkit.org/changeset/261841> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399665 [details].
Radar WebKit Bug Importer
Comment 9 2020-05-18 17:53:19 PDT
Yusuke Suzuki
Comment 10 2020-06-09 13:50:54 PDT
Re-opened since this is blocked by bug 212991
Oriol Brufau
Comment 11 2020-09-23 10:23:03 PDT
The spotify problem was because of bug 210089. Now that it has been fixed, my patch doesn't break spotify. So it should be fine to reland, I will post a rebased patch.
Oriol Brufau
Comment 12 2020-09-23 11:10:14 PDT
Manuel Rego Casasnovas
Comment 13 2020-09-23 13:52:03 PDT
Comment on attachment 409485 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409485&action=review r=me Let's hope this time we don't get new regressions. :-) > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:115 > +static bool hasRelativeOrIntrinsicSizeForChild(const RenderBox& child, GridTrackSizingDirection direction) Nit: Missing new line before method name.
Oriol Brufau
Comment 14 2020-09-23 14:37:38 PDT
Oriol Brufau
Comment 15 2020-09-23 14:38:29 PDT
(In reply to Manuel Rego Casasnovas from comment #13) > Nit: Missing new line before method name. Done.
EWS
Comment 16 2020-09-23 15:31:52 PDT
Committed r267503: <https://trac.webkit.org/changeset/267503> All reviewed patches have been landed. Closing bug and clearing flags on attachment 409503 [details].
Note You need to log in before you can comment on or make changes to this bug.