Bug 38617 - Scientific Notation for z-index prints out different values for Mac and Windows
Summary: Scientific Notation for z-index prints out different values for Mac and Windows
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Steven Lai
Depends on:
Reported: 2010-05-05 17:51 PDT by Brian Weinstein
Modified: 2010-05-05 22:34 PDT (History)
1 user (show)

See Also:

Patch (2.18 KB, patch)
2010-05-05 19:34 PDT, Steven Lai
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Weinstein 2010-05-05 17:51:28 PDT
fast/dom/clone-node-z-index.html fails on Windows - due to differences in how Mac and WIndows print Scientific Notation.


On Mac:

zIndex = "2.0002e+07"

On Windows:

zIndex = "2.0002e+007"

There is one extra 0 in the scientific notation.
Comment 1 Steven Lai 2010-05-05 18:08:51 PDT
There are several places in existing code that uses "%.6lg" to format numbers in css string.
For example,

WebCore/css/CSSPrimitiveValue.cpp: CSSPrimitiveValue::cssText()
JavascriptCore/wtf/text/WTFString.cpp: WTFString::format(double)
Comment 2 Steven Lai 2010-05-05 18:22:11 PDT
There was a general fix to this problem, the patch does manual number formatting.
1. It avoids cross-platform discrepancies
2. Avoid large integers being formatted as scientific notation. 


But it got rolled out because it broke a website

Please see:
Comment 3 Steven Lai 2010-05-05 18:34:03 PDT
Also see:

It shows the number formatting could be different on the same platform with different locale. Now, I'm not certain if that could possibly affect scientific notation as well, but from this point of view, we shouldn't be printing the formatted value in the particular test case because the purpose of the test case is to simply validate that the z-index won't be lost.
Comment 4 Steven Lai 2010-05-05 19:34:41 PDT
Created attachment 55195 [details]

Alternative patch to the offending layout test
(so that we don't risk breaking layout tests on every other platform)
Comment 5 WebKit Commit Bot 2010-05-05 22:34:09 PDT
Comment on attachment 55195 [details]

Clearing flags on attachment: 55195

Committed r58861: <http://trac.webkit.org/changeset/58861>
Comment 6 WebKit Commit Bot 2010-05-05 22:34:14 PDT
All reviewed patches have been landed.  Closing bug.