W3C home > Mailing lists > Public > www-style@w3.org > November 2010

Re: [css3-2d-transforms] Interop: matrix() values e,f <number> or <length>

From: Brendan Kenny <bckenny@gmail.com>
Date: Thu, 18 Nov 2010 19:45:08 -0800
Message-ID: <AANLkTikjdOFBPVktQsNQDUDbkN=82naTD2CVMRydcBv-@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "www-style@w3.org" <www-style@w3.org>
On Thu, Nov 18, 2010 at 7:08 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/18/10 9:36 PM, Brendan Kenny wrote:
>> Absolutely, but I think in almost all cases the translate function is
>> a better option for that.
> Sure, but various CSSOM apis (e.g. computed style on a transitioning
> element) will spit out matrix().
>> Most matrix transform functions will
>> probably be generated from a calculation of some sort, and it's not
>> clear to me how one would even calculate, for instance, a rotation
>> applied to a translation specified in one of the available units
>> without knowing the scale factor between the two at calculation time.
> I'm not sure what the issue there is, actually...  Applying a rotation to a
> translation Just Works.  Here's an example:
> (  cos(x)  -sin(x)  0 ) ( 1   0   2em )
> (  sin(x)  cos(x)   0 ) ( 0   1   3ex )
> (   0        0      1 ) ( 0   0    1  )
> That's applying a rotation by x to a (2em, 3ex) translation.  Just doing out
> the multiplication gives us:
>  ( cos(x) -sin(x)  2em*cos(x) - 3ex*sin(x) )
>  ( sin(x)  cos(x)  2em*sin(x) + 3ex*cos(x) )
>  (   0        0               1            )

ouch, yeah, I was thinking of the general case, and not even the right
way around.

> [snip]
> I don't follow this last part.  How can it possibly make sense to make the
> linear part of the matrix have length units, when it's being multiplied by
> lengths (whereas the translation part is being _added_ to lengths)?  Unit
> analysis failure, sorry.  ;)


>> I'm sure such authors will be a tiny minority. On the other hand, if
>> anyone copies and pastes a matrix from any kind of graphics text, it's
>> all but certain that units won't be included.
> True; all such texts assume a predefined coordinate system.  CSS doesn't
> have one.

> CSS has no concept of user units (or even of a current coordinate system,
> which is necessary to define user units in the first place), so the only way
> to handle the e and f values of the transform matrix is to do one of the
> following:
> 1) Have the spec assume an arbitrary unit for them and specify what it
>   is (which it doesn't).  I assume webkit makes just such an arbitrary
>   unit choice; which one?  This makes the entries _look_ like numbers
>   to web developers, even though they're no such thing.
> 2) Have these be specified with length units in the matrix (what Gecko
>   does).  This makes the fact that they're lengths explicit.
> 3) Go ahead and try to actually define something akin to user units and
>   try to graft it onto CSS somehow.  Apart from conceptual purity and
>   a feeling of well-being and contentment, this is fundamentally the
>   same as option 1, as far as I can see.

I'll have to get some sleep and then think about this, but it does
seem that I am aiming for option 3 which would indeed be a de facto
option 1. Conceding the point for the moment, any ideas on matrix3d(),
since, as was pointed out[1], some kind of inverse length unit would
be required?

[1] http://lists.w3.org/Archives/Public/www-style/2009Oct/0360.html (again)
Received on Friday, 19 November 2010 03:45:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:41 UTC