[whatwg] Singular CTM and currentTransform

Dirk Schulze dschulze at adobe.com
Tue Mar 25 08:25:46 PDT 2014


Hi,

Independent if getter getTransform/getCTM or attribute currentTransform, what should be returned for a CTM that is singular (not invertible)?

In WebKit we do not track all transformations of the CTM that caused a singular matrix or are following a transformation that would have caused a singular matrix.

Example:

ctx.scale(0,0);
ct.translate(10,10);

In webkit we would not apply the transformation scale(0,0) and mark the CTM as not-invertible instead. So we could not return an SVGMatrix object with a = b = c = d = 0; e = f = 10 because we actually don’t know the CTM after applying all transforms.

I would suggest that the getter either:
1) throws and invalid state error if the CTM is not invertible
2) returns 0. In WebIDLit would look like: SVGMatrix? getTransform(); 

Greetings,
Dirk

PS: This is one reason I prefer a getter over an attribute because the getter does not return a mutable (live) SVGMatrix. But even than the problem above is not fully solved of course.


More information about the whatwg mailing list