Skip to content

Commit 7e3a807

Browse files
committed
[resize-observer-1] Fix and improve "calculate box size"
- Define computedSize - Ensure all paths return - Link more terms - Use switch and "otherwise". Fixes w3c#7615. Fixes w3c#7616.
1 parent d0f3040 commit 7e3a807

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

resize-observer-1/Overview.bs

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -533,41 +533,54 @@ these elements do not use standard CSS box model.
533533

534534
To <dfn>calculate box size</dfn>, given |target| and |observedBox|, run these steps:
535535

536-
1. If |target| is an {{SVGGraphicsElement}} that does not have an associated CSS layout box
536+
1. Let |computedSize| be a new {{ResizeObserverSize}} object.
537537

538-
1. If |observedBox| is "border-box" or "content-box"
538+
2. If |target| is an {{SVGGraphicsElement}} that does not have an associated CSS layout box:
539539

540-
1. Set |computedSize|.inlineSize to |target|'s <a>bounding box</a> inline length.
540+
<dl class=switch>
541+
<dt>If |observedBox| is {{"border-box"}}
541542

542-
2. Set |computedSize|.blockSize to |target|'s <a>bounding box</a> block length.
543+
<dt>If |observedBox| is {{"content-box"}}
543544

544-
2. 1. If |observedBox| is "device-pixel-content-box"
545+
<dd>
546+
1. Set |computedSize|'s {{ResizeObserverSize/inlineSize}} attribute to |target|'s <a>bounding box</a> inline length.
545547

546-
1. Set |computedSize|.inlineSize to |target|'s <a>bounding box</a> inline length, in integral device pixels.
548+
2. Set |computedSize|'s {{ResizeObserverSize/blockSize}} attribute to |target|'s <a>bounding box</a> block length.
547549

548-
2. Set |computedSize|.blockSize to |target|'s <a>bounding box</a> block length, in integral device pixels.
550+
<dt>If |observedBox| is {{"device-pixel-content-box"}}
549551

550-
2. If |target| is not an {{SVGGraphicsElement}} or |target| is an {{SVGGraphicsElement}} that has an associated CSS layout box
552+
<dd>
553+
1. Set |computedSize|'s {{ResizeObserverSize/inlineSize}} attribute to |target|'s <a>bounding box</a> inline length, in integral device pixels.
551554

552-
1. If |observedBox| is "border-box"
555+
2. Set |computedSize|'s {{ResizeObserverSize/blockSize}} attribute to |target|'s <a>bounding box</a> block length, in integral device pixels.
556+
</dl>
553557

554-
1. Set |computedSize|.inlineSize to target's <a>border area</a> inline length.
558+
3. Otherwise:
555559

556-
2. Set |computedSize|.blockSize to target's <a>border area</a> block length.
560+
<dl class=switch>
561+
<dt>If |observedBox| is {{"border-box"}}
557562

558-
2. If |observedBox| is "content-box"
563+
<dd>
564+
1. Set |computedSize|'s {{ResizeObserverSize/inlineSize}} attribute to |target|'s <a>border area</a> inline length.
559565

560-
1. Set |computedSize|.inlineSize to target's <a>content area</a> inline length.
566+
2. Set |computedSize|'s {{ResizeObserverSize/blockSize}} attribute to |target|'s <a>border area</a> block length.
561567

562-
2. Set |computedSize|.blockSize to target's <a>content area</a> block length.
568+
<dt>If |observedBox| is {{"content-box"}}
563569

564-
2. If |observedBox| is "device-pixel-content-box"
570+
<dd>
571+
1. Set |computedSize|'s {{ResizeObserverSize/inlineSize}} attribute to |target|'s <a>content area</a> inline length.
565572

566-
1. Set |computedSize|.inlineSize to target's <a>content area</a> inline length, in integral device pixels.
573+
2. Set |computedSize|'s {{ResizeObserverSize/blockSize}} attribute to |target|'s <a>content area</a> block length.
567574

568-
2. Set |computedSize|.blockSize to target's <a>content area</a> block length, in integral device pixels.
575+
<dt>If |observedBox| is {{"device-pixel-content-box"}}
569576

570-
3. return |computedSize|.
577+
<dd>
578+
1. Set |computedSize|'s {{ResizeObserverSize/inlineSize}} attribute to |target|'s <a>content area</a> inline length, in integral device pixels.
579+
580+
2. Set |computedSize|'s {{ResizeObserverSize/blockSize}} attribute to |target|'s <a>content area</a> block length, in integral device pixels.
581+
</dl>
582+
583+
4. Return |computedSize|.
571584

572585
<h3 id="lifetime">ResizeObserver Lifetime</h3>
573586

0 commit comments

Comments
 (0)