Skip to content

Commit 5344b81

Browse files
author
Greg Whitworth
committed
[Resize-Observer] Updated spec text to reflect IDL changes and added example
1 parent 995396f commit 5344b81

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

resize-observer-1/Overview.bs

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ urlPrefix: https://www.w3.org/TR/SVG2/#InterfaceSVGGraphicsElement
3636
url: #InterfaceSVGGraphicsElement; type: dfn; text: SVGGraphicsElement
3737
urlPrefix: https://www.w3.org/TR/css3-multicol/
3838
url: #; type: dfn; text: Multi-column
39+
urlPrefix: https://www.w3.org/TR/css-overflow-3/
40+
url: #scrollport; type:dfn; text: scrollport
41+
urlPrefix: https://www.w3.org/TR/css-overflow-3/
42+
url: #scroll-container; type:dfn; text: scroll container
3943
</pre>
4044
<pre class=link-defaults>
4145
spec:dom; type:interface; text:Document
@@ -137,7 +141,7 @@ more boxes than solely the {{content-box}} ResizeObserver takes one or more of t
137141

138142
* {{border-box}} : the {{border-box}} as defined in CSS2
139143
* {{content-box}} : the {{content-box}} as defined in CSS2
140-
* {{content-box}} : the {{scrollport}} of the {{scroll container}}
144+
* {{scroll-box}} : the <a>scrollport</a> of the <a>scroll container</a>
141145

142146
<pre class="idl">
143147
dictionary ResizeObserverOptions {
@@ -147,6 +151,23 @@ more boxes than solely the {{content-box}} ResizeObserver takes one or more of t
147151

148152
<p class='issue'>Is size the right name here? It's actually denoting which layout box we want to observe, possibly `box`?</p>
149153

154+
This section is non-normative. An author may desire to observe more than one CSS box, as such the author
155+
can provide one or many boxes to be observed. For example:
156+
157+
<pre highlight="js">
158+
// Observe the content-box
159+
ro.observe(document.querySelector('#menu'));
160+
161+
// Observe the content and the border box
162+
ro.observe(document.querySelector('#menu'), ['content-box', 'border-box']);
163+
164+
// Observe just the border box
165+
ro.observe(document.querySelector('#menu'), 'border-box');
166+
</pre>
167+
168+
<p class="note">This does not have any impact on which box dimensions are returned to the defined callback when the event is fired,
169+
it solely defines which boxes the author wishes to observe layout changes on.</p>
170+
150171
<pre class="idl">
151172
[Exposed=(Window),
152173
Constructor(ResizeObserverCallback callback)]
@@ -225,13 +246,13 @@ interface ResizeObserverEntry {
225246
The {{Element}} whose size has changed.
226247
: <dfn>borderBoxSize</dfn>
227248
::
228-
{{Element}}'s <a>border box rect</a> when {{ResizeObserverCallback}} is invoked.
249+
{{Element}}'s <a>border box</a> rect when {{ResizeObserverCallback}} is invoked.
229250
: <dfn>contentRect</dfn>
230251
::
231252
{{Element}}'s <a>content rect</a> when {{ResizeObserverCallback}} is invoked.
232253
: <dfn>scrollSize</dfn>
233254
::
234-
{{Element}}'s <a>scroll port</a> when {{ResizeObserverCallback}} is invoked.
255+
{{Element}}'s <a>scrollport</a> when {{ResizeObserverCallback}} is invoked.
235256
</div>
236257

237258
<div dfn-type="method" dfn-for="ResizeObserverEntry">
@@ -251,6 +272,12 @@ interface ResizeObserverEntry {
251272

252273
4. Set |this|.|contentRect|.left to |target|.<a>padding left</a>.
253274

275+
5. To set the {{borderBoxSize}}, {{contentSize}}, and {{scrollSize}} of the current |target| do the following:
276+
277+
1. Set |this|.inlineSize to the box's inline edge size
278+
279+
2. Set |this|.blockSize to the box's block edge size
280+
254281
4. If |target| is an SVG element do these steps:
255282

256283
1. Set |this|.|contentRect|.top and |this|.contentRect.left to 0.
@@ -259,6 +286,12 @@ interface ResizeObserverEntry {
259286

260287
3. Set |this|.|contentRect|.height to |target|.<a>bounding box</a>.height.
261288

289+
4. To set the {{borderBoxSize}}, {{contentSize}}, and {{scrollSize}} of the current |target| do the following:
290+
291+
1. Set |this|.inlineSize to the box's inline bounding box size
292+
293+
2. Set |this|.blockSize to the box's block bounding box size
294+
262295
</div>
263296

264297
<pre class="idl">
@@ -268,7 +301,7 @@ interface ResizeObserverEntry {
268301
};
269302
</pre>
270303

271-
<p class="issue">We're covering the dimensions of the extra boxes, do we want to also cover their positions?</p>
304+
<p class="issue">We're covering the dimensions of the extra boxes, do we want to also cover their positions similiar to that of the initial contentRect?</p>
272305

273306
<h3 id="resize-observation-interface">ResizeObservation</h3>
274307
ResizeObservation holds observation information for a single {{Element}}. This

0 commit comments

Comments
 (0)