Jumping/disappearing content at fractional zoom levels, due to border-sizes rounding differently from other sizes (snapping to device pixels)
Categories
(Core :: Layout, defect, P3)
Tracking
()
Webcompat Priority | P3 |
People
(Reporter: m_turnhout, Unassigned, NeedInfo)
References
Details
Attachments
(2 files)
Updated•7 years ago
|
Comment 2•3 years ago
•
|
||
Here's another testcase, reduced from https://github.com/webcompat/web-bugs/issues/89019 , which is hitting the same root issue.
The problem here (in both testcases) is that the site is assuming margin: Npx
and border: Npx
will occupy precisely the same amount of space. But in fact they aren't precisely the same size, because we snap borders to exact display-pixel boundaries to keep them precise.
At bahn.de, the actual content has margin-top: -2px
combined with border: 2px
, and the site's logic precisely depends on those being exactly the same size. But in fact, we round the border down very slightly in order to snap it to exact display pixels, which means the negative margin-top
causes the content to overlap with the preceding content.
And due to how floats work, this turns out to cause the element to size itself to be 0 width, which bahn.de is not expecting. (Chrome agrees with us on this part, if I manually specify a slightly-more-negative margin-top
to intentionally make the margin-top extend beyond the border).
So the key thing here is just our difference in rounding behavior for borders.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 3•3 years ago
|
||
This is basically a duplicate of bug 477157, which emilio tried to fix last year, but it bounced due to causing other issues (bug 1645008), because there are some fundamental tradeoffs around pixel-snapping and borders (related to what happens at the seam between two adjacent fractionally-device-pixel-sized borders).
I do see that in bug 1645008 comment 32, emilio noted that WebKit changed to match our behavior at some point in the past; but they don't seem to be affected by this bug. (In the original testcase here, they don't have any issues at nondefault zoom levels; though I can trigger the broken layout if I manually change the margin a little bit).
emilio: do you know how close WebKit's behavior actually is to ours, and do you understand how they get away without hitting this bug?
Comment 4•3 years ago
|
||
I think WebKit implements zoom using the zoom
property, not changing the DPI. So they're rounding effectively like using AppUnitsPerDevPixelAtUnitFullZoom()
rather than this. That might be a reasonable change to do, wdyt?
Updated•3 years ago
|
Description
•