Open Bug 1684193 Opened 5 years ago Updated 4 years ago

background-image doesn't display if <html> (:root) has height = 0, in quirks-mode

Categories

(Core :: Layout, defect)

defect

Tracking

()

People

(Reporter: vtwintiger, Unassigned)

References

Details

Attachments

(4 files)

Attached file backgroundissue.zip

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.5.1

Steps to reproduce:

Created a web page with body
margin: 0
background: linear-gradient(45deg, #49a09d, #5f2c82);

Actual results:

The background does not display.

Expected results:

The background should display.

Attachment #9194693 - Attachment description: backgrounissue.zip → backgroundissue.zip
Attachment #9194693 - Attachment filename: backgrounissue.zip → backgroundissue.zip
Component: Untriaged → Layout
Product: Firefox → Core

The computed value of <html> height is zero if <body> margin is zero. If I specify zero to <html> height, background would not be rendered regardless of the <body> margin. If I set a nonzero value to <html> height, background would be shown regardless of the <body> margin.

Summary: background doesn't display if body margin = 0 → background doesn't display if <html> (:root) height = 0

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Hi,

I have managed to reproduce the issue in release 84.0.2, beta 85.0b6 and latest nightly 86.0a1 (2021-01-07). The issue is also reproducible in Fx70 (build id: 20190804214813).

Thanks for the report.

Status: UNCONFIRMED → NEW
Ever confirmed: true

testcase 1 demonstrates the behavior-difference between Firefox and Chrome here. Firefox renders it with no background, whereas Chrome does render a background.

In testcase 2, neither browser renders a background. (Firefox is consistent between the two, whereas Chrome changes its behavior depending on quirks-mode vs. standards-mode.)

So there seems be some quirks-mode special-case behavior involved here, on Chrome's part...

Summary: background doesn't display if <html> (:root) height = 0 → background doesn't display if <html> (:root) height = 0, in quirks-mode

Edge 18 (pre-chromium) and Safari (WebKit) match Chrome's behavior here, so this does seem to be a broadly-implemented quirks-mode behavior.

It looks like Firefox's behavior hasn't changed here (I get the same results -- both testcases blank[1] -- at least as far back as Firefox 4 (nightly 2011-01-01). Hence: I'm clearing the "Affected:" flags since it's not useful to maintain per-version flags for bugs like this that affect all versions.

[1] I used data:text/html,<body style="margin:0;background:-moz-linear-gradient(blue,purple);background:linear-gradient(blue,purple)"> when testing old builds, since back then we required the prefixed linear-gradient syntax.

Severity: -- → S3
OS: Unspecified → All
Hardware: Unspecified → All
Version: Firefox 84 → Trunk
Attachment #9200100 - Attachment description: testcase 2 (added DOCTYPE html) → testcase 2 (added DOCTYPE html, which makes browsers agree on blank rendering)
Attachment #9200099 - Attachment description: testcase 1 (reduced from reporter's zip) → testcase 1 (reduced from reporter's zip; blank in Firefox, nonblank in other browsers)

(Also: this appears to be specific to background-image (which is the subproperty that the linear-gradient is populating here). We do render background-color reliably in both testcases here, if I add that locally.)

Summary: background doesn't display if <html> (:root) height = 0, in quirks-mode → background-image doesn't display if <html> (:root) has height = 0, in quirks-mode

(In reply to Masatoshi Kimura [:emk] from comment #1)

If I specify zero to <html> height, background would not be rendered regardless of the <body> margin.

Here's a testcase to demonstrate this. Chrome agrees with us on this version (i.e. Chrome doesn't render the background-image gradient in this case.)

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

Attachment

General

Creator:
Created:
Updated:
Size: