Open Bug 1664936 Opened 5 years ago Updated 2 years ago

canvas size bug

Categories

(Core :: Layout, defect)

80 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: sergio+it, Unassigned)

Details

Attachments

(3 files, 1 obsolete file)

Attached file canvas-size-bug.html

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

Attached file 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.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Component: Canvas: 2D → Layout

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?

Severity: -- → S3
Flags: needinfo?(aethanyc)

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>.

[1] https://en.wikipedia.org/wiki/Baseline_(typography)

Flags: needinfo?(aethanyc)

Does comment 5 make sense to you? Should we close this bug?

Flags: needinfo?(jfkthame)

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.

Flags: needinfo?(jfkthame)
Attachment #9383689 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: