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

On Nov 29, 2010, at 7:26 AM, Boris Zbarsky wrote:

> On 11/29/10 10:18 AM, Chris Marrin wrote:
>>> OK, what are they?  And again, I think allowing units in translate() but not in matrix() is really weird.  For one thing, I'm failing to come up with a self-consistent model of how transforms work in that world...
>> If an element is present (in style, for instance), then we convert using that element. If we don't (as in the current CSSMatrix constructor) then we convert using some unit distance which is not well defined.
> I guess I wasn't clear.  "What are they?" isn't a question about what implementations do; it's a question about what the spec should say. "some unit distance which is not well defined" is not a good answer there.  ;)

Right. Do you have a good answer?

>>>> This brings up a glaring problem with CSSMatrix. When you construct one, it is not associated with any element, so you can't use an element's style to convert units. Today, when we encounter the above CSSMatrix constructor I believe we just convert 50% to a value of 50 or something equally arbitrary. We should probably amend CSSMatrix to allow an element to be passed to the constructor. This brings up the next sticky issue of what happens when, for instance, the client size of the element changes. Do values in the CSSMatrix change? Madness!
>>> Agreed.  Why are we allowing percentages here again?  ;)
>> In CSSMatrix? Why do we allow percentages anywhere?
> We allow percentages in situations where there is a clear percentage basis, not "anywhere"....

Now I think I was not being clear. When you construct a CSSMatrix, you can do it like this:

	var m = new CSSMatrix("translate(50%, 25%)");

How do I convert those percentages into reasonable values in the matrix? If we had a way to pass an element into CSSMatrix, then we could use that element and, at the moment of matrix creation, that element would be used to convert the translation values. If the element changes, it would not change the values in the CSSMatrix.


Received on Wednesday, 1 December 2010 19:37:35 UTC