Skip to content

Commit 9c1c802

Browse files
committed
[css-ruby-1] Tighten up ruby layout section. w3c#4986 w3c#4980 w3c#4979 w3c#4976 w3c#4974 w3c#4936 w3c#4935 p=fantasai+frivoal
1 parent c1c40e9 commit 9c1c802

1 file changed

Lines changed: 71 additions & 39 deletions

File tree

css-ruby-1/Overview.bs

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Ruby-specific 'display' Values</h3>
212212
The Ruby Formatting Context</h4>
213213

214214
[=Ruby containers=] are non-atomic [=inline-level=] boxes.
215-
Like [=inline boxes=] (see [[css-inline-3#model]]),
215+
Like regular [=inline boxes=] (see [[css-inline-3#model]]),
216216
they break across lines,
217217
and their [=containing block=] is the nearest [=block container=] ancestor.
218218
And just as the contents of an [=inline box=]
@@ -221,22 +221,27 @@ The Ruby Formatting Context</h4>
221221
participate in the same [=inline formatting context=] that contains the [=ruby container=] itself.
222222

223223
However [=ruby containers=] also establish a <dfn export>ruby formatting context</dfn>
224-
that builds further structure around their segment of the [=inline formatting context=].
224+
that builds further structure around their segment of the [=inline formatting context=]
225+
in order to host their annotations.
225226
<span class=note>Note: this [=formatting context=] is <em>not</em> an [=independent formatting context=].</span>
226227
[=Ruby bases=], [=ruby annotations=], [=ruby base containers=], and [=ruby annotation containers=]
227228
are <dfn export lt="internal ruby boxes|internal ruby display types">internal ruby boxes</dfn>:
228229
like [=internal table elements=],
229230
they have specific roles in ruby layout,
230231
and participate in their [=ruby container=]’s [=ruby formatting context=].
232+
In addition to their role in the [=ruby formatting context=],
233+
[=ruby bases=] simultaneously participate
234+
in the same base-level [=inline formatting context=] as the [=ruby container=],
235+
while [=ruby annotations=] participate
236+
in separate annotation-level [=inline formatting contexts=]
237+
established by the [=ruby container=].
231238

232239
As with the contents of [=inline boxes=],
233240
the [=containing block=] for the contents of a [=ruby container=] (and all its [=internal ruby boxes=])
234241
is the [=containing block=] of the [=ruby container=].
235242
So floats, for example, are trapped by the [=ruby container=]’s [=containing block=],
236243
not any of the ruby box types.
237244

238-
Issue: Are internal ruby boxes inline-level?
239-
240245
<h4 id="block-ruby">
241246
Non-Inline Ruby</h4>
242247

@@ -653,36 +658,48 @@ White Space Collapsing</h3>
653658
Ruby Layout</h2>
654659

655660
When a ruby structure is laid out,
656-
its [=base level=] is laid out on the line,
657-
aligned according to its 'vertical-align' property
658-
exactly as if its [=ruby bases=] were a regular sequence of inline boxes.
659-
Each [=ruby base container=] is sized and positioned
660-
to contain exactly all of its [=ruby bases=]’ margin boxes.
661-
If a [=ruby base container=] has no [=in-flow=] content,
661+
its [=base level=] is laid out on the line
662+
exactly as if its [=ruby bases=] were a regular sequence of [=inline boxes=]
663+
and the [=ruby container=] a regular [=inline box=] wrapped around it
664+
665+
Each [=base container=] is then sized and positioned
666+
to contain exactly all of its [=ruby bases=]’ margin boxes
667+
as well as the margin boxes of [=ruby bases=] and [=ruby annotations=]
668+
of any descendant [=ruby containers=]
669+
also participating in this [=inline formatting context=].
670+
(If a [=base container=] has no [=in-flow=] content,
662671
it is sized and positioned
663-
as if it contained a single empty [=ruby base=].
664-
665-
[=Ruby annotations=] associated with the [=base level=]
666-
are then positioned with respect to their [=ruby base boxes=]
667-
according to the applicable 'ruby-position' values.
668-
[=Ruby annotations=] within a level (within a single [=ruby container=])
669-
are aligned to each other as if they were inline boxes
670-
participating in the same inline formatting context.
671-
Each [=ruby annotation container=] is sized and positioned
672-
to contain exactly all of its [=ruby annotations=]’ margin boxes.
673-
If a [=ruby annotation container=] has no [=in-flow=] content,
672+
as if it contained a single empty [=ruby base=].)
673+
674+
[=Ruby annotations=] within a level
675+
are aligned to each other in the block axis
676+
as if they were [=inline boxes=]
677+
participating in the same [=inline formatting context=],
678+
effectively establishing a [=line box=]
679+
for that [=level=] of annotation in the [=ruby container=].
680+
In the inline axis, [=ruby annotations=] are aligned
681+
with respect to their [=ruby base boxes=]
682+
in accordance with their [=annotation container=]’s 'ruby-merge' value.
683+
684+
Each [=annotation container=] is then sized and positioned
685+
to contain exactly all of its [=ruby annotations=]’ margin boxes
686+
as well as the margin boxes of [=ruby bases=] and [=ruby annotations=]
687+
of any descendant [=ruby containers=]
688+
also participating in this [=annotation level=]’s [=inline formatting context=].
689+
(If an [=annotation container=] has no [=in-flow=] content,
674690
it is sized and positioned
675-
as if it contained a single empty [=ruby annotation=].
676-
677-
[=Ruby annotation containers=] are stacked outward
678-
over or under (depending on 'ruby-position') their corresponding [=ruby base container=],
679-
without any intervening space.
691+
as if it contained a single empty [=ruby annotation=].)
692+
[=Annotation containers=] are then stacked outward
693+
over or under (depending on 'ruby-position') their corresponding [=base container=],
694+
without any intervening space,
695+
thus determining the block-axis positioning of the [=ruby annotations=]
696+
with respect to their [=ruby bases=].
680697

681698
Issue: Should block-axis margins collapse?
682699
This makes layout more robust,
683700
but is inconsistent with how inlines behave along the inline-axis.
684701

685-
A ruby container (or fragment thereof)
702+
A [=ruby container=] (or fragment thereof)
686703
measures as wide as the content of its widest level.
687704
Similarly, [=ruby base boxes=] and [=ruby annotation boxes=]
688705
within a ruby “column” have the measure of the widest content in that “column”.
@@ -698,6 +715,10 @@ Ruby Layout</h2>
698715
Issue: Should the ruby bases and annotations size to the column,
699716
or size to the content?
700717

718+
As in other CSS layout models,
719+
relative positioning, transforms, and other graphical effects
720+
apply after this layout of the boxes.
721+
701722
<h3 id="inter-character-layout">
702723
Inter-character Ruby Layout</h3>
703724

@@ -719,20 +740,31 @@ Inter-character Ruby Layout</h3>
719740
<h3 id="box-style">
720741
Styling Ruby Boxes</h3>
721742

722-
The 'margin', 'border', and 'padding' properties
723-
do not apply to [=ruby base container boxes=]
724-
nor to [=ruby annotation container boxes=].
725-
726-
Issue: Should they also not apply to
727-
<a href="#nested-pairing">ruby-internal ruby container boxes</a>?
728-
If they do, what does that mean?
729-
730-
Additionally,
731-
the UA is not required to support
743+
[=Ruby bases=] and [=ruby containers=] are treated as [=inline boxes=],
744+
and all properties that apply to [=inline boxes=],
745+
unless otherwise specified,
746+
also apply to them in the same way.
747+
However, the [=line-relative shift values=] of 'vertical-align'
748+
(''vertical-align/top'', ''vertical-align/bottom'')
749+
must be ignored (treated as zero).
750+
751+
All properties that apply to [=inline boxes=],
752+
unless otherwise specified,
753+
also apply to [=ruby annotations=] in the same way,
754+
except 'line-height', which does not apply.
755+
Also, the [=line-relative shift values=] of 'vertical-align'
756+
(''vertical-align/top'', ''vertical-align/bottom'')
757+
must be ignored (treated as zero).
758+
759+
Neither the [=margin=], [=padding=], [=border=] properties
760+
nor the any properties that do not apply to [=inline boxes=]
761+
apply to [=base containers=] or [=annotation containers=].
762+
Additionally, 'line-height' does not apply to [=annotation containers=].
763+
764+
The UA is not required to support
732765
any of the background properties or outline properties,
733766
or any other property that illustrates the bounds of the box
734-
on [=ruby base container boxes=], [=ruby annotation container boxes=],
735-
or <a href="#nested-pairing">ruby-internal ruby container boxes</a>.
767+
on [=ruby base container boxes=] or [=ruby annotation container boxes=].
736768
The UA may implement these boxes simply as abstractions for inheritance
737769
and control over the layout of their contents.
738770

0 commit comments

Comments
 (0)