- From: Simon Pieters <simonp@opera.com>
- Date: Tue, 07 Jan 2014 12:30:17 +0100
- To: "public-fx@w3.org" <public-fx@w3.org>, "Robert O'Callahan" <robert@ocallahan.org>
On Mon, 06 Jan 2014 12:37:20 +0100, Robert O'Callahan
<robert@ocallahan.org> wrote:
> It's unclear how to compute the bounds rect from the points in the
> DOMQuad.
> We're told it's "live", and that after constructing a DOMQuad from a
> DOMRectReadOnly, 'bounds' matches the rect, so quad.bounds.x = quad.p1.x.
I don't see how the last part follows.
> But if someone constructs a DOMQuad({x:2},{x:0},{x:4}) then quad.bounds.x
> can't be quad.p1.x (2), it must be either 0 or 4. It's not clear which
> one
> it should be.
(I assume that you meant to include four points above.)
It's defined as follows:
"Let bounds be a new DOMRectReadOnly object describing the smallest
bounding box of point 1, point 2, point 3 and point 4."
This is the same language as is used by e.g.
http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
I can see that it might be ambiguous as to whether the rect should have
non-negative or negative width/height, I guess. Filed
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24219
> It seems difficult to define 'bounds' in a simple way that
> gives sensible results for live updates and satisfies quad.bounds.x =
> quad.p1.x whenever the quad was constructed from a DOMRectReadOnly.
I don't see why quad.bounds.x = quad.p1.x should be a goal.
> The simplest solution is to set quad.bounds.x to the mininum x over all
> points, and quad.bounds.width to the difference between the maximum xs
> and
> the mininum xs, dropping the requirement that 'bounds' matches the
> DOMRectReadOnly used to construct a quad.
Is the issue that you think it is confusing that new
DOMQuad(rectWithNegativeWidth) gets a .bounds with negative width, but
when the a point changes, the .bounds flips to non-negative? So we should
make .bounds have non-negative width/height in the constructor already?
--
Simon Pieters
Opera Software
Received on Tuesday, 7 January 2014 11:29:40 UTC