Closed Bug 1592652 Opened 5 years ago Closed 5 years ago

[css-grid] Wrong margins for vertical writing mode child of grid item with auto size grid column

Categories

(Core :: Layout, defect)

72 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1310551

People

(Reporter: elvstone, Unassigned)

Details

(Keywords: testcase)

Attachments

(6 files)

Attached file test.html (deleted) —

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Open the attached file test.html.

Actual results:

The 2em margin around <p>Left</p> is not correct (see attached firefox.png).

With Chromium 77 it looks correct (see attached chromium.png).

Expected results:

The margin around <p>Left</p> should be 2em on all sides.

Attached image test.html rendered in Firefox 70.0 (deleted) —
Summary: Wrong margins for child of grid item with auto size grid column → Wrong margins for rotated child of grid item with auto size grid column
Version: 70 Branch → 72 Branch

Confirmed also with Firefox Nightly 72.0a1 (2019-10-30) (see attached screenshot above), so changed the Version to "72 Branch".

Summary: Wrong margins for rotated child of grid item with auto size grid column → Wrong margins for vertical writing mode child of grid item with auto size grid column

Played some more, and the transform is not essential to reproduce, but the vertical writing mode is, so changed the title of the bug.

More findings: It is the combination of setting both margin-left and margin-right which does not render correctly. Setting just either one of them works fine, just not both at the same time.

Setting margin-top/bottom is no problem, neither in isolation nor both at the same time.

So the problem is some strange interaction with the column being auto with a minmax(0, 1fr) column next to it, and the setting of margins on both left and right sides which is problematic.

(In reply to Elvis Stansvik from comment #6)

More findings: It is the combination of setting both margin-left and margin-right which does not render correctly. Setting just either one of them works fine, just not both at the same time.

Setting margin-top/bottom is no problem, neither in isolation nor both at the same time.

So the problem is some strange interaction with the column being auto with a minmax(0, 1fr) column next to it, and the setting of margins on both left and right sides which is problematic.

Sorry, I was wrong here. I was working in a codepen and it didn't refresh properly (!).

It seems it is only the margin-right which is problematic. It seems off by 1em. Setting margin-right to 1em, there is visibly no margin in the rendered result. Setting it to 2em, there is visibly 1em of margin.

Another finding: Setting line-height: 0 on the <p> seems to "work" around the problem, the rendering is now correct. However, adding a border to the <p> one can see that it now is 0 high.

Component: Untriaged → Layout
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Summary: Wrong margins for vertical writing mode child of grid item with auto size grid column → [css-grid] Wrong margins for vertical writing mode child of grid item with auto size grid column
Keywords: testcase
Attached file Testcase #2 (deleted) —

The underlying bug is unrelated to grid layout. The same bug also occurs with flex layout for example.
The problem is that the Flex/Grid item claims to have a zero max-content inline-size in this case (nsBlockFrame::GetPrefISize returns zero). (The horizontal size of the Left item comes from the default margin of <p> only.)

Attached file Testcase #3 (deleted) —

This is a simpler example using only block layout.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE

Ah, thanks for the explanation Mats, and for finding the preexisting report.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: