- From: Anne van Kesteren <annevk@opera.com>
- Date: Wed, 23 Dec 2009 13:12:47 +0100
- To: "Simon Fraser" <smfr@me.com>, "www-style list" <www-style@w3.org>
On Tue, 22 Dec 2009 20:29:30 +0100, Simon Fraser <smfr@me.com> wrote: > The section on Numbers in CSS3 Values and Units at > <http://www.w3.org/TR/css3-values/#numbers> says nothing about numeric > precision, other than some wording about values being restricted to a > range for some properties. Specifications typically do not state such limits as they can grow over time and depend on hardware constraints and such. > For integers, it isn't stated how large values can get before they fail > to parse, or fail to round-trip; for floating point values, it isn't > specified how many significant digits are retained by parsing, and > round-tripping. (By round-tripping, I mean setting the value via the CSS > OM, and then reading it back.) I guess it ought to say something about this, but I'd like it if we can do it without mentioning limits. > For both large integers and floating point values with many decimal > places, implementations behave differently. Both WebKit and Gecko fall > into scientific notation in some cases (e.g. set 'left' to '12345678px', > and reading it back will give you '1.23457e+7px' which fails to parse if > you in turn try to use it to set the value); Opera does not. WebKit and > Gecko also retain 6 significant digits for floating point values; Opera, > on the other hand, rounds to two decimal places. Using scientific notation seems like a bug to me. (Though dino has suggested we adopt it in the past.) > This is a real-world issue. When we changed our number formatting in > WebKit, we broke a site <https://bugs.webkit.org/show_bug.cgi?id=32078>. Ugh. This no longer really amazes me, but it is still annoying. > Also, we need to be able to round-trip floating point numbers with high > precision for CSS transforms. > > There is a test page here (but note that it doesn't work in Opera > because of value limiting): > <https://bug-30341-attachments.webkit.org/attachment.cgi?id=45276> > > I think there are two things that we need to do: > 1. Be more explicit about the behavior of round-tripping large integer > values, and floating point values with lots of significant digits. I guess we could impose a minimum. I don't think we want to endorse serializing to scientific notation but still require it to fail to parse, but I don't think you're asking for that either :-) > 2. Ensure that the CSSValue replacement in CSS OM allows authors to > modify style without going through number/string conversions, and > therefore losing precision. Agreed. That is most certainly the plan. -- Anne van Kesteren http://annevankesteren.nl/
Received on Wednesday, 23 December 2009 12:13:28 UTC