canvas size bug
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: sergio+it, Unassigned)
Details
Attachments
(3 files, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0
Steps to reproduce:
see canvas-size-bug.html
Expected results:
see div-size-no-bug.html
Vertical scroll bar is shown for canvas-size-bug.html, while div fits size perfectly.
On fenix both examples looks fine, wo scrollbar.
Comment 3•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Looks like box-sizing: border-box is not being applied to the <canvas> element, hence the overscroll? Not reproducible in Chrome.
TYLin: Do you know what's happening here?
Comment 5•5 years ago
•
|
||
I think this problem is not related to box-sizing. In the testcase in comment 0, <canvas> is an inline element, and it has the default vertical-align: baseline, so the line containing <canvas> can be taller than the <canvas> element (to incorporate the descent [1]). Adding vertical-align: top to the <canvas> can remove the scrollbar.
Here's a testcase adapted from comment 0, which contains inline-block, canvas, and normal text with large font-size. It can trigger the scrollbar on <html> because of a large descender height. Google chrome behaves the same as Firefox in this testcase.
To sum up, I think Firefox's behavior is consistent regardless whether <canvas> is the only element under <body> or not. Google chrome starts to behave like Firefox once there are other inline siblings of the <canvas>.
Does comment 5 make sense to you? Should we close this bug?
Comment 7•5 years ago
|
||
I think comment 5 is correct about what's happening: this isn't about box-sizing, it's about the line metrics that are calculated for the line-box that contains the 100%-height <canvas>. (Looks like the same behavior can be demonstrated with an <img>, too.) Whether it's a bug.... I'm not sure. The Inline Layout spec gives the relevant rules, I think.
I suspect we might be wrong, actually, but it'll take a more careful study of the spec to figure out exactly what should be happening here.
Updated•2 years ago
|
Description
•