Re: [geometry] DOMQuad is weird

On Tue, Oct 18, 2016 at 11:29 AM, Simon Fraser <> wrote:

> DOMQuad seems like the odd one out of the Geometry interfaces. It doesn’t
> have a ReadOnly variant, and, unlike DOMRect, its points are 3D DOMPoints
> (with x,y,w,z). In the WebKit implementation, we never have a need to store
> quads in 3D space; they only ever exist in the plane of an element. We do
> have code that tracks an accumulated matrix along with a planar quad when
> mapping through 3D rendering contexts, but the quads are only ever used
> once you flatten into the plane of an element.
> Also, I think [SameObject] readonly attribute DOMPoint cause unwanted
> behavior for JS authors.
> Consider:
> var quad = DOMQuad.fromQuad({ p1:{ x:11, y:12 }, p2:{ x:22, y:23 }, p3:{
> x:33, y:34 }, p4:{ x:44, y:45 } });
> var firstPoint = quad.p1;
> firstPoint.x = 9999;
> if (quad.p1.x == 9999)
>     console.log(“what the hey”); <— this happens
> I think it’s very counterintuitive for JS authors to have the points be
> “live” if you pass them to other parts of the code and then modify them.

I don't understand why that would be counter-intuitive. Isn't this normal
JavaScript behavior?
Having them be non-live would be "magic" because a DOMQuad is supposed to
be a simple detached object.

Received on Wednesday, 19 October 2016 18:38:12 UTC