[NoInterfaceObject]
interface DOMRectUtils {
readonly attribute unrestricted double top;
readonly attribute unrestricted double right;
readonly attribute unrestricted double bottom;
readonly attribute unrestricted double left;
}
NOTE: The DOMRectUtils
interface is not meant to be inherited from directly, but instead used with the implements
keyword.
The top
getter must return min(this.y
, this.y
+ this.height
).
The right
getter must return max(this.x
, this.x
+ this.width
).
The bottom
getter must return max(this.y
, this.y
+ this.height
).
The left
getter must return min(this.x
, this.x
+ this.width
).
[Constructor(unrestricted optional double x = 0, unrestricted optional double y = 0,
unrestricted optional double width = 0, unrestricted optional double height = 0)]
interface DOMRect implements DOMRectUtils {
attribute unrestricted double x;
attribute unrestricted double y;
attribute unrestricted double width;
attribute unrestricted double height;
};
DOMRect
instances have four internal slots, [[x]]
, [[y]]
, [[width]]
, and [[height]]
.
The DOMRect(x, y, width, height)
constructor must:
- Set the
[[x]]
internal slot ofthis
tox
. - Set the
[[y]]
internal slot ofthis
toy
. - Set the
[[width]]
internal slot ofthis
towidth
. - Set the
[[height]]
internal slot ofthis
toheight
.
The x
, y
, width
, and height
accessors must reflect the [[x]]
, [[y]]
, [[width]]
, and [[height]]
internal slots, respectively.
[Constructor(DOMQuadInit quad)]
interface DOMQuadBounds implements DOMRectUtils {
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double width;
readonly attribute unrestricted double height;
};
DOMQuadBounds
instances have one internal slot, [[quad]]
.
The DOMQuadBounds(quad)
constructor must set the [[quad]]
internal slot of this
to quad
.
In the following algorithms, let q
be the value of the [[quad]]
internal slot of this
. Then:
The x
getter must return the minimum of q.p1.x
, q.p2.x
, q.p3.x
, and q.p4.x
.
The y
getter must return the minimum of q.p1.y
, q.p2.y
, q.p3.y
, and q.p4.y
.
The width
getter must return (the maximum of q.p1.x
, q.p2.x
, q.p3.x
, and q.p4.x
) minus this.x
.
The height
getter must return (the maximum of q.p1.y
, q.p2.y
, q.p3.y
, and q.p4.y
) minus this.y
.