Bug 30341 - Make float decimal formatting of CSS values consistent
Summary: Make float decimal formatting of CSS values consistent
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Evan Martin
Depends on:
Reported: 2009-10-13 14:42 PDT by Evan Martin
Modified: 2010-01-07 11:24 PST (History)
3 users (show)

See Also:

Page for testing float handling (2.41 KB, text/html)
2009-12-20 07:18 PST, Evan Martin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Martin 2009-10-13 14:42:02 PDT
When JS reads a float value from CSS, it gets it back as a string.
As the following console session shows, we format long floats to six digits.
This should be checked against other browsers, unified, and spec'd.

> document.foobar = 1/9;
> document.foobar
> var x = document.getElementById('header')
> x
<div id=​"header">​
> x.style.opacity = 1/9;
> x.style.opacity
Comment 1 Evan Martin 2009-10-13 14:46:05 PDT
Another related question is what the upper bound on CSS values are.  E.g., can I set foobar.style.left = 100000000000000000000000px?
Comment 2 Evan Martin 2009-12-20 07:18:38 PST
Created attachment 45276 [details]
Page for testing float handling
Comment 3 Evan Martin 2009-12-20 07:21:02 PST
+simon, in case he's curious

The attachment tries to summarize some corner cases that browsers might have.
Next I need to run this on various browsers and see if there's any pattern they might agree on.  (I only have a Linux box at the moment, but when I'm back at work I can test IE, Safari, and Opera.)
Comment 4 Simon Fraser (smfr) 2009-12-21 07:47:10 PST
I can take this to the CSS Working group.
Comment 5 Evan Martin 2010-01-07 11:24:37 PST
By the way, I realized that this attachment is probably confusing things a bit because we might be doing a float -> string conversion to print out the result in the table.  That's probably using another printf()-like call that will introduce exponential notation etc. that may not be part of the code this is intending to test.