Re: FW: bidi-override scope in CSS2 and CSS 2.1

(Adding HTML WG; Original mail at  
http://lists.w3.org/Archives/Public/www-style/2006Oct/0109.html)

Answering the bits I can:

On Mon, 16 Oct 2006 20:05:42 +0200, Richard Ishida <ishida@w3.org> wrote:
> Suppose we have the following code in an XML application such as XHTML2:
>
> <div dir="rlo">Some inline text
> and more inline text on another line
> <p>A paragraph of text</p>
> Some more <em>inline</em> text
> </div>
>
> and the following CSS style in the same document:
> *[dir="lro"] { unicode-bidi: bidi-override; direction: ltr}
> *[dir="rlo"] { unicode-bidi: bidi-override; direction: rtl}

> [Question 1 (XHTML2)]
> Do we need the CSS declarations to effect the expected presentation in
> XTHML2?
>
> I thought we would, but the XHTML2 spec {1} says "The effect of this
> attribute is defined by the CSS2 rule:", which makes me think that an
> implementation must provide this behaviour whether or not the CSS rules  
> are explicitly stated (as is the case for HTML4.01).

Yes, it's the same as for HTML4.01: if XHTML2 is natively supported then  
the default stylesheet would provide this. In current browsers you have to  
supply the stylesheet yourself.

> [Question2 (XHTML2)]
> If XHTML2 does require the presence of the CSS,

(It doesn't *require* it, but the default presentation is defined in terms  
of it. The aim is that all presentation be done according to the CSS model  
where possible.)

> there seems to be an
> inconsistency in terms of the inheritance of the override behaviour.
>
> In section 15.1.1 of XHTML2 it says "When the dir attribute is set for a
> block-level element, it remains in effect for the duration of the element
> and any nested block-level elements."

(This text is taken word-for-word from HTML4 by the way)

> On the other hand, the CSS2 specification {2} says that "If the element  
> is inline-level or a block-level element that contains only inline-level
> elements, this creates an override."
>
> This leads me to conclude that for the code mentioned above I'd expect to
> see the following display according to the XHTML2 spec:
>
> txet enilni emoS
> enil rehtona no txet enilne erom dna
> txet fo hpargarap A
> txet enilni erom emoS

(Why do you expect a line break to the second line?)

> and the following according to the CSS2 spec:
>
> Some inline text
> and more inline text on another line
> A paragraph of text
> Some more inline text

(Again the line break)
Ah I see, this is because the element doesn't only contain inline-level  
elements, and so the div shouldn't produce an override. It looks like this  
is in contradiction with the express CSS aim of incremental rendering,  
because you couldn't display any element with a bidi-override until the  
last child element had been processed.

> This seems to be at odds.  Am I correct?
Although my brain is hurting at this moment, it looks like you are.

> [Question 3 (CSS)]
> Whereas the CSS2 spec {2} says "If the element is inline-level or a
> block-level element that contains only inline-level elements, this  
> creates
> an override.", the CSS2.1 spec {3} says "For block-level, table-cell,
> table-caption, or inline-block elements this creates an override for
> inline-level descendents not within another block-level, table-cell,
> table-caption, or inline-block element."
>
> I take this to mean that with CSS2 the result for the code at the top of  
> the page would be:
>
> Some inline text
> and more inline text on another line
> A paragraph of text
> Some more inline text
>
> whereas with CSS 2.1 the result would be:
>
> txet enilni emoS
> enil rehtona no txet enilne erom dna
> A paragraph of text
> txet enilni erom emoS
>
> Is this correct?

Looks like it. My question is whether the nested block generates a new  
embedding in Unicode bidi terms, or whether the override embedding is  
popped at the start of the nested block and re-pushed at its end (since  
the Unicode bidi algorithm only allows 15 nestings it could matter). It  
also looks like if CSS can't support the HTML and XHTML text about dir  
applying to the whole element, we might have to change it for when dir has  
one of the two override values.

> [Question 4 (XHTML]
> If XHTML does in fact rely on CSS declarations to cause the appropriate
> display of overridden text, then how does it square the fact that the
> behaviour will change, depending on whether people use CSS2 or CSS2.1
> enabled implementations?

Ugh. I'm willing to bet that no CSS2 implementation has implemented the  
spec for this, and so the question is moot.

> [Question 5 (CSS)]
> Both CSS2 and CSS2.1 say "The final order of characters in each  
> block-level
> element is the same as if the bidi control codes had been added as  
> described
> above, markup had been stripped, and the resulting character sequence had
> been passed to an implementation of the Unicode bidirectional algorithm  
> for plain text that produced the same line-breaks as the styled text."
>
> I'm not entirely sure what the expected output of that would be, but I  
> don't
> think it would be the same as any of the above results. So I think the  
> CSS spec may contradict itself here.

And I'm not sure there is enough wording to support how nested blocks in  
override work.

> [Question 6 (CSS)]
> I put a small test page {4} together and noticed that when I apply the  
> the
> CSS rules to essentially the same code above, using a class attribute in
> XHTML 1.0, the block is automatically right-aligned in Firefox and IE.  I
> don't think this is appropriate behaviour.  As far as I'm aware, there  
> is no
> indication in CSS2, CSS2.1 or HTML 4.01 specs about default text  
> alignment
> for block elements to which directionality is assigned.  I suspect that  
> this
> may show that there's a need for such rules.

> [Question 7]
> After all this, my assumption as a user would be that if I apply the
> override CSS properties to a block level element, all of the contents of
> that block element would be ordered as indicated, not just the inline  
> text,
> despite the fact that <bdo> was an inline element in HTML.  Do people  
> agree with that?

I agree that this would be my expectation. (I have never understood why  
the override stops with nested blocks, and assumed it was because someone  
like Richard Ishida had said it must :-) )

Steven

Received on Tuesday, 17 October 2006 09:50:17 UTC