Skip to content

Commit a2ae634

Browse files
committed
[css-gaps-1][editorial] Merge the gap decoration segment algorithms
1 parent 3d121cf commit a2ae634

1 file changed

Lines changed: 23 additions & 40 deletions

File tree

css-gaps-1/Overview.bs

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ Gap decoration segments</h4>
361361
Algorithms</h5>
362362

363363
<div algorithm>
364-
To <dfn>determine the gap decoration segments</dfn> for a given [=gap=] |G|:
364+
To <dfn>determine gap decoration segments</dfn> for a given [=gap=] |G|:
365365
<ol>
366366
<li>
367-
Let |S|, the collection of [=gap decoration segments=] for |G|, be an empty list.
367+
Let |S| be an empty list.
368368
</li>
369369
<li>
370370
Let |endpoints| be the result of [=creating segment endpoints=] for |G|,
@@ -374,58 +374,41 @@ Gap decoration segments</h4>
374374
between [=start segment endpoint=] and [=end segment endpoint=], beginning with a [=start segment endpoint=].
375375
</li>
376376
<li>
377-
While |endpoints| is not empty:
378-
<ul>
379-
<li>Let |u| be the first [=segment endpoint=] in |endpoints|, and remove it from the list.</li>
380-
<li>Let |v| be the first [=segment endpoint=] in |endpoints|, and remove it from the list.</li>
381-
<li>Create a new [=gap decoration segment=] starting at |u| and ending at |v|.</li>
382-
<li>Append the new segment to |S|.</li>
383-
</ul>
377+
If |endpoints| is empty, return |S|.
384378
</li>
385379
<li>
386-
Return |S|.
380+
Let |break| be the used value of either 'column-rule-break' or 'row-rule-break', whichever applies to the gap.
387381
</li>
388-
</ol>
389-
390-
</div>
391-
392-
<div algorithm>
393-
To <dfn>determine painted segments</dfn> |C| from segments list |S|:
394-
395-
<ol>
396-
<li>Let |S| be the list of segments <a lt="determine the gap decoration segments">determined</a> for the given gap, ordered from start to end along the gap's axis.
397-
<li>Let |C| be an empty list of segments.
398-
<li>Let |break| be the used value of either 'column-rule-break' or 'row-rule-break', whichever applies to the gap.
399-
400-
<li>If |S| is empty, return |C|.
401-
402382
<li>If |break| is ''column-rule-break/none'':
403383
<ol>
404-
<li>Let |first| be the first segment in |S|.
405-
<li>Let |last| be the last segment in |S|.
406-
<li>Let |segment| be [=UNION=](|first|, |last|).
407-
<li>[=Apply offsets to a segment|Apply offsets to=] |segment|, then append it to |C|.
408-
<li>Return |C|.
384+
<li>Let |first| be the first item in |endpoints|.
385+
<li>Let |last| be the last item in |endpoints|.
386+
<li>Create a [=gap decoration segment=] |segment| = [|first|, |last|].
387+
<li>[=Apply offsets to a segment|Apply offsets to=] |segment|, then append it to |S|.
388+
<li>Return |S|.
409389
</ol>
390+
</li>
391+
392+
<li><em>Empty Check:</em> If |endpoints| is empty, return |S|.
410393

411-
<li>Remove the first segment from |S|. Let |s| be that segment.
394+
<li>Create a [=gap decoration segment=] |s| from the first two items in |endpoints|. Remove them both from the list.
412395

413-
<li>If |s|'s endpoints are <a>discontiguous</a>, go back to step 4.
396+
<li>If |s|'s endpoints are <a>discontiguous</a>, go back to <em>Empty Check</em>.
414397

415-
<li>If |S| is not empty:
398+
<li>While |endpoints| is not empty:
416399
<ol>
417-
<li>Let |next| be the first segment in |S|.
400+
<li>Create a [=gap decoration segment=] |next| from the first two items in |endpoints|, leaving them both in the list.
418401
<li>Let |candidate| be <a>UNION</a>(|s|, |next|).
419-
<li>If |candidate|'s endpoints are <a>discontiguous</a>, go to step 9.
420-
<li>If |break| is ''column-rule-break/intersection'' and |candidate| is not <a>flanked by spanning items</a>, go to step 9.
421-
<li>Remove the first segment from |S|.
402+
<li>If |candidate|'s endpoints are <a>discontiguous</a>, exit this loop.
403+
<li>If |break| is ''column-rule-break/intersection'' and |candidate| is not <a>flanked by spanning items</a>, exit this loop.
404+
<li>Remove the first two items from |endpoints|.
422405
<li>Set |s| to <a>UNION</a>(|s|, |next|).
423-
<li>Go back to step 8.
424406
</ol>
407+
</li>
425408

426-
<li>[=Apply offsets to a segment|Apply offsets to=] |s|, then append it to |C|.
409+
<li>[=Apply offsets to a segment|Apply offsets to=] |s|, then append it to |S|.
427410

428-
<li>Go back to step 4.
411+
<li>Go back to <em>Empty Check</em>.
429412
</ol>
430413
</div>
431414

@@ -576,7 +559,7 @@ Break behaviors at intersections: The 'column-rule-break', 'row-rule-break', and
576559

577560
Sets the behavior for breaking decorations within a given gap into segments
578561
at visible "T" or "cross" intersections formed by items in the container.
579-
Precise details for how to apply these values are given in the steps to [=determine painted segments=].
562+
Precise details for how to apply these values are given in the steps to [=determine gap decoration segments=].
580563

581564
<dl dfn-type="value" dfn-for="column-rule-break, row-rule-break">
582565
<dt><dfn>none</dfn>

0 commit comments

Comments
 (0)