Closed Bug 1560198 Opened 5 years ago Closed 5 years ago

"background-size:0px" serializes as "0px auto" in getComputedStyle (causing WPT failure in background-size-001.html )

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: dholbert, Assigned: boris)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

STR:

  1. Load data:text/html,<div style="background-size: 0px">InspectMe</div>
  2. Using devtools, inspect the computed style of that div.

EXPECTED RESULTS:
Computed "background-size" should be "0px"

ACTUAL RESULTS:
Computed "background-size" is shown as "0px auto"

Properties are typically supposed to be serialized as their most concise expression, which in this case would be "0px" (which happens to be the specified value in this case).

This is the reason we fail https://wpt.fyi/results/css/css-backgrounds/background-size-001.html as noted in bug 1514243.

Assignee: nobody → boris.chiou

Just as extra justification/explanation here -- per https://www.w3.org/TR/css-backgrounds-3/#typedef-bg-size :
"If only one value is given the second is assumed to be auto."

So the "auto" at the end of the serialization here is unnecessary (i.e. it's implied/superfluous)

I think we should always omit the 2nd value if it is auto: https://github.com/w3c/csswg-drafts/issues/2574

(In reply to Boris Chiou [:boris] from comment #4)

I think we should always omit the 2nd value if it is auto: https://github.com/w3c/csswg-drafts/issues/2574

This means we probably need to update wpt, and it looks like both Blink and WebKit follow this rule (https://wpt.fyi/css/css-backgrounds/background-size-001.html).

Pushed by bchiou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/05a4fdea726c Fix the serialization of the computed value of background-size. r=emilio
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/17472 for changes under testing/web-platform/tests
Regressions: 1616588
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: