E84D add some minor things to getBoundingClientRect and getClientRects to … · w3c/csswg-drafts@990c4a2 · GitHub
Skip to content

Commit 990c4a2

Browse files
committed
add some minor things to getBoundingClientRect and getClientRects to cover empty boxes and svg:foreignObject
1 parent 8724023 commit 990c4a2

2 files changed

Lines changed: 59 additions & 52 deletions

File tree

cssom/Overview.html

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,9 +2642,13 @@ <h4 id=the-getclientrects><span class=secno>4.3.1. </span>The <code><a
26422642
<code><a
26432643
href="#elementlayout-getboundingclientrect">getBoundingClientRect</a></code>
26442644
methods</h4>
2645-
<!-- XXX On block level elements TextRectangleList.length is mostly 1 (except I
2646-
guess for printing or so or multicol perhaps and for inline elements with
2647-
multiple boxes it's the amount of boxes. -->
2645+
2646+
<p>The <code><a
2647+
href="#elementlayout-getclientrects">getClientRects()</a></code> and
2648+
<code><a
2649+
href="#elementlayout-getboundingclientrect">getBoundingClientRect</a></code>
2650+
methods provide information about the position of the border box edges of
2651+
an element relative to the initial containing block.
26482652

26492653
<p>The <dfn
26502654
id=elementlayout-getclientrects><code>getClientRects()</code></dfn>
@@ -2662,8 +2666,9 @@ <h4 id=the-getclientrects><span class=secno>4.3.1. </span>The <code><a
26622666
<p>Return a (static) <code><a
26632667
href="#textrectanglelist">TextRectangleList</a></code> object containing
26642668
a list of (static) <code><a
2665-
href="#textrectangle">TextRectangle</a></code> objects describing the
2666-
border boxes for the element (in content order) on which it was invoked.
2669+
href="#textrectangle">TextRectangle</a></code> objects in content order
2670+
describing the border boxes, even if they are empty, for the element on
2671+
which it was invoked.
26672672
</ol>
26682673

26692674
<p>The <dfn
@@ -2685,28 +2690,26 @@ <h4 id=the-getclientrects><span class=secno>4.3.1. </span>The <code><a
26852690
members are zero.
26862691

26872692
<li>
2688-
<p>Return a union of the rectangles returned by <code><a
2693+
<p>Return a union of the border boxes, excluding border boxes that are
2694+
empty, returned by <code><a
26892695
href="#elementlayout-getclientrects">getClientRects()</a></code> method
26902696
as a single <code><a href="#textrectangle">TextRectangle</a></code>
2691-
object for the element on which it was invoked.
2697+
object for the element on which it was invoked. If all border boxes are
2698+
empty let the <code title=textrectangle-top><a
2699+
href="#textrectangle-top">top</a></code> attribute of the new <code><a
2700+
href="#textrectangle">TextRectangle</a></code> object be the value of
2701+
the <code title=textrectangle-top><a
2702+
href="#textrectangle-top">top</a></code> attribute of the first border
2703+
box in the list returned. Do likewise for <code
2704+
title=textrectangle-left><a href="#textrectangle-left">left</a></code>
2705+
and then let <code title=textrectangle-bottom><a
2706+
href="#textrectangle-bottom">bottom</a></code> be equal to <code
2707+
title=textrectangle-bottom><a
2708+
href="#textrectangle-bottom">top</a></code> and <code
2709+
title=textrectangle-right><a
2710+
href="#textrectangle-right">right</a></code> to <code
2711+
title=textrectangle-left><a href="#textrectangle-left">left</a></code>.
26922712
</ol>
2693-
<!--
2694-
XXX
2695-
2696-
- The returned rectangles do not include the bounds of any child elements
2697-
that might happen to overflow (ok, this was not ambiguous in the above
2698-
definition, it's just a note)
2699-
2700-
- for getClientRects we return rectangles even for CSS boxes that have empty
2701-
border-boxes. The left, top, right and bottom coordinates can still be
2702-
meaningful.
2703-
2704-
- for getBoundingClientRect, we completely ignore CSS boxes that have empty
2705-
border-boxes. If all the element's CSS boxs' border-boxes are empty, then we
2706-
return a rectangle whose width and height are zero and whose top and left are
2707-
the top-left of the border-box for the first (content order) CSS box for the
2708-
element.
2709-
-->
27102713

27112714
<h5 id=the-textrectanglelist><span class=secno>4.3.1.1. </span>The <code><a
27122715
href="#textrectanglelist">TextRectangleList</a></code> Interface</h5>
@@ -2782,6 +2785,10 @@ <h5 id=the-textrectangle><span class=secno>4.3.1.2. </span>The <code><a
27822785
containing block and the left of the rectangle box in CSS pixels as number
27832786
of CSS pixels assuming nothing has been scrolled.
27842787

2788+
<p class=note>The <code>svg:foreignObject</code> element represents an
2789+
initial containing block for its descendents.</p>
2790+
<!-- XXX No specification has specified this so far ... -->
2791+
27852792
<h4 id=the-offset><span class=secno>4.3.2. </span>The <code
27862793
title="">offset<var title="">*</var></code> attributes</h4>
27872794

cssom/Overview.src.html

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,7 @@ <h4>The <code title="">Screen</code> Interface</h4>
21462146

21472147

21482148

2149+
21492150
<h3>The <code title="">DocumentLayout</code> Interface</h3>
21502151

21512152
<p>Objects implementing the <code>Document</code> interface
@@ -2166,6 +2167,7 @@ <h3>The <code title="">DocumentLayout</code> Interface</h3>
21662167

21672168

21682169

2170+
21692171
<h3>The <code title="">ElementLayout</code> Interface</h3>
21702172

21712173
<p>Objects implementing the <code>Element</code> interface
@@ -2193,26 +2195,29 @@ <h3>The <code title="">ElementLayout</code> Interface</h3>
21932195
readonly attribute float <span>clientHeight</span>;
21942196
};</pre>
21952197

2198+
2199+
21962200
<h4>The <code>getClientRects()</code> and <code>getBoundingClientRect</code>
21972201
methods</h4>
21982202

2199-
<!-- XXX On block level elements TextRectangleList.length is mostly 1 (e 638D xcept I
2200-
guess for printing or so or multicol perhaps and for inline elements with
2201-
multiple boxes it's the amount of boxes. -->
2203+
<p>The <code>getClientRects()</code> and <code>getBoundingClientRect</code>
2204+
methods provide information about the position of the border box edges of
2205+
an element relative to the initial containing block.</p>
22022206

22032207
<p>The
22042208
<dfn id="elementlayout-getclientrects"><code>getClientRects()</code></dfn>
22052209
method, when invoked, <em class="ct">must</em> return the result of the
22062210
following algorithm:</p>
2207-
2211+
22082212
<ol>
22092213
<li><p>If the element on which it was invoked does not have an associated CSS
22102214
layout box return an empty (static) <code>TextRectangleList</code> object and
22112215
stop this algorithm.</p></li>
2212-
2216+
22132217
<li><p>Return a (static) <code>TextRectangleList</code> object containing a
2214-
list of (static) <code>TextRectangle</code> objects describing the border
2215-
boxes for the element (in content order) on which it was invoked.</p></li>
2218+
list of (static) <code>TextRectangle</code> objects in content order
2219+
describing the border boxes, even if they are empty, for the element on which
2220+
it was invoked.</p></li>
22162221
</ol>
22172222

22182223
<p>The
@@ -2228,29 +2233,20 @@ <h4>The <code>getClientRects()</code> and <code>getBoundingClientRect</code>
22282233
<code title="textrectangle-bottom">bottom</code> and
22292234
<code title="textrectangle-left">left</code> members are zero.</p></li>
22302235

2231-
<li><p>Return a union of the rectangles returned by
2232-
<code>getClientRects()</code> method as a single <code>TextRectangle</code>
2233-
object for the element on which it was invoked.</p></li>
2236+
<li><p>Return a union of the border boxes, excluding border boxes that are
2237+
empty, returned by <code>getClientRects()</code> method as a single
2238+
<code>TextRectangle</code> object for the element on which it was invoked. If
2239+
all border boxes are empty let the <code title="textrectangle-top">top</code>
2240+
attribute of the new <code>TextRectangle</code> object be the value of the
2241+
<code title="textrectangle-top">top</code> attribute of the first border box
2242+
in the list returned. Do likewise for
2243+
<code title="textrectangle-left">left</code> and then let
2244+
<code title="textrectangle-bottom">bottom</code> be equal to
2245+
<code title="textrectangle-bottom">top</code> and
2246+
<code title="textrectangle-right">right</code> to
2247+
<code title="textrectangle-left">left</code>.</p></li>
22342248
</ol>
22352249

2236-
<!--
2237-
XXX
2238-
2239-
- The returned rectangles do not include the bounds of any child elements
2240-
that might happen to overflow (ok, this was not ambiguous in the above
2241-
definition, it's just a note)
2242-
2243-
- for getClientRects we return rectangles even for CSS boxes that have empty
2244-
border-boxes. The left, top, right and bottom coordinates can still be
2245-
meaningful.
2246-
2247-
- for getBoundingClientRect, we completely ignore CSS boxes that have empty
2248-
border-boxes. If all the element's CSS boxs' border-boxes are empty, then we
2249-
return a rectangle whose width and height are zero and whose top and left are
2250-
the top-left of the border-box for the first (content order) CSS box for the
2251-
element.
2252-
-->
2253-
22542250
<h5>The <code>TextRectangleList</code> Interface</h5>
22552251

22562252
<p>The <code>TextRectangleList</code> object consists of an ordered list of
@@ -2316,6 +2312,10 @@ <h5>The <code>TextRectangle</code> Interface</h5>
23162312
the left of the initial containing block and the left of the rectangle box in
23172313
CSS pixels as number of CSS pixels assuming nothing has been scrolled.</p>
23182314

2315+
<p class="note">The <code>svg:foreignObject</code> element represents an
2316+
initial containing block for its descendents.</p>
2317+
<!-- XXX No specification has specified this so far ... -->
2318+
23192319

23202320

23212321
<h4>The <code title="">offset<var title="">*</var></code> attributes</h4>

0 commit comments

Comments
 (0)