[css-transforms] transform-origin and SVG elements

I think the behaviour of transform-origin, where lengths mean different 
things depending on whether the element is an SVG element or not, isn't 
great.  It leads to questions like:

- Why shouldn't 'transform-origin: 0px 0px' and 'transform-origin: 0% 
0%' mean the same thing?  Surely 0% of anything is 0, and so that should 
be equivalent to 0px.

- How do we treat 'transform-origin: calc(0% + 0px) calc(0% + 0px)'?


What about having something in the property value that explicitly opts 
in to having values be relative to the SVG viewport rather than the 
bounding box?  For example:

   transform-origin: viewport 50% 50%;  /* middle of the viewport */
   transform-origin: 50% 50%;           /* middle of the bbox */
   transform-origin: viewport 4px 4px;  /* relative to viewport origin */
   transform-origin: 4px 4px;           /* relative to the bbox origin */

And then the UA style sheet could set

   transform-origin: viewport 0 0;

on SVG elements.


Alternatively, since setting the transform origin to be anything 
viewport relative except for the origin isn't that useful -- and could 
be handled by translations in the 'transform' property -- we could just 
add a single new value which means the viewport origin for SVG elements, 
and the bbox origin for other elements:

   transform-origin: auto;

This would then be the initial value, no need for a UA style sheet rule. 
  Percentages and lengths would always be relative to the bbox.


Even if we don't do either of these, and leave the "percentages are 
interpreted differently" behaviour, we should define what happens with 
calc()s that contain percentages.

Received on Wednesday, 16 October 2013 23:35:07 UTC