Closed Bug 1370779 Opened 7 years ago Closed 7 years ago

stylo: percentages serialized with some float "rounding errors"

Categories

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

53 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- unaffected
firefox55 --- unaffected
firefox56 --- wontfix
firefox57 --- fixed

People

(Reporter: bzbarsky, Assigned: xidorn)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file baz.html (deleted) —
Consider the attached testcase. In Gecko, the two percentages on each line are the same. In stylo, the following lines have them different: 15% 15.000001%; 27% 27.000002%; 30% 30.000002%; 53% 52.999996%; 54% 54.000004%; 59% 58.999996%; 60% 60.000004%; This was caught by some mochitests. Specifically, this causes dom/base/test/test_bug338679.html to fail. Good thing it happened to use "15" as the value... If I had to guess, servo is taking floats, converting to double, then serializing the double.
Actually, looks like Gecko just asks the float-to-string machinery to produce 6 decimal digits of precision, rounding the last one; this is the general behavior of nsTSubstring_CharT::AppendFloat (the version that takes 32-bit floats). The errors above are all in the 8th digit, so they get rounded away.
Priority: -- → P2
Priority: P2 → --
Priority: -- → P3
This seems to affect several tests, so bump to P2.
Assignee: nobody → xidorn+moz
Priority: P3 → P2
Blocks: 1389187
No longer blocks: 1389187
Pushed by xquan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/04080bc695e3 followup - Bump version of cssparser again to 0.19.4.
Pushed by xquan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e16dba457260 followup 2 - Downgrade cssparser to 0.19.2.
Pushed by xquan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6b0ed8c31532 followup 3 - Update several web-platform test expectation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: