Skip to content

Commit cfc4680

Browse files
committed
[css-ruby] Initial pass of rewriting anonymous box generation and white space rules. (Still missing trim lead/trail rules, and have to clean up white space section to match.)
1 parent a72febd commit cfc4680

2 files changed

Lines changed: 224 additions & 52 deletions

File tree

css-ruby/Overview.html

Lines changed: 131 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,19 @@ <h3 id=box-fixup><span class=secno>2.2. </span> Anonymous Ruby Box
537537
those used to normalize tables</a>. <a
538538
href="#ref-CSS21">[CSS21]<!--{{!CSS21}}--></a>
539539

540-
<ol>
541-
<li>Any in-flow block-level boxes directly contained by a <a
540+
<dl></dl>
541+
542+
<head>
543+
<style scoped=scoped>
544+
dt { counter-increment: box-fixup; }
545+
dt::before { content: counter(box-fixup) ". "; }
546+
</style>
547+
548+
<body>
549+
<dl>
550+
<dt id=anon-gen-inlinize>Inlinize Block-level Boxes
551+
552+
<dd> Any in-flow block-level boxes directly contained by a <a
542553
href="#ruby-container-box"><i>ruby container</i></a>, <a
543554
href="#ruby-base-container-box"><i>ruby base container</i></a>, <a
544555
href="#ruby-annotation-container-box"><i>ruby annotation
@@ -552,32 +563,121 @@ <h3 id=box-fixup><span class=secno>2.2. </span> Anonymous Ruby Box
552563
<code class=css>inline-block</code>’. This computation occurs after
553564
any intermediary anonymous-box fixup (such as that required by internal
554565
table elements).
566+
<p class=issue>I'm not sure if this simplifies anything, since we might
567+
need to handle <a
568+
href="http://lists.w3.org/Archives/Public/www-style/2013Sep/0160.html">wrapping
569+
content</a> within ruby annotations anyway.
555570

556-
<li>Any consecutive sequence of <a href="#ruby-base-box"><i>ruby
557-
bases</i></a> not parented by a <a
558-
href="#ruby-base-container-box"><i>ruby base container</i></a> is wrapped
559-
in an anonymous <a href="#ruby-base-container-box"><i>ruby base
560-
container</i></a>. Similarly, any consecutive sequence of <a
561-
href="#ruby-annotation-box"><i>ruby annotations</i></a> not parented by a
562-
<a href="#ruby-annotation-container-box"><i>ruby annotation
571+
<dt id=anon-gen-bare-inlines>Wrap misparented inline-level content
572+
573+
<dd> Any consecutive sequence of text and inline-level boxes directly
574+
parented by a <a href="#ruby-container-box"><i>ruby container</i></a> or
575+
<a href="#ruby-base-container-box"><i>ruby base container</i></a> is
576+
wrapped in an anonymous <a href="#ruby-base-box"><i>ruby base</i></a>.
577+
Similarly, any consecutive sequence of text and inline-level boxes
578+
directly parented by a <a href="#ruby-annotation-container-box"><i>ruby
579+
annotation container</i></a> is wrapped in an anonymous <a
580+
href="#ruby-annotation-box"><i>ruby annotation</i></a>.
581+
582+
<dt id=anon-gen-discard-space>Remove inter-level white space
583+
584+
<dd> Any anonymous <a href="#ruby-base-box"><i>ruby base</i></a>
585+
containing only white space immediately following a box of type A and
586+
immediately followed by at box of its corresponding type B as defined in
587+
the table below is removed, as if it had ‘<code class=css>display:
588+
none</code>’.
589+
<table class=data>
590+
<thead>
591+
<tr>
592+
<th>A
593+
594+
<th>B
595+
596+
<tbody>
597+
<tr>
598+
<td><a href="#ruby-base-box"><i>ruby base</i></a> or <a
599+
href="#ruby-base-container-box"><i>ruby base container</i></a>
600+
601+
<td><a href="#ruby-annotation-box"><i>ruby annotation</i></a> or <a
602+
href="#ruby-annotation-container-box"><i>ruby annotation
603+
container</i></a>
604+
605+
<tr>
606+
<td><a href="#ruby-annotation-container-box"><i>ruby annotation
607+
container</i></a>
608+
609+
<td><a href="#ruby-annotation-container-box"><i>ruby annotation
610+
container</i></a>
611+
612+
<tr>
613+
<td><a href="#ruby-annotation-box"><i>ruby annotation</i></a>
614+
615+
<td><a href="#ruby-annotation-container-box"><i>ruby annotation
616+
container</i></a>
617+
618+
<tr>
619+
<td><a href="#ruby-annotation-container-box"><i>ruby annotation
620+
container</i></a>
621+
622+
<td><a href="#ruby-annotation-box"><i>ruby annotation</i></a>
623+
</table>
624+
625+
<dt id=anon-gen-interpret-space>Interpret intra-level white space
626+
627+
<dd>
628+
<ul>
629+
<li>Any anonymous <a href="#ruby-base-box"><i>ruby base</i></a>
630+
containing only white space immediately following a <a
631+
href="#ruby-annotation-box"><i>ruby annotation</i></a> or <a
632+
href="#ruby-annotation-container-box"><i>ruby annotation
633+
container</i></a> and immediately followed by a <a
634+
href="#ruby-base-box"><i>ruby base</i></a> or <a
635+
href="#ruby-base-container-box"><i>ruby base container</i></a> is
636+
labelled as <dfn id=inter-segment-white-space>inter-segment white
637+
space</dfn> (and treated specially for pairing and layout, see below).
638+
639+
<li>Any anonymous <a href="#ruby-base-box"><i>ruby base</i></a>
640+
containing only white space both immediately following and immediately
641+
followed by a <a href="#ruby-base-box"><i>ruby base</i></a> is labelled
642+
as <dfn id=inter-base-white-space>inter-base white space</dfn> (and
643+
treated specially for pairing and layout, see below).
644+
645+
<li>Any anonymous <a href="#ruby-annotation-box"><i>ruby
646+
annotation</i></a> containing only white space both immediately
647+
following and immediately followed by a <a
648+
href="#ruby-annotation-box"><i>ruby annotation</i></a> is labelled as
649+
<dfn id=inter-annotation-white-space>inter-annotation white space</dfn>
650+
(and treated specially for pairing and layout, see below).
651+
</ul>
652+
653+
<dt id=anon-gen-anon-containers>Generate anonymous level containers
654+
655+
<dd> Any consecutive sequence of <a href="#ruby-base-box"><i>ruby
656+
bases</i></a> and <a href="#inter-base-white-space"><i>inter-base white
657+
space</i></a> (and not <a
658+
href="#inter-segment-white-space"><i>inter-segment white space</i></a>)
659+
not parented by a <a href="#ruby-base-container-box"><i>ruby base
660+
container</i></a> is wrapped in an anonymous <a
661+
href="#ruby-base-container-box"><i>ruby base container</i></a>.
662+
Similarly, any consecutive sequence of <a
663+
href="#ruby-annotation-box"><i>ruby annotations</i></a> and <a
664+
href="#inter-annotation-white-space"><i>inter-annotation white
665+
space</i></a> not parented by a <a
666+
href="#ruby-annotation-container-box"><i>ruby annotation
563667
container</i></a> is wrapped in an anonymous <a
564668
href="#ruby-annotation-container-box"><i>ruby annotation
565669
container</i></a>.
566670

567-
<li>Within each <a href="#ruby-base-container-box"><i>ruby base
568-
container</i></a>, each sequence of inline-level boxes is wrapped in an
569-
anonymous <a href="#ruby-base-box"><i>ruby base box</i></a>. Similarly,
570-
within each <a href="#ruby-annotation-container-box"><i>ruby annotation
571-
container</i></a>, each sequence of inline-level boxes is wrapped in an
572-
anonymous <a href="#ruby-annotation-box"><i>ruby annotation box</i></a>.
671+
<dt id=anon-gen-anon-ruby>Generate anonymous ruby containers
573672

574-
<li>A sequence of <a href="#ruby-base-container-box"><i>ruby base
575-
containers</i></a> and/or <a
576-
href="#ruby-annotation-container-box"><i>ruby annotation
577-
containers</i></a> not parented by a <a
578-
href="#ruby-container-box"><i>ruby container</i></a> is wrapped in an
579-
anonymous <a href="#ruby-container-box"><i>ruby container</i></a>.
580-
</ol>
673+
<dd> A sequence of <a href="#ruby-base-container-box"><i>ruby base
674+
containers</i></a>, <a href="#ruby-annotation-container-box"><i>ruby
675+
annotation containers</i></a>, and/or <a
676+
href="#inter-segment-white-space"><i>inter-segment white space</i></a>
677+
not parented by a <a href="#ruby-container-box"><i>ruby container</i></a>
678+
is wrapped in an anonymous <a href="#ruby-container-box"><i>ruby
679+
container</i></a>.
680+
</dl>
581681

582682
<p>At this point, all ruby layout structures are properly parented, and the
583683
UA can start to associate bases with their annotations.
@@ -2341,6 +2441,15 @@ <h2 class=no-num id=index> Index</h2>
23412441
<li>hidden ruby annotation, <a href="#hidden"
23422442
title="section 2.4."><strong>2.4.</strong></a>
23432443

2444+
<li>inter-annotation white space, <a href="#inter-annotation-white-space"
2445+
title="section 2.2."><strong>2.2.</strong></a>
2446+
2447+
<li>inter-base white space, <a href="#inter-base-white-space"
2448+
title="section 2.2."><strong>2.2.</strong></a>
2449+
2450+
<li>inter-segment white space, <a href="#inter-segment-white-space"
2451+
title="section 2.2."><strong>2.2.</strong></a>
2452+
23442453
<li>level, <a href="#level" title="section 2.3."><strong>2.3.</strong></a>
23452454

23462455
<li>renderer, <a href="#renderer"

css-ruby/Overview.src.html

Lines changed: 93 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -273,36 +273,99 @@ <h3 id="box-fixup">
273273
Missing parts of the structure are implied through the anonymous box generation rules
274274
<a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">similar to those used to normalize tables</a>. [[!CSS21]]
275275

276-
<ol>
277-
<li>Any in-flow block-level boxes directly contained by a
278-
<i>ruby container</i>,
279-
<i>ruby base container</i>,
280-
<i>ruby annotation container</i>,
281-
<i>ruby base box</i>,
282-
or <i>ruby annotation box</i>
283-
are forced to be inline-level boxes,
284-
and their 'display' value computed accordingly.
285-
For example,
286-
the 'display' property of an in-flow element with ''display: block''
287-
parented by an element with ''display: ruby-text''
288-
computes to ''inline-block''.
289-
This computation occurs after any intermediary anonymous-box fixup
290-
(such as that required by internal table elements).
291-
292-
<li>Any consecutive sequence of <i>ruby bases</i> not parented by a <i>ruby base container</i>
293-
is wrapped in an anonymous <i>ruby base container</i>.
294-
Similarly, any consecutive sequence of <i>ruby annotations</i> not parented by a <i>ruby annotation container</i>
295-
is wrapped in an anonymous <i>ruby annotation container</i>.
296-
297-
<li>Within each <i>ruby base container</i>,
298-
each sequence of inline-level boxes is wrapped in an anonymous <i>ruby base box</i>.
299-
Similarly, within each <i>ruby annotation container</i>,
300-
each sequence of inline-level boxes is wrapped in an anonymous <i>ruby annotation box</i>.
301-
302-
<li>A sequence of <i>ruby base containers</i> and/or <i>ruby annotation containers</i>
303-
not parented by a <i>ruby container</i>
304-
is wrapped in an anonymous <i>ruby container</i>.
305-
</ol>
276+
<dl>
277+
<style scoped>
278+
dt { counter-increment: box-fixup; }
279+
dt::before { content: counter(box-fixup) ". "; }
280+
</style>
281+
282+
<dt id="anon-gen-inlinize">Inlinize Block-level Boxes
283+
<dd>
284+
Any in-flow block-level boxes directly contained by a
285+
<i>ruby container</i>,
286+
<i>ruby base container</i>,
287+
<i>ruby annotation container</i>,
288+
<i>ruby base box</i>,
289+
or <i>ruby annotation box</i>
290+
are forced to be inline-level boxes,
291+
and their 'display' value computed accordingly.
292+
For example,
293+
the 'display' property of an in-flow element with ''display: block''
294+
parented by an element with ''display: ruby-text''
295+
computes to ''inline-block''.
296+
This computation occurs after any intermediary anonymous-box fixup
297+
(such as that required by internal table elements).
298+
<p class="issue">I'm not sure if this simplifies anything,
299+
since we might need to handle
300+
<a href="http://lists.w3.org/Archives/Public/www-style/2013Sep/0160.html">wrapping content</a> within ruby annotations anyway.
301+
302+
<dt id="anon-gen-bare-inlines">Wrap misparented inline-level content
303+
<dd>
304+
Any consecutive sequence of text and inline-level boxes
305+
directly parented by a <i>ruby container</i> or <i>ruby base container</i>
306+
is wrapped in an anonymous <i>ruby base</i>.
307+
Similarly, any consecutive sequence of text and inline-level boxes
308+
directly parented by a <i>ruby annotation container</i>
309+
is wrapped in an anonymous <i>ruby annotation</i>.
310+
311+
<dt id="anon-gen-discard-space">Remove inter-level white space
312+
<dd>
313+
Any anonymous <i>ruby base</i> containing only white space
314+
immediately following a box of type A
315+
and immediately followed by at box of its corresponding type B
316+
as defined in the table below
317+
is removed, as if it had ''display: none''.
318+
<table class="data">
319+
<thead>
320+
<tr><th>A
321+
<th>B
322+
<tbody>
323+
<tr><td><i>ruby base</i> or <i>ruby base container</i>
324+
<td><i>ruby annotation</i> or <i>ruby annotation container</i>
325+
<tr><td><i>ruby annotation container</i>
326+
<td><i>ruby annotation container</i>
327+
<tr><td><i>ruby annotation</i>
328+
<td><i>ruby annotation container</i>
329+
<tr><td><i>ruby annotation container</i>
330+
<td><i>ruby annotation</i>
331+
</table>
332+
333+
<dt id="anon-gen-interpret-space">Interpret intra-level white space
334+
<dd>
335+
<ul>
336+
<li>Any anonymous <i>ruby base</i> containing only white space
337+
immediately following a <i>ruby annotation</i> or <i>ruby annotation container</i>
338+
and immediately followed by a <i>ruby base</i> or <i>ruby base container</i>
339+
is labelled as <dfn>inter-segment white space</dfn>
340+
(and treated specially for pairing and layout, see below).
341+
342+
<li>Any anonymous <i>ruby base</i> containing only white space
343+
both immediately following and immediately followed by a <i>ruby base</i>
344+
is labelled as <dfn>inter-base white space</dfn>
345+
(and treated specially for pairing and layout, see below).
346+
347+
<li>Any anonymous <i>ruby annotation</i> containing only white space
348+
both immediately following and immediately followed by a <i>ruby annotation</i>
349+
is labelled as <dfn>inter-annotation white space</dfn>
350+
(and treated specially for pairing and layout, see below).
351+
</ul>
352+
353+
<dt id="anon-gen-anon-containers">Generate anonymous level containers
354+
<dd>
355+
Any consecutive sequence of <i>ruby bases</i> and <i>inter-base white space</i>
356+
(and not <i>inter-segment white space</i>)
357+
not parented by a <i>ruby base container</i>
358+
is wrapped in an anonymous <i>ruby base container</i>.
359+
Similarly, any consecutive sequence of <i>ruby annotations</i> and <i>inter-annotation white space</i>
360+
not parented by a <i>ruby annotation container</i>
361+
is wrapped in an anonymous <i>ruby annotation container</i>.
362+
363+
<dt id="anon-gen-anon-ruby">Generate anonymous ruby containers
364+
<dd>
365+
A sequence of <i>ruby base containers</i>, <i>ruby annotation containers</i>, and/or <i>inter-segment white space</i>
366+
not parented by a <i>ruby container</i>
367+
is wrapped in an anonymous <i>ruby container</i>.
368+
</dl>
306369

307370
<p>At this point, all ruby layout structures are properly parented,
308371
and the UA can start to associate bases with their annotations.

0 commit comments

Comments
 (0)