Closed Bug 1331530 Opened 5 years ago Closed 4 years ago

stylo: value of flex-basis should be set to 0% if it is omitted in flex shorthand


(Core :: CSS Parsing and Computation, defect)

Not set



Tracking Status
firefox53 --- affected


(Reporter: xidorn, Unassigned)



(Whiteboard: [stylo])

It seems to me the CSS Flexible Box spec says, if the part of flex-basis is omitted in a declaration of flex shorthand, the specified value of flex-basis should be "0". And given flex-basis accepts "0" as a <width> value, I believe it means "0px" rather than "0%" here (although they are effectively the same for layout, they are different from CSSOM.)
I didn't test the code, but from the expected behavior of layout/style/test/test_flexbox_flex_shorthand.html test, I suppose the current behavior doesn't match the spec.
I recall the spec requiring 0% (with the percent) at some point. If it doesn't now, then there was likely a spec change.
Whiteboard: [stylo]
I guess you're right that the spec at least required 0% at some point, because all browsers I test so far (Firefox, Chrome, Edge) all agree with that behavior.
From the discussion mentioned in the commit, it seems to me changing from 0% to 0px may actually affect the layout. And given that all browsers currently agree with setting it to 0%, I don't think we should risk changing the behavior. So we should just make stylo align with other browsers.
Summary: Value of flex-basis should be set to 0px if it is omitted in flex shorthand → stylo: value of flex-basis should be set to 0% if it is omitted in flex shorthand
Keywords: dev-doc-needed
Submitted servo/servo#17073 for making Servo align with browsers.
Landed in

Marking as FIXED.
Closed: 4 years ago
Resolution: --- → FIXED
No longer blocks: flexbox-spec-changes
You need to log in before you can comment on or make changes to this bug.