Re: [geometry] Replace isIdentity()?

On Jun 7, 2014, at 11:30 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> Agree with this completely. Please keep isIdentity() as currently
> written in the spec.  The downside that some code might
> seemingly-randomly take the quick or slow path depending on precise
> operations seems better than the downside of maybeHasTransform(),
> which'll just make it always take the slow path.
> 
> 'maybeHasTransform' is the API that will give consistent behavior while 'isIdentity' might act randomly. 
> Looking at the webkit and mozilla codebases, 'maybeHasTransform' will almost always take you to the short path. 
> On top of that, it will also be faster to calculate.

I took some time to check the WebKit code base:

There are situations where we compute the transformation from the CTM of one element to the CTM of another element and then check for identity.
There are situations where we transform the origin for later transformations and undo the origin translation later. (Even though no transformation was applied.)
There are situations where we set a member variable to a computed and passed Transform and check it for identity.

All of these patterns would always return ’not identity’ with maybeHasTransform(). I also checked if some of these patterns could be transformed to be able to use maybeHasTransform(). Some could but actually require the authors to have a deep understanding of the functionality of maybeHasTransform(). And the code base must be designed around maybeHasTransform() so that it is by far easier to write isIdentity() yourself. We would do the author a huge disservice in their application structure.

It actually took me some time to check the creation path of just *one* of the transforms that are checked for identity. I wonder how you would be able to traverse all paths and get to such a general statement. I can assure you that it can *not* be generalized for the webkit code base. Since I did not went through all transformation creation paths yet, I can not even say if the patterns above are exclusively or even mostly used. I can just assume that the generalization doesn’t apply to Gecko either.

Greetings,
Dirk

Received on Saturday, 7 June 2014 22:31:44 UTC