RESOLVED FIXED 212055
[css-grid] marginLogicalSizeForChild checks auto margins in the opposite axis for orthogonal items
https://bugs.webkit.org/show_bug.cgi?id=212055
Summary [css-grid] marginLogicalSizeForChild checks auto margins in the opposite axis...
Oriol Brufau
Reported 2020-05-18 17:41:31 PDT
Created attachment 399689 [details] testcase This function is wrong: LayoutUnit marginLogicalSizeForChild(const RenderGrid& grid, GridTrackSizingDirection direction, const RenderBox& child) { if (child.needsLayout()) return computeMarginLogicalSizeForChild(grid, direction, child); bool isRowAxis = flowAwareDirectionForChild(grid, child, direction) == ForColumns; LayoutUnit marginStart = marginStartIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginStart() : child.marginBefore(); LayoutUnit marginEnd = marginEndIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginEnd() : child.marginAfter(); return marginStart + marginEnd; } It uses `direction` in order to know which side to check in `marginStartIsAuto` and `marginEndIsAuto`. But when retrieving the margin amount it uses `flowAwareDirectionForChild` instead. In the attached testcase, there should be a green square, not a green rectangle.
Attachments
testcase (335 bytes, text/html)
2020-05-18 17:41 PDT, Oriol Brufau
no flags
Patch (17.22 KB, patch)
2020-05-19 14:06 PDT, Oriol Brufau
no flags
Patch (21.33 KB, patch)
2020-05-19 14:13 PDT, Oriol Brufau
no flags
Oriol Brufau
Comment 1 2020-05-19 14:06:05 PDT
Oriol Brufau
Comment 2 2020-05-19 14:13:03 PDT
Oriol Brufau
Comment 3 2020-05-19 14:16:14 PDT
There is still some problem here since the testcase in this bug and the new cases in grid-items-minimum-width-orthogonal-001.html still fail. But this patch fixes grid-items-minimum-height-orthogonal-001.html, so it's an improvement.
Manuel Rego Casasnovas
Comment 4 2020-05-19 15:11:09 PDT
Comment on attachment 399769 [details] Patch r=me, thanks for the fix.
EWS
Comment 5 2020-05-19 16:50:30 PDT
Committed r261894: <https://trac.webkit.org/changeset/261894> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399769 [details].
Radar WebKit Bug Importer
Comment 6 2020-05-19 16:51:12 PDT
Ryan Haddad
Comment 7 2020-06-09 16:23:19 PDT
Ryan Haddad
Comment 8 2020-06-09 17:36:02 PDT
(In reply to Ryan Haddad from comment #7) > Perhaps we should revert this until > https://bugs.webkit.org/show_bug.cgi?id=209461 is resolved again. Looks like reverting this change is blocked by conflicts in Source/WebCore/rendering/GridLayoutFunctions.cpp because of the changes for https://bugs.webkit.org/show_bug.cgi?id=212113
Simon Fraser (smfr)
Comment 9 2020-06-09 20:19:51 PDT
Let's just land failing results.
Oriol Brufau
Comment 10 2020-06-10 10:10:08 PDT
Yes, this was a follow-up of bug 209461, so it's not surprising that the test fails after the revert. I'm reimporting the WPT tests in bug 213028, I will mark grid-items-minimum-height-orthogonal-001.html as failing on iOS and macOS while I'm at it.
Ryan Haddad
Comment 11 2020-06-10 13:22:10 PDT
(In reply to Oriol Brufau from comment #10) > Yes, this was a follow-up of bug 209461, so it's not surprising that the > test fails after the revert. > > I'm reimporting the WPT tests in bug 213028, I will mark > grid-items-minimum-height-orthogonal-001.html as failing on iOS and macOS > while I'm at it. I ended up landing a new baseline in https://trac.webkit.org/r262852 before I noticed this comment.
Note You need to log in before you can comment on or make changes to this bug.