Re: [css-transforms] transform-origin and SVG elements

Cameron McCormack:
>> - 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.

Dirk Schulze wrote:
> No, as you said it is not the same in SVG. The one is from the coordinate origin, the other is from the figures top left (object bounding box top left).

Yes, my point was rather that in (almost?) all other cases, 0px and 0% 
are going to mean the same thing, so having them mean different things 
could well be confusing.

>> 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.
>
> Again, you need to assume that people using CSS Transforms come from the HTML world. Every diverging does poison there understanding.

I think this is the approach I would prefer, actually.  This make it so 
that transform-origin behaves the same as HTML -- that is, makes lengths 
and percentages relative to the box containing the content (SVG bbox for 
SVG elements, content rect or whichever one it is for HTML content) -- 
in all cases, except for "auto".  The currently specced behaviour makes 
lengths work differently.  So I feel that this proposal reduces the 
divergence and possibility for confusion.

>> 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.
>>
>
> As I said in one of the previous paragraphs, this is not necessarily needed. I need to check what browsers do currently.

We should make it clear in the spec, even if only by an example or note.

Received on Thursday, 17 October 2013 06:26:57 UTC