W3C home > Mailing lists > Public > www-svg@w3.org > January 2006

RE: Proposal for unitless lengths (Was: Is the px unit equivalent to user units?)

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 5 Jan 2006 19:24:39 +0000 (UTC)
To: Doug Schepers <doug.schepers@vectoreal.com>
Cc: 'Anne van Kesteren' <fora@annevankesteren.nl>, 'Jon Ferraiolo' <jonf@adobe.com>, 'Jonathan Watt' <jonathan.watt@strath.ac.uk>, www-svg@w3.org, 'Dean Jackson' <dino@w3.org>, 'Chris Lilley' <chris@w3.org>
Message-ID: <Pine.LNX.4.62.0601051918520.2856@dhalsim.dreamhost.com>

On Thu, 5 Jan 2006, Doug Schepers wrote:
>
> I suggest that to resolve this issue, we should apply the same logic 
> that Dean suggested in resolving the issue with units. The application 
> of the value for unitlesss <number>s to unitful <length>s would seem to 
> require an explicit "casting" of the attribute value, so similarly, we 
> should require the casting of a scientific notation in any offending 
> style attribute to the equivalent decimal representation in the computed 
> property. However, this should not affect the attribute value literal 
> itself.

You are confusing two things.

The _syntax_ being different is a problem for people writing _parsers_. It 
has absolutely no effect whatsoever on the strongly typed value that is 
used in the cascade, computation, inheritance, used-value-calculation, and 
actual-value-calculation steps.

Take 'color' for instance. All of the following:

   color: red;
   color: RED;
   color: #f00;
   color: #FF0000;
   color: rgb(255,0,0);
   color: rgb(100%, 0%, 0%);

...have EXACTLY THE SAME internal representation. They are all EXACTLY the 
same specified value, computed value, cascade value, inherited value, used 
value, etc. You don't have to "convert" the keyword 'red' to the hex value 
"#FF0000"; it's the same thing. The only difference is the syntax that the 
parser has to support.


The only problem with having SVG attributes use a different syntax than 
text/css is that you need a different parser. There are plenty of 
differences in the syntax:

 * Numbers can have "e" notation in SVG, not in CSS.
 * Lengths can omit the "px" unit specifier in SVG, not in CSS.
 * Keywords are case-sensitive in SVG, not in CSS.
 * Values in lists can have CSS comments between them in CSS, not in SVG.
 * etc.

We are already way past the paint of being able to trivially re-use the 
same parser for both.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 6 January 2006 01:58:01 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:33 GMT