Closed Bug 1291187 Opened 8 years ago Closed 5 years ago

getComputedStyle() of "flex-basis" should return "10%" if the style sets to "calc(0px + 10%)"

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: daisuke, Assigned: boris)

References

(Depends on 1 open bug, Blocks 1 open bug, )

Details

Attachments

(2 files)

Attached file getComputedStyle.html
I attach the test html.
For now, that returns "calc(0px + 10%)".
Just a few notes, the spec doesn't actually say this but this is what Chrome does and it seems sensible to spec.

At the moment we seem to do:

calc(300px + 0%) -> 300px
BUT
calc(0px + 10%) -> calc(0px + 10%)

I'm not sure what the reasoning for this is (I looked up the changeset and bug and there was no explanation) but it seems like we should either always simplify or never.
Priority: -- → P3
(In reply to Brian Birtles (:birtles) from comment #1)
> Just a few notes, the spec doesn't actually say this but this is what Chrome
> does and it seems sensible to spec.
> 
> At the moment we seem to do:
> 
> calc(300px + 0%) -> 300px
> BUT
> calc(0px + 10%) -> calc(0px + 10%)

There is actually some spec text for this[1] although it as marked as being "under discussion".

As it currently stands it would suggest we preserve zero values so that, `the calc() doesn’t suddenly "change shape" in the middle of a transition when one of the values happens to have a zero value temporarily.'

I don't really understand the concern there but in any case, Gecko's behavior doesn't match that either so something will need to change here.

[1] https://drafts.csswg.org/css-values/#calc-serialize
Blocks: calc-issues

This bug should have been fixed, per the spec issue. However, it'd be better to add some tests in wpt.

Assignee: nobody → boris.chiou
Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a5d8c96d2eb7
Add tests for testing the computed values of flex-basis. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/18129 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: