[css-grid] Wrong margins for vertical writing mode child of grid item with auto size grid column
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: elvstone, Unassigned)
Details
(Keywords: testcase)
Attachments
(6 files)
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.
Reporter | ||
Comment 1•5 years ago
|
||
Reporter | ||
Comment 2•5 years ago
|
||
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 3•5 years ago
|
||
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 4•5 years ago
|
||
Confirmed also with Firefox Nightly 72.0a1 (2019-10-30) (see attached screenshot above), so changed the Version to "72 Branch".
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 5•5 years ago
|
||
Played some more, and the transform is not essential to reproduce, but the vertical writing mode is, so changed the title of the bug.
Reporter | ||
Comment 6•5 years ago
|
||
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.
Reporter | ||
Comment 7•5 years ago
|
||
(In reply to Elvis Stansvik from comment #6)
More findings: It is the combination of setting both
margin-left
andmargin-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 aminmax(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.
Reporter | ||
Comment 8•5 years ago
|
||
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.
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Comment 9•5 years ago
|
||
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.)
Comment 10•5 years ago
|
||
This is a simpler example using only block layout.
Updated•5 years ago
|
Reporter | ||
Comment 12•5 years ago
|
||
Ah, thanks for the explanation Mats, and for finding the preexisting report.
Description
•