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
Status: RESOLVED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-05 17:51 PDT by Brian Weinstein
Modified: 2010-05-05 22:34 PDT (History)
1 user (show)

See Also:


Attachments
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.

http://build.webkit.org/results/Windows%20Debug%20(Tests)/r58840%20(13147)/fast/dom/clone-node-z-index-pretty-diff.html

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. 

http://trac.webkit.org/changeset/49585

But it got rolled out because it broke a website

Please see:
http://trac.webkit.org/changeset/52071
https://bugs.webkit.org/show_bug.cgi?id=32078
Comment 3 Steven Lai 2010-05-05 18:34:03 PDT
Also see:
https://bugs.webkit.org/show_bug.cgi?id=18994

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]
Patch

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]
Patch

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.