Skip to content

Commit 3362bce

Browse files
author
Simon Pieters
committed
[cssom-view] Use two interfaces for mutable and immutable DOMRects instead of a flag. http://lists.w3.org/Archives/Public/www-style/2013Sep/0725.html
1 parent 785f147 commit 3362bce

2 files changed

Lines changed: 79 additions & 55 deletions

File tree

cssom-view/Overview.html

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<h1>CSSOM View Module</h1>
1818

19-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 25 September 2013</h2>
19+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 26 September 2013</h2>
2020

2121
<dl>
2222

@@ -83,7 +83,7 @@ <h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
8383
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
8484
index at http://www.w3.org/TR/.</a></em>
8585

86-
<p>This is the 25 September 2013 Editor's Draft of CSSOM View. Please send
86+
<p>This is the 26 September 2013 Editor's Draft of CSSOM View. Please send
8787
comments to
8888
<a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
8989
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
@@ -140,7 +140,7 @@ <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
140140
<li><a href="#geometry"><span class="secno">11 </span>Geometry</a>
141141
<ul class="toc">
142142
<li><a href="#the-domrectlist-interface"><span class="secno">11.1 </span>The <code title="">DOMRectList</code> Interface</a></li>
143-
<li><a href="#the-domrect-interface"><span class="secno">11.2 </span>The <code title="">DOMRect</code> Interface</a></li>
143+
<li><a href="#the-domrect-and-domrectimmutable-interfaces"><span class="secno">11.2 </span>The <code title="">DOMRect</code> and <code title="">DOMRectImmutable</code> Interfaces</a></li>
144144
<li><a class="atrisk" href="#the-dompoint-interface"><span class="secno">11.3 </span>The <code title="">DOMPoint</code> Interface</a></li>
145145
<li><a class="atrisk" href="#the-domquad-interface"><span class="secno">11.4 </span>The <code title="">DOMQuad</code> Interface</a></li>
146146
<li><a class="atrisk" href="#the-geometryutils-interface"><span class="secno">11.5 </span>The <code title="">GeometryUtils</code> Interface</a></ul></li>
@@ -1610,10 +1610,11 @@ <h3 id="the-domrectlist-interface"><span class="secno">11.1 </span>The <code tit
16101610
greater than the number of <code><a href="#domrect">DOMRect</a></code> objects associated with the object. Otherwise, the <code><a href="#domrect">DOMRect</a></code> object at
16111611
<var>index</var> must be returned.</p>
16121612

1613-
<h3 id="the-domrect-interface"><span class="secno">11.2 </span>The <code title="">DOMRect</code> Interface</h3>
1613+
<h3 id="the-domrect-and-domrectimmutable-interfaces"><span class="secno">11.2 </span>The <code title="">DOMRect</code> and <code title="">DOMRectImmutable</code> Interfaces</h3>
16141614

1615-
<p>Objects implementing the <code><a href="#domrect">DOMRect</a></code> interface represent a rectangular box. The type of box is specified by the method that returns a
1616-
<code><a href="#domrect">DOMRect</a></code> object. A <code><a href="#domrect">DOMRect</a></code> object has a <i>readonly</i> flag, which is unset unless otherwise stated.</p>
1615+
<p>Objects implementing the <code><a href="#domrect">DOMRect</a></code> or <code><a href="#domrectimmutable">DOMRectImmutable</a></code> interface represent a rectangular box. The type of box is specified by the
1616+
method or attribute that returns a <code><a href="#domrect">DOMRect</a></code> or <code><a href="#domrectimmutable">DOMRectImmutable</a></code> object. The interfaces are identical except the attributes of
1617+
<code><a href="#domrectimmutable">DOMRectImmutable</a></code> are readonly.
16171618

16181619
<pre class="idl">[<a href="#dom-domrect" title="dom-DOMRect">Constructor</a>(unrestricted double left, unrestricted double top, unrestricted double width, <!--
16191620
-->unrestricted double height)]
@@ -1624,7 +1625,18 @@ <h3 id="the-domrect-interface"><span class="secno">11.2 </span>The <code title="
16241625
attribute unrestricted double <a href="#dom-domrect-left" title="dom-DOMRect-left">left</a>;
16251626
attribute unrestricted double <a href="#dom-domrect-width" title="dom-DOMRect-width">width</a>;
16261627
attribute unrestricted double <a href="#dom-domrect-height" title="dom-DOMRect-height">height</a>;
1627-
};</pre>
1628+
};
1629+
1630+
interface <dfn id="domrectimmutable">DOMRectImmutable</dfn> {
1631+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-top" title="dom-DOMRectImmutable-top">top</a>;
1632+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-right" title="dom-DOMRectImmutable-right">right</a>;
1633+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-bottom" title="dom-DOMRectImmutable-bottom">bottom</a>;
1634+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-left" title="dom-DOMRectImmutable-left">left</a>;
1635+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-width" title="dom-DOMRectImmutable-width">width</a>;
1636+
readonly attribute unrestricted double <a href="#dom-domrectimmutable-height" title="dom-DOMRectImmutable-height">height</a>;
1637+
};
1638+
1639+
typedef (<a href="#domrect">DOMRect</a> or <a href="#domrectimmutable">DOMRectImmutable</a>) <dfn id="domrectany">DOMRectAny</dfn>;</pre>
16281640

16291641
<p class="atrisk">The <dfn id="dom-domrect" title="dom-DOMRect"><code>DOMRect(<var>left</var>, <var>top</var>, <var>width</var>, <var>height</var>)</code></dfn> constructor, when
16301642
invoked, must run the following steps:
@@ -1638,30 +1650,29 @@ <h3 id="the-domrect-interface"><span class="secno">11.2 </span>The <code title="
16381650
</ol>
16391651

16401652
<p>The <dfn id="dom-domrect-top" title="dom-DOMRect-top"><code>top</code></dfn> attribute gives the y-coordinate, relative to the <a href="#viewport">viewport</a> origin, of the top of
1641-
the rectangle box. On getting, it must return the current value. On setting, if the <i>readonly</i> flag is set, a
1642-
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception must be thrown. Otherwise, the current value must be set to the new value.</p>
1653+
the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
16431654

16441655
<p>The <dfn id="dom-domrect-right" title="dom-DOMRect-right"><code>right</code></dfn> attribute gives the x-coordinate, relative to the <a href="#viewport">viewport</a> origin, of the
1645-
right of the rectangle box. On getting, it must return the current value. On setting, if the <i>readonly</i> flag is set, a
1646-
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception must be thrown. Otherwise, the current value must be set to the new value.</p>
1656+
right of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
16471657

16481658
<p>The <dfn id="dom-domrect-bottom" title="dom-DOMRect-bottom"><code>bottom</code></dfn> attribute gives the y-coordinate, relative to the <a href="#viewport">viewport</a> origin, of the
1649-
bottom of the rectangle box. On getting, it must return the current value. On setting, if the <i>readonly</i> flag is set, a
1650-
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception must be thrown. Otherwise, the current value must be set to the new value.</p>
1659+
bottom of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
16511660

16521661
<p>The <dfn id="dom-domrect-left" title="dom-DOMRect-left"><code>left</code></dfn> attribute gives the x-coordinate, relative to the <a href="#viewport">viewport</a> origin, of the left
1653-
of the rectangle box. On getting, it must return the current value. On setting, if the <i>readonly</i> flag is set, a
1654-
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception must be thrown. Otherwise, the current value must be set to the new value.</p>
1662+
of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
16551663

16561664
<p>The <dfn id="dom-domrect-width" title="dom-DOMRect-width"><code>width</code></dfn> attribute, on getting, must return the value of <code title="dom-DOMRect-right"><a href="#dom-domrect-right">right</a></code> minus
1657-
<code title="dom-DOMRect-left"><a href="#dom-domrect-left">left</a></code>. On setting, if the <i>readonly</i> flag is set, a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code>
1658-
exception must be thrown. Otherwise, the <code title="dom-DOMRect-right"><a href="#dom-domrect-right">right</a></code> attribute must be set to the new value plus the value of
1665+
<code title="dom-DOMRect-left"><a href="#dom-domrect-left">left</a></code>. On setting, the <code title="dom-DOMRect-right"><a href="#dom-domrect-right">right</a></code> attribute must be set to the new value plus the value of
16591666
<code title="dom-DOMRect-left"><a href="#dom-domrect-left">left</a></code>.</p>
16601667

16611668
<p>The <dfn id="dom-domrect-height" title="dom-DOMRect-height"><code>height</code></dfn> attribute, on getting, must return the value of <code title="dom-DOMRect-bottom"><a href="#dom-domrect-bottom">bottom</a></code>
1662-
minus <code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>. On setting, if the <i>readonly</i> flag is set, a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code>
1663-
exception must be thrown. Otherwise, the <code title="dom-DOMRect-bottom"><a href="#dom-domrect-bottom">bottom</a></code> attribute must be set to the new value plus the value of
1664-
<code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>.</p>
1669+
minus <code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>. On setting, the <code title="dom-DOMRect-bottom"><a href="#dom-domrect-bottom">bottom</a></code> attribute must be set to the new value plus the value
1670+
of <code title="dom-DOMRect-top"><a href="#dom-domrect-top">top</a></code>.</p>
1671+
1672+
<p>The <dfn id="dom-domrectimmutable-top" title="dom-DOMRectImmutable-top"><code>top</code></dfn>, <dfn id="dom-domrectimmutable-right" title="dom-DOMRectImmutable-right"><code>right</code></dfn>,
1673+
<dfn id="dom-domrectimmutable-bottom" title="dom-DOMRectImmutable-bottom"><code>bottom</code></dfn>, <dfn id="dom-domrectimmutable-left" title="dom-DOMRectImmutable-left"><code>left</code></dfn>,
1674+
<dfn id="dom-domrectimmutable-width" title="dom-DOMRectImmutable-width"><code>width</code></dfn> and <dfn id="dom-domrectimmutable-height" title="dom-DOMRectImmutable-height"><code>height</code></dfn> attributes of the
1675+
<code><a href="#domrectimmutable">DOMRectImmutable</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.
16651676

16661677

16671678
<h3 class="atrisk" id="the-dompoint-interface"><span class="secno">11.3 </span>The <code title="">DOMPoint</code> Interface</h3>
@@ -1716,16 +1727,17 @@ <h3 class="atrisk" id="the-dompoint-interface"><span class="secno">11.3 </span>T
17161727
<h3 class="atrisk" id="the-domquad-interface"><span class="secno">11.4 </span>The <code title="">DOMQuad</code> Interface</h3>
17171728

17181729
<p>Objects implementing the <code><a href="#domquad">DOMQuad</a></code> interface represents a quadrilateral shape. <code><a href="#domquad">DOMQuad</a></code> objects have an <dfn id="associated-bounding-rectangle">associated
1719-
bounding rectangle</dfn> set to a <code><a href="#domrect">DOMRect</a></code> object when created.
1730+
bounding rectangle</dfn> set to a <code><a href="#domrectimmutable">DOMRectImmutable</a></code> object when created.
17201731

1721-
<pre class="idl">[<a href="#dom-domquad" title="dom-DOMQuad">Constructor</a>(DOMPointLiteral p1, DOMPointLiteral p2, DOMPointLiteral p3, DOMPointLiteral p4),
1722-
<a href="#dom-domquad" title="dom-DOMQuad">Constructor</a>(DOMRect rect)]
1732+
<pre class="idl">[<a href="#dom-domquad" title="dom-DOMQuad">Constructor</a>(<a href="#dompointliteral">DOMPointLiteral</a> p1, <a href="#dompointliteral">DOMPointLiteral</a> p2, <!--
1733+
--><a href="#dompointliteral">DOMPointLiteral</a> p3, <a href="#dompointliteral">DOMPointLiteral</a> p4),
1734+
<a href="#dom-domquad" title="dom-DOMQuad">Constructor</a>(<a href="#domrectany">DOMRectAny</a> rect)]
17231735
interface <dfn id="domquad">DOMQuad</dfn> {
17241736
[SameObject] readonly attribute <a href="#dompoint">DOMPoint</a> <a href="#dom-domquad-p1" title="dom-DOMQuad-p1">p1</a>;
17251737
[SameObject] readonly attribute <a href="#dompoint">DOMPoint</a> <a href="#dom-domquad-p2" title="dom-DOMQuad-p2">p2</a>;
17261738
[SameObject] readonly attribute <a href="#dompoint">DOMPoint</a> <a href="#dom-domquad-p3" title="dom-DOMQuad-p3">p3</a>;
17271739
[SameObject] readonly attribute <a href="#dompoint">DOMPoint</a> <a href="#dom-domquad-p4" title="dom-DOMQuad-p4">p4</a>;
1728-
[SameObject] readonly attribute <a href="#domrect">DOMRect</a> <a href="#dom-domquad-bounds" title="dom-DOMQuad-bounds">bounds</a>;
1740+
[SameObject] readonly attribute <a href="#domrectimmutable">DOMRectImmutable</a> <a href="#dom-domquad-bounds" title="dom-DOMQuad-bounds">bounds</a>;
17291741
};</pre>
17301742

17311743
<p>The <dfn id="dom-domquad" title="dom-DOMQuad"><code>DOMQuad()</code></dfn> constructor, when invoked, must run the following steps:
@@ -1749,8 +1761,8 @@ <h3 class="atrisk" id="the-domquad-interface"><span class="secno">11.4 </span>Th
17491761
<li><p>Let <var>point 4</var> be a new <code><a href="#dompoint">DOMPoint</a></code> object with <code title="dom-DOMPoint-x"><a href="#dom-dompoint-x">x</a></code> set to <var>left</var>,
17501762
<code title="dom-DOMPoint-y"><a href="#dom-dompoint-y">y</a></code> set to <var>bottom</var>, <code title="dom-DOMPoint-z"><a href="#dom-dompoint-z">z</a></code> set to zero and <code title="dom-DOMPoint-w"><a href="#dom-dompoint-w">w</a></code> set to
17511763
one.
1752-
<li><p>Let <var>bounds</var> be a new <code><a href="#domrect">DOMRect</a></code> object with its attributes set to the values of the namesake attributes in <var>rect</var>, and
1753-
with the <i>readonly</i> flag set.
1764+
<li><p>Let <var>bounds</var> be a new <code><a href="#domrectimmutable">DOMRectImmutable</a></code> object with its attributes set to the values of the namesake attributes in
1765+
<var>rect</var>.
17541766
</ol>
17551767
<li><p>Otherwise, follow these substeps:
17561768
<ol>
@@ -1763,8 +1775,8 @@ <h3 class="atrisk" id="the-domquad-interface"><span class="secno">11.4 </span>Th
17631775
<var>p3</var>.
17641776
<li><p>Let <var>point 4</var> be a new <code><a href="#dompoint">DOMPoint</a></code> object with its attributes set to the values of the namesake dictionary members in
17651777
<var>p4</var>.
1766-
<li><p>Let <var>bounds</var> be a new <code><a href="#domrect">DOMRect</a></code> object describing the bounding box of <var>point 1</var>, <var>point 2</var>, <var>point 3</var>
1767-
and <var>point 4</var>, and with the <i>readonly</i> flag set.
1778+
<li><p>Let <var>bounds</var> be a new <code><a href="#domrectimmutable">DOMRectImmutable</a></code> object describing the bounding box of <var>point 1</var>, <var>point 2</var>, <var>point
1779+
3</var> and <var>point 4</var>.
17681780
</ol>
17691781
<li><p>Return a new <code><a href="#domquad">DOMQuad</a></code> with <code title="dom-DOMQuad-p1"><a href="#dom-domquad-p1">p1</a></code> set to <var>point 1</var>, <code title="dom-DOMQuad-p2"><a href="#dom-domquad-p2">p2</a></code> set to
17701782
<var>point 2</var>, <code title="dom-DOMQuad-p3"><a href="#dom-domquad-p3">p3</a></code> set to <var>point 3</var> and <code title="dom-DOMQuad-p4"><a href="#dom-domquad-p4">p4</a></code> set to <var>point 4</var>, and
@@ -1800,7 +1812,7 @@ <h3 class="atrisk" id="the-geometryutils-interface"><span class="secno">11.5 </s
18001812
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);
18011813
<a href="#domquad">DOMQuad</a> <a href="#dom-geometryutils-convertquadfromnode" title="dom-GeometryUtils-convertQuadFromNode">convertQuadFromNode</a>(<a href="#domquad">DOMQuad</a> quad, <!--
18021814
--><a href="#geometrynode">GeometryNode</a> from, optional <a href="#convertcoordinateoptions">ConvertCoordinateOptions</a> options);
1803-
<a href="#domquad">DOMQuad</a> <a href="#dom-geometryutils-convertrectfromnode" title="dom-GeometryUtils-convertRectFromNode">convertRectFromNode</a>(<a href="#domrect">DOMRect</a> rect, <!--
1815+
<a href="#domquad">DOMQuad</a> <a href="#dom-geometryutils-convertrectfromnode" title="dom-GeometryUtils-convertRectFromNode">convertRectFromNode</a>(<a href="#domrectany">DOMRectAny</a> rect, <!--
18041816
--><a href="#geometrynode">GeometryNode</a> from, optional <a href="#convertcoordinateoptions">ConvertCoordinateOptions</a> options);
18051817
<a href="#dompoint">DOMPoint</a> <a href="#dom-geometryutils-convertpointfromnode" title="dom-GeometryUtils-convertPointFromNode">convertPointFromNode</a>(<a href="#dompointliteral">DOMPointLiteral</a> point, <!--
18061818
--><a href="#geometrynode">GeometryNode</a> from, optional <a href="#convertcoordinateoptions">ConvertCoordinateOptions</a> options);

0 commit comments

Comments
 (0)