Hi, I'm using french locale, and have 94 failing tests in test_value_storage.html, all related to -moz-animation-timing-function. Example of a failing test: failed | parse+compute+serialize(-moz-animation-timing-function) should be idempotent for '-moz-animation: bounce 1s linear 2s' - got "cubic-bezier(0,250000, 0,100000, 0,250000, 1,000000)", expected "cubic-bezier(0,000000, 0,000000, 1,000000, 1,000000)" This happens because getComputedStyle uses printf with floats http://hg.mozilla.org/mozilla-central/file/320e5abc6f5a/layout/style/nsComputedDOMStyle.cpp#l3986 This gives me, with my locale, computed -moz-animation-timing-function which look like: cubic-bezier(0,250000, 0,100000, 0,250000, 1,000000) Which is wrong (notice the comma instead of dots for decimal separators).
Yeah, that's just wrong. Arno, do you want to fix, or should I?
8 years ago
Summary: test_value_storage.html fails in some locales → cubic-bezier() computed style serialization outputs locale-dependent floats (test_value_storage.html fails in some locales)
Created attachment 543919 [details] [diff] [review] patch v1 I'm unsure if this is the right way. Should I instead reset LC_NUMERIC locale before calling nsPrintfCString (and set it back after) ?
Assignee: nobody → arno
You could use nsAutoString and AppendPrintf e.g. AppendPrintf("%f,%f", x, y) to build up a string. Or alternatively nsTextFormatter::ssprintf e.g. nsTextFormatter::ssprintf(aValue, NS_LITERAL_STRING("%g,%g").get(), x, y);
Or just use AppendFloat(). You do NOT want to mess with LC_NUMERIC.
Created attachment 543970 [details] [diff] [review] patch v2
Comment on attachment 543970 [details] [diff] [review] patch v2 r=me, but please add a useful commit message!
Attachment #543970 - Flags: review?(bzbarsky) → review+
Created attachment 544162 [details] [diff] [review] reviewed patch with a commit message
Attachment #543970 - Attachment is obsolete: true
That commit message needs to list the bug number (and reviewer, typically). I recommend: "Bug 669220. Use location-independent float-to-string conversions for timing function computed styles. r=bzbarsky".
Created attachment 544262 [details] [diff] [review] reviewed patch with a commit message (2)
Attachment #544162 - Attachment is obsolete: true
Created attachment 544264 [details] [diff] [review] reviewed patch with a commit message (2)
Attachment #544262 - Attachment is obsolete: true
https://hg.mozilla.org/integration/mozilla-inbound/rev/a9b83b5cfcab (I changed "location-independent" in the commit message to "locale-independent".)
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.