Thank you for your lengthy and insightful comments! I may be slow in
responding, but I greatly appreciate your clear thinking and clear
> In a nutshell, the current definition of unicode-bidi:plaintext in
> http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi > is unclear about how unicode-bidi:plaintext is supposed to behave
> when it is in effect on an inline element. Please note that originally,
> e.g. in
> the definition said that "this value has no effect on inline elements".
> And later, in
> it said that "for inline elements, this value is equivalent to ‘isolate’".
> This put them in a separate bidi paragraph, but did *not* determine
> this paragraph's base directionality. The current definition, however,
> says the following:
> # For the purposes of the Unicode bidirectional algorithm, the base
> # directionality of each bidi paragraph for which the element forms
> # the containing block is determined not by the element's computed
> # ‘direction’ as usual, but by following the heuristic in rules P2
> # and P3 of the Unicode bidirectional algorithm. For inline elements,
> # this value behaves as for ‘isolate’, except, as with block containers,
> # **the base directionality is determined by following the Unicode
> # heuristic instead of by using the ‘direction’ value.
> This gives no clue to the following question: for which paragraphs,
> exactly, does a unicode-bidi:plaintext element that is not a containing
> block for anything determine the base directionality?
> Given that the definition says that such elements are to behave as for
> unicode-bidi:isolate, we do at least know that paragraphs never straddle
> the boundary of a unicode-bidi:plaintext element. So, should the unicode
>-bidi:plaintext on an element set the base directionality of *all*
> paragraphs contained by the element? Should it apply to:
> - Both paragraphs in
> <span "style=unicode-bidi:plaintext">Line 1.<br/>שורה 2.</span>?
> - All three paragraphs in
> <span "style=unicode-bidi: plaintext">Line 1.
> <span style="display:block">שורה 2.</span>שורה 3.</span>?
> - Both paragraphs in
> <span "style=unicode-bidi: plaintext">He said
> '<span style="unicode-bidi:isolate">שלום!</span>'.</span>?
My answers would be,
- for lines 1 and 3 only
- for the outer paragraph only
> If so, however, the unicode-bidi:plaintext heuristic also should not apply
> to the paragraph in the inside span in [the second example].
> That is, "שורה 2!" should be displayed LTR by inheritance from the div,
> not RTL by the unicode-bidi:plaintext on the outside span, even though
> the outside span contains it.
> To reflect this, I propose that the definition of unicode-bidi:plaintext
> be modified as follows:
> | plaintext
> | This value behaves as for ‘isolate’, except that for the purposes of
> | the Unicode bidirectional algorithm, the base directionality of each
> | bidi paragraph /immediately contained/ by the element is determined
> | not by the element's computed ‘direction’ as usual, but by following
> | the heuristic in rules P2 and P3 of the Unicode bidirectional algorithm.
> | /A paragraph is immediately contained by an element if it is contained
> | by it, but is not contained by a descendant element that puts its
> | content into a separate bidi paragraph (or paragraphs)/, e.g. an element
> | with display:block, position:absolute, unicode-bidi:isolate,
> | unicode-bidi:plaintext, and so on.
> Please note that this gets rid of the reliance on containing blocks,
> replacing it instead with the notion of the "immediately containing"
> element for a given bidi paragraph. It then makes no difference whether
> the element is inline or a block. [Note about this better matching
> Firefox and Webkits behavior wrt embedded blocks.]
I've tweaked the definition of "immediately contained" a bit to try to
make it clearer, but otherwise accepted your edits:
# This value behaves as ''isolate'' except that for the purposes of
# the Unicode bidirectional algorithm, the base directionality of each
# bidi paragraph immediately contained by the element is determined not
# by the element's computed 'direction' as usual, but by following the
# heuristic in rules P2 and P3 of the Unicode bidirectional algorithm.
# An element immediately contains a bidi paragraph if it is a block
# container or bidi-isolating inline and no other such elements intervene
# between it and the bidi paragraph.
Alternatively, the last three lines could be
# A bidi paragraph is immediately contained by an element if the element
# is a block container or bidi-isolating inline and no other such elements
# intervene between it and the bidi paragraph.
> Now, let's go on to alignment. [...] There are a couple of issues here.
> - What exactly does "In the case of ‘unicode-bidi: plaintext’" mean? I
> think it means the case where the element whose text-align (or text-align-last)
> we are trying to apply also has unicode-bidi:plaintext.
Yes, that is indeed what's meant.
> - The definition assumes that a "paragraph" can contain several line boxes,
> but not the other way around. This is not true. Take, for example, [...]
> I propose that just as an element's unicode-bidi:plaintext only affects the
> directionality of paragraphs that the element immediately contains, so too
> it is *only these* paragraphs' directionality that should affect the alignment
> of the line boxes in the element when the element is a containing block.
> That is, let's note that if two distinct paragraphs are immediately contained
> by the same element, they can not share a line box. (If they did, they would
> have to be a single paragraph.) Thus, each line box in a containing block
> belongs to exactly one of the block's immediately contained paragraphs.
> Now, the amended definition for alignment:
> | The start and end edges of a line box are relative to a direction
> | determined as follows. If a line box's containing block has
> | unicode-bidi:plaintext, use the base directionality of the containing
> | block's immediately contained paragraph to which the line box belongs.
> | Otherwise, use the containing block's computed direction.
So, how about this:
| The start and end edges of a line box are determined by the inline base
| direction of the "bidi paragraph" to which it belongs. In most cases,
| this means using the containing block's computed 'direction'. However if
| containing block has ''unicode-bidi: plaintext'' [[!CSS3-WRITING-MODES]],
| the inline base direction of its line boxes will be determined by the bidi
| paragraphs it contains.
(I want to put the most common case up first, which I think helps make the
> Please note that this means that unicode-bidi:plaintext does not affect
> alignment except when applied to an element that is a containing block.
Good, I think this should be the intent. :)
> [lots of examples]
> And finally, let's take an example like the one in the current spec.
> As you will see, my expectations differ from those currently stated
> in the spec:
Fixed the incorrect example. I should probably add some more of yours, too. :)