W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [css-ruby] Leading/trailing whitespace rules are weird

From: fantasai <fantasai.lists@inkedblade.net>
Date: Sat, 07 Feb 2015 13:09:38 -0500
Message-ID: <54D654E2.3010009@inkedblade.net>
To: Boris Zbarsky <bzbarsky@MIT.EDU>, www-style list <www-style@w3.org>
On 07/31/2014 12:05 PM, Boris Zbarsky wrote:
> Consider these three testcases:
>
> 1)  abcd<span style="ruby-base-container"> BASE</span>
>          <span style="ruby-text">TEXT</text>
>
> 2)  abcd<span style="ruby-base-container"> <span>BASE</span></span>
>          <span style="ruby-text">TEXT</text>
>
> 3)  abcd<span style="ruby-base-container"><span> BASE</span></span>
>          <span style="ruby-text">TEXT</text>
>
> Per the current spec text in http://dev.w3.org/csswg/css-ruby/#anony-gen-trim-space
> the behavior of testcase #3 is clear, I believe: it renders like so:
>
>                 TEXT
>            abcd BASE
>
> with a space between "abcd" and "BASE".
>
> Per the same spec text, the behavior of #2 is also clear, and renders like so:
>
>                TEXT
>            abcdBASE
>
> without a space between "abcd" and "BASE".
>
> The behavior of #1 is not obvious to me from the spec, but a literal reading
> would suggest it should render like #2, since the spec talks about "white
> space", not "inline boxes contatining only white space".
>
> Is this actually the desired behavior?  Naively, I would have expected all
> three of these cases to render like case #3, based on the general principle
> that ruby should act like inlines do as much as possible.

Sorry, took me awhile to get a clear idea of what to do about this.
I think you're right, and I've updated the spec as follows:

   1. Moved the leading/trailing trimming rule after the misparented-wrapping rule.
   2. Reworded it to:

        Any <i>intra-ruby white space</i>
        that is not the sole child of its parent
        and occurs at the beginning or end of
        a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i>
        is removed, as if it had ''display: none''.

Let me know if that makes sense. I think this should also fix sbowen's issue:

Susanna Bowen wrote:
> Here's another unclear case:
>
> <ruby><rbc></rbc><rtc></rtc>       <rbc></rbc></ruby>
>
> The spec says the whitespace there is inter-segment whitespace, and is
> "effectively a ruby segment of its own." This would suggest treating
> the above case like:
>
> <ruby><rbc></rbc><rtc></rtc><rbc>       </rbc><rbc></rbc></ruby>
>
> (with assumed rtc's for each segment) would be all right. However, once
> the white space gets wrapped in an rbc, it becomes both leading and
> trailing white space, and is deleted as of step 3 in anonymous ruby box
> generation. So the inter-segment white space just becomes a completely
> empty segment (instead of a segment containing white space). This
> doesn't seem right. Is this what the spec intended?


Thanks~
~fantasai
Received on Saturday, 7 February 2015 19:11:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC