Re: [fxtf-drafts] Difficulties with DOMMatrixReadOnly.is2D and other users of it

Context: so Typed OM has a subclass representing matrix transforms. Rather than reproducing all the mechanics of DOMMatrix in the class, it just represents the matrix directly with a DOMMatrix hanging off of it.  All good so far.

Now, to capture the important distinction between 2d and 3d transforms, the transform-related subclasses have an is2D attribute, same as DOMMatrix. But unlike DOMMatrix, is2D here has to be mutable; it *dictates* whether the transform is 2d or 3d, rather than simply *reporting* it. (A z-translate of 0 doesn't make something 2d; if is2D is false, it means the object represents `translate3d(x, y, 0)`.)

There are several possible ways for the 3d-related attributes to react to `is2D=true`. Previously, I chose to have the objects simply *ignore* the 3d-relevant attributes; if `is2D==true`, then a translate will serialize to `translate(x, y)`, even if its `z` attribute was set to `50px` or something.  The WG disagreed with this, and wanted it to more accurately reflect reality, so that if you read the 3d-relevant attributes they would show appropriate values for the equivalent 3d transform. (For example, always returning a `0px` value for the `z` attribute of a `CSSTranslate`.)

This is a bit complicated - it means I need to create a readonly variant of the numeric value classes in TypedOM, so the `z` attribute/etc can properly be stuck permanently at `0px` - but doable. But we come to a problem in `CSSMatrixComponent`, because the 3d-relevant parts aren't separate attributes of the object, but of the *sub-object* DOMMatrix hanging off of it.  To apply the WG's intention, I need some way to tell a DOMMatrix "you *must* stay 2d - ignore or throw on any attempt to make yourself represent a non-planar transform".

Dunno if this is realistic.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/255#issuecomment-366350453 using your GitHub account

Received on Friday, 16 February 2018 20:33:10 UTC