Skip to content

Commit 62429b9

Browse files
author
Simon Pieters
committed
[cssom-view] Move common members of DOMRect and DOMRectReadOnly to a new interface. Also make the argument to getBoxQuads optional.
1 parent e008267 commit 62429b9

2 files changed

Lines changed: 56 additions & 54 deletions

File tree

cssom-view/Overview.html

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,10 +1035,10 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
10351035
<code title="dom-Element-getClientRects"><a href="#dom-element-getclientrects">getClientRects()</a></code> on the
10361036
same element this method was invoked on.</li>
10371037
<li><p>If the <var>list</var> is empty return a <code><a href="#domrect">DOMRect</a></code>
1038-
object whose <code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>,
1039-
<code title="dom-DOMRect-right"><a href="#dom-domrect-right">right</a></code>,
1040-
<code title="dom-DOMRect-bottom"><a href="#dom-domrect-bottom">bottom</a></code> and
1041-
<code title="dom-DOMRect-left"><a href="#dom-domrect-left">left</a></code> members are zero.</li>
1038+
object whose <code title="dom-DOMRect-x"><a href="#dom-domrect-x">x</a></code>,
1039+
<code title="dom-DOMRect-y"><a href="#dom-domrect-y">y</a></code>,
1040+
<code title="dom-DOMRect-width"><a href="#dom-domrect-width">width</a></code> and
1041+
<code title="dom-DOMRect-height"><a href="#dom-domrect-height">height</a></code> members are zero.</li>
10421042
<li><p>Otherwise, return a <code><a href="#domrect">DOMRect</a></code> object describing the
10431043
smallest rectangle that includes the first rectangle in <var>list</var>
10441044
and all of the remaining rectangles of which the height or width is not
@@ -1492,10 +1492,10 @@ <h2 id="extensions-to-the-range-interface"><span class="secno">9 </span>Extensio
14921492
same range this method was invoked on.</li>
14931493
<li><p>If <var>list</var> is empty return a
14941494
<code><a href="#domrect">DOMRect</a></code> object whose
1495-
<code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>,
1496-
<code title="dom-DOMRect-right"><a href="#dom-domrect-right">right</a></code>,
1497-
<code title="dom-DOMRect-bottom"><a href="#dom-domrect-bottom">bottom</a></code> and
1498-
<code title="dom-DOMRect-left"><a href="#dom-domrect-left">left</a></code> members are zero.</li>
1495+
<code title="dom-DOMRect-x"><a href="#dom-domrect-x">x</a></code>,
1496+
<code title="dom-DOMRect-y"><a href="#dom-domrect-y">y</a></code>,
1497+
<code title="dom-DOMRect-width"><a href="#dom-domrect-width">width</a></code> and
1498+
<code title="dom-DOMRect-height"><a href="#dom-domrect-height">height</a></code> members are zero.</li>
14991499
<li><p>Otherwise, return a <code><a href="#domrect">DOMRect</a></code> object describing the
15001500
smallest rectangle that includes the first rectangle in <var>list</var>
15011501
and all of the remaining rectangles of which the height or width is not
@@ -1641,23 +1641,26 @@ <h3 id="the-domrect-and-domrectreadonly-interfaces"><span class="secno">11.2 </s
16411641
attribute unrestricted double <a href="#dom-domrect-y" title="dom-DOMRect-y">y</a>;
16421642
attribute unrestricted double <a href="#dom-domrect-width" title="dom-DOMRect-width">width</a>;
16431643
attribute unrestricted double <a href="#dom-domrect-height" title="dom-DOMRect-height">height</a>;
1644-
readonly attribute unrestricted double <a href="#dom-domrect-top" title="dom-DOMRect-top">top</a>;
1645-
readonly attribute unrestricted double <a href="#dom-domrect-right" title="dom-DOMRect-right">right</a>;
1646-
readonly attribute unrestricted double <a href="#dom-domrect-bottom" title="dom-DOMRect-bottom">bottom</a>;
1647-
readonly attribute unrestricted double <a href="#dom-domrect-left" title="dom-DOMRect-left">left</a>;
16481644
};
16491645

16501646
interface <dfn id="domrectreadonly">DOMRectReadOnly</dfn> {
16511647
readonly attribute unrestricted double <a href="#dom-domrectreadonly-x" title="dom-DOMRectReadOnly-x">x</a>;
16521648
readonly attribute unrestricted double <a href="#dom-domrectreadonly-y" title="dom-DOMRectReadOnly-y">y</a>;
16531649
readonly attribute unrestricted double <a href="#dom-domrectreadonly-width" title="dom-DOMRectReadOnly-width">width</a>;
16541650
readonly attribute unrestricted double <a href="#dom-domrectreadonly-height" title="dom-DOMRectReadOnly-height">height</a>;
1655-
readonly attribute unrestricted double <a href="#dom-domrectreadonly-top" title="dom-DOMRectReadOnly-top">top</a>;
1656-
readonly attribute unrestricted double <a href="#dom-domrectreadonly-right" title="dom-DOMRectReadOnly-right">right</a>;
1657-
readonly attribute unrestricted double <a href="#dom-domrectreadonly-bottom" title="dom-DOMRectReadOnly-bottom">bottom</a>;
1658-
readonly attribute unrestricted double <a href="#dom-domrectreadonly-left" title="dom-DOMRectReadOnly-left">left</a>;
16591651
};
16601652

1653+
[NoInterfaceObject]
1654+
interface <dfn id="abstractrect">AbstractRect</dfn> {
1655+
readonly attribute unrestricted double <a href="#dom-abstractrect-top" title="dom-AbstractRect-top">top</a>;
1656+
readonly attribute unrestricted double <a href="#dom-abstractrect-right" title="dom-AbstractRect-right">right</a>;
1657+
readonly attribute unrestricted double <a href="#dom-abstractrect-bottom" title="dom-AbstractRect-bottom">bottom</a>;
1658+
readonly attribute unrestricted double <a href="#dom-abstractrect-left" title="dom-AbstractRect-left">left</a>;
1659+
};
1660+
1661+
<a href="#domrect">DOMRect</a> implements <a href="#abstractrect">AbstractRect</a>;
1662+
<a href="#domrectreadonly">DOMRectReadOnly</a> implements <a href="#abstractrect">AbstractRect</a>;
1663+
16611664
typedef (<a href="#domrect">DOMRect</a> or <a href="#domrectreadonly">DOMRectReadOnly</a>) <dfn id="domrectany">DOMRectAny</dfn>;</pre>
16621665

16631666
<p class="atrisk">The <dfn id="dom-domrect" title="dom-DOMRect"><code>DOMRect(<var>x</var>, <var>y</var>, <var>width</var>, <var>height</var>)</code></dfn> constructor, when
@@ -1683,24 +1686,22 @@ <h3 id="the-domrect-and-domrectreadonly-interfaces"><span class="secno">11.2 </s
16831686
<a href="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a>. On setting, the <a href="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a> must be set to the new
16841687
value.
16851688

1686-
<p>The <dfn id="dom-domrect-top" title="dom-DOMRect-top"><code>top</code></dfn> attribute, on getting, must return min(<a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
1689+
<p>The <dfn id="dom-domrectreadonly-x" title="dom-DOMRectReadOnly-x"><code>x</code></dfn>, <dfn id="dom-domrectreadonly-y" title="dom-DOMRectReadOnly-y"><code>y</code></dfn>,
1690+
<dfn id="dom-domrectreadonly-width" title="dom-DOMRectReadOnly-width"><code>width</code></dfn> and <dfn id="dom-domrectreadonly-height" title="dom-DOMRectReadOnly-height"><code>height</code></dfn> attributes of the
1691+
<code><a href="#domrectreadonly">DOMRectReadOnly</a></code> interface, on getting, must behave the same as the attribute of the same name on the <code><a href="#domrect">DOMRect</a></code> interface.
1692+
1693+
<p>The <dfn id="dom-abstractrect-top" title="dom-AbstractRect-top"><code>top</code></dfn> attribute, on getting, must return min(<a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
16871694
coordinate</a>, <a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y coordinate</a> + <a href="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a>).
16881695

1689-
<p>The <dfn id="dom-domrect-right" title="dom-DOMRect-right"><code>right</code></dfn> attribute, on getting, must return max(<a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
1696+
<p>The <dfn id="dom-abstractrect-right" title="dom-AbstractRect-right"><code>right</code></dfn> attribute, on getting, must return max(<a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
16901697
coordinate</a>, <a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x coordinate</a> - <a href="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a>).
16911698

1692-
<p>The <dfn id="dom-domrect-bottom" title="dom-DOMRect-bottom"><code>bottom</code></dfn> attribute, on getting, must return max(<a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
1699+
<p>The <dfn id="dom-abstractrect-bottom" title="dom-AbstractRect-bottom"><code>bottom</code></dfn> attribute, on getting, must return max(<a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
16931700
coordinate</a>, <a href="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y coordinate</a> - <a href="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a>).
16941701

1695-
<p>The <dfn id="dom-domrect-left" title="dom-DOMRect-left"><code>left</code></dfn> attribute, on getting, must return min(<a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
1702+
<p>The <dfn id="dom-abstractrect-left" title="dom-AbstractRect-left"><code>left</code></dfn> attribute, on getting, must return min(<a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
16961703
coordinate</a>, <a href="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x coordinate</a> + <a href="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a>).
16971704

1698-
<p>The <dfn id="dom-domrectreadonly-x" title="dom-DOMRectReadOnly-x"><code>x</code></dfn>, <dfn id="dom-domrectreadonly-y" title="dom-DOMRectReadOnly-y"><code>y</code></dfn>,
1699-
<dfn id="dom-domrectreadonly-width" title="dom-DOMRectReadOnly-width"><code>width</code></dfn>, <dfn id="dom-domrectreadonly-height" title="dom-DOMRectReadOnly-height"><code>height</code></dfn>,
1700-
<dfn id="dom-domrectreadonly-top" title="dom-DOMRectReadOnly-top"><code>top</code></dfn>, <dfn id="dom-domrectreadonly-right" title="dom-DOMRectReadOnly-right"><code>right</code></dfn>,
1701-
<dfn id="dom-domrectreadonly-bottom" title="dom-DOMRectReadOnly-bottom"><code>bottom</code></dfn> and <dfn id="dom-domrectreadonly-left" title="dom-DOMRectReadOnly-left"><code>left</code></dfn> attributes of the
1702-
<code><a href="#domrectreadonly">DOMRectReadOnly</a></code> interface, on getting, must behave the same as the attribute of the same name on the <code><a href="#domrect">DOMRect</a></code> interface.
1703-
17041705

17051706
<h3 class="atrisk" id="the-dompoint-interface"><span class="secno">11.3 </span>The <code title="">DOMPoint</code> Interface</h3>
17061707

@@ -1840,7 +1841,7 @@ <h3 class="atrisk" id="the-geometryutils-interface"><span class="secno">11.5 </s
18401841

18411842
[NoInterfaceObject]
18421843
interface <dfn id="geometryutils">GeometryUtils</dfn> {
1843-
sequence&lt;<a href="#domquad">DOMQuad</a>&gt; <a href="#dom-geometryutils-getboxquads" title="dom-GeometryUtils-getBoxQuads">getBoxQuads</a>(<a href="#boxquadoptions">BoxQuadOptions</a> options);
1844+
sequence&lt;<a href="#domquad">DOMQuad</a>&gt; <a href="#dom-geometryutils-getboxquads" title="dom-GeometryUtils-getBoxQuads">getBoxQuads</a>(optional <a href="#boxquadoptions">BoxQuadOptions</a> options);
18441845
<a href="#domquad">DOMQuad</a> <a href="#dom-geometryutils-convertquadfromnode" title="dom-GeometryUtils-convertQuadFromNode">convertQuadFromNode</a>(<a href="#domquad">DOMQuad</a> quad, <!--
18451846
--><a href="#geometrynode">GeometryNode</a> from, optional <a href="#convertcoordinateoptions">ConvertCoordinateOptions</a> options);
18461847
<a href="#domquad">DOMQuad</a> <a href="#dom-geometryutils-convertrectfromnode" title="dom-GeometryUtils-convertRectFromNode">convertRectFromNode</a>(<a href="#domrectany">DOMRectAny</a> rect, <!--

cssom-view/Overview.src.html

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,10 @@ <h2>Extensions to the <code title>Element</code> Interface</h2>
993993
<code title=dom-Element-getClientRects>getClientRects()</code> on the
994994
same element this method was invoked on.</p></li>
995995
<li><p>If the <var>list</var> is empty return a <code>DOMRect</code>
996-
object whose <code title=dom-DOMRect-top>top</code>,
997-
<code title=dom-DOMRect-right>right</code>,
998-
<code title=dom-DOMRect-bottom>bottom</code> and
999-
<code title=dom-DOMRect-left>left</code> members are zero.</p></li>
996+
object whose <code title=dom-DOMRect-x>x</code>,
997+
<code title=dom-DOMRect-y>y</code>,
998+
<code title=dom-DOMRect-width>width</code> and
999+
<code title=dom-DOMRect-height>height</code> members are zero.</p></li>
10001000
<li><p>Otherwise, return a <code>DOMRect</code> object describing the
10011001
smallest rectangle that includes the first rectangle in <var>list</var>
10021002
and all of the remaining rectangles of which the height or width is not
@@ -1450,10 +1450,10 @@ <h2>Extensions to the <code title>Range</code> Interface</h2>
14501450
same range this method was invoked on.</p></li>
14511451
<li><p>If <var>list</var> is empty return a
14521452
<code>DOMRect</code> object whose
1453-
<code title=dom-DOMRect-top>top</code>,
1454-
<code title=dom-DOMRect-right>right</code>,
1455-
<code title=dom-DOMRect-bottom>bottom</code> and
1456-
<code title=dom-DOMRect-left>left</code> members are zero.</p></li>
1453+
<code title=dom-DOMRect-x>x</code>,
1454+
<code title=dom-DOMRect-y>y</code>,
1455+
<code title=dom-DOMRect-width>width</code> and
1456+
<code title=dom-DOMRect-height>height</code> members are zero.</p></li>
14571457
<li><p>Otherwise, return a <code>DOMRect</code> object describing the
14581458
smallest rectangle that includes the first rectangle in <var>list</var>
14591459
and all of the remaining rectangles of which the height or width is not
@@ -1599,23 +1599,26 @@ <h3>The <code title>DOMRect</code> and <code title>DOMRectReadOnly</code> Interf
15991599
attribute unrestricted double <span title=dom-DOMRect-y>y</span>;
16001600
attribute unrestricted double <span title=dom-DOMRect-width>width</span>;
16011601
attribute unrestricted double <span title=dom-DOMRect-height>height</span>;
1602-
readonly attribute unrestricted double <span title=dom-DOMRect-top>top</span>;
1603-
readonly attribute unrestricted double <span title=dom-DOMRect-right>right</span>;
1604-
readonly attribute unrestricted double <span title=dom-DOMRect-bottom>bottom</span>;
1605-
readonly attribute unrestricted double <span title=dom-DOMRect-left>left</span>;
16061602
};
16071603

16081604
interface <dfn>DOMRectReadOnly</dfn> {
16091605
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-x>x</span>;
16101606
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-y>y</span>;
16111607
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-width>width</span>;
16121608
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-height>height</span>;
1613-
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-top>top</span>;
1614-
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-right>right</span>;
1615-
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-bottom>bottom</span>;
1616-
readonly attribute unrestricted double <span title=dom-DOMRectReadOnly-left>left</span>;
16171609
};
16181610

1611+
[NoInterfaceObject]
1612+
interface <dfn>AbstractRect</dfn> {
1613+
readonly attribute unrestricted double <span title=dom-AbstractRect-top>top</span>;
1614+
readonly attribute unrestricted double <span title=dom-AbstractRect-right>right</span>;
1615+
readonly attribute unrestricted double <span title=dom-AbstractRect-bottom>bottom</span>;
1616+
readonly attribute unrestricted double <span title=dom-AbstractRect-left>left</span>;
1617+
};
1618+
1619+
<span>DOMRect</span> implements <span>AbstractRect</span>;
1620+
<span>DOMRectReadOnly</span> implements <span>AbstractRect</span>;
1621+
16191622
typedef (<span>DOMRect</span> or <span>DOMRectReadOnly</span>) <dfn>DOMRectAny</dfn>;</pre>
16201623

16211624
<p class=atrisk>The <dfn title=dom-DOMRect><code>DOMRect(<var>x</var>, <var>y</var>, <var>width</var>, <var>height</var>)</code></dfn> constructor, when
@@ -1641,24 +1644,22 @@ <h3>The <code title>DOMRect</code> and <code title>DOMRectReadOnly</code> Interf
16411644
<span title=concept-geometry-rectangle-height>height</span>. On setting, the <span title=concept-geometry-rectangle-height>height</span> must be set to the new
16421645
value.
16431646

1644-
<p>The <dfn title=dom-DOMRect-top><code>top</code></dfn> attribute, on getting, must return min(<span title=concept-geometry-rectangle-y-coordinate>y
1647+
<p>The <dfn title=dom-DOMRectReadOnly-x><code>x</code></dfn>, <dfn title=dom-DOMRectReadOnly-y><code>y</code></dfn>,
1648+
<dfn title=dom-DOMRectReadOnly-width><code>width</code></dfn> and <dfn title=dom-DOMRectReadOnly-height><code>height</code></dfn> attributes of the
1649+
<code>DOMRectReadOnly</code> interface, on getting, must behave the same as the attribute of the same name on the <code>DOMRect</code> interface.
1650+
1651+
<p>The <dfn title=dom-AbstractRect-top><code>top</code></dfn> attribute, on getting, must return min(<span title=concept-geometry-rectangle-y-coordinate>y
16451652
coordinate</span>, <span title=concept-geometry-rectangle-y-coordinate>y coordinate</span> + <span title=concept-geometry-rectangle-height>height</span>).
16461653

1647-
<p>The <dfn title=dom-DOMRect-right><code>right</code></dfn> attribute, on getting, must return max(<span title=concept-geometry-rectangle-x-coordinate>x
1654+
<p>The <dfn title=dom-AbstractRect-right><code>right</code></dfn> attribute, on getting, must return max(<span title=concept-geometry-rectangle-x-coordinate>x
16481655
coordinate</span>, <span title=concept-geometry-rectangle-x-coordinate>x coordinate</span> - <span title=concept-geometry-rectangle-width>width</span>).
16491656

1650-
<p>The <dfn title=dom-DOMRect-bottom><code>bottom</code></dfn> attribute, on getting, must return max(<span title=concept-geometry-rectangle-y-coordinate>y
1657+
<p>The <dfn title=dom-AbstractRect-bottom><code>bottom</code></dfn> attribute, on getting, must return max(<span title=concept-geometry-rectangle-y-coordinate>y
16511658
coordinate</span>, <span title=concept-geometry-rectangle-y-coordinate>y coordinate</span> - <span title=concept-geometry-rectangle-height>height</span>).
16521659

1653-
<p>The <dfn title=dom-DOMRect-left><code>left</code></dfn> attribute, on getting, must return min(<span title=concept-geometry-rectangle-x-coordinate>x
1660+
<p>The <dfn title=dom-AbstractRect-left><code>left</code></dfn> attribute, on getting, must return min(<span title=concept-geometry-rectangle-x-coordinate>x
16541661
coordinate</span>, <span title=concept-geometry-rectangle-x-coordinate>x coordinate</span> + <span title=concept-geometry-rectangle-width>width</span>).
16551662

1656-
<p>The <dfn title=dom-DOMRectReadOnly-x><code>x</code></dfn>, <dfn title=dom-DOMRectReadOnly-y><code>y</code></dfn>,
1657-
<dfn title=dom-DOMRectReadOnly-width><code>width</code></dfn>, <dfn title=dom-DOMRectReadOnly-height><code>height</code></dfn>,
1658-
<dfn title=dom-DOMRectReadOnly-top><code>top</code></dfn>, <dfn title=dom-DOMRectReadOnly-right><code>right</code></dfn>,
1659-
<dfn title=dom-DOMRectReadOnly-bottom><code>bottom</code></dfn> and <dfn title=dom-DOMRectReadOnly-left><code>left</code></dfn> attributes of the
1660-
<code>DOMRectReadOnly</code> interface, on getting, must behave the same as the attribute of the same name on the <code>DOMRect</code> interface.
1661-
16621663

16631664
<h3 class=atrisk>The <code title>DOMPoint</code> Interface</h3>
16641665

@@ -1798,7 +1799,7 @@ <h3 class=atrisk>The <code title>GeometryUtils</code> Interface</h3>
17981799

17991800
[NoInterfaceObject]
18001801
interface <dfn>GeometryUtils</dfn> {
1801-
sequence&lt;<span>DOMQuad</span>> <span title=dom-GeometryUtils-getBoxQuads>getBoxQuads</span>(<span>BoxQuadOptions</span> options);
1802+
sequence&lt;<span>DOMQuad</span>> <span title=dom-GeometryUtils-getBoxQuads>getBoxQuads</span>(optional <span>BoxQuadOptions</span> options);
18021803
<span>DOMQuad</span> <span title=dom-GeometryUtils-convertQuadFromNode>convertQuadFromNode</span>(<span>DOMQuad</span> quad, <!--
18031804
--><span>GeometryNode</span> from, optional <span>ConvertCoordinateOptions</span> options);
18041805
<span>DOMQuad</span> <span title=dom-GeometryUtils-convertRectFromNode>convertRectFromNode</span>(<span>DOMRectAny</span> rect, <!--

0 commit comments

Comments
 (0)