W3C home > Mailing lists > Public > public-i18n-core@w3.org > July to September 2006

RE: bidi-override scope in CSS2 and CSS 2.1

From: Paul Nelson (ATC) <paulnel@winse.microsoft.com>
Date: Mon, 18 Sep 2006 14:30:13 -0700
Message-ID: <49C257E2C13F584790B2E302E021B6F91130026A@winse-msg-01.segroup.winse.corp.microsoft.com>
To: Richard Ishida <ishida@w3.org>, Martin Duerst <duerst@it.aoyama.ac.jp>, Bert Bos <bert@w3.org>, Steven Pemberton <steven.pemberton@cwi.nl>
CC: <www-style@w3.org>, <public-i18n-core@w3.org>, Masayasu Ishikawa <mimasa@w3.org>, <public-i18n-core@w3.org>

Actually, because 'unicode-bidi' is not inherited, the output would be
right aligned as below:

                                   txet enilni emoS
               enil rehtona no txet enilne erom dna
                                A paragraph of text
                              txet enilni erom emoS 


I would assume that the contents of the block level element could be
marked up as Richard indicated. The <bdo> is defined as an in-line
element. However, the intent with CSS should be to effect the content of
any element.

What will XHTML2 do if CSS is not present? In HTML we recommend that
people use dir and <bdo> instead of stylesheet in case the stylesheet is
not applied when bidi markup is important. 





-----Original Message-----
From: Richard Ishida [mailto:ishida@w3.org] 
Sent: Tuesday, September 19, 2006 12:11 AM
To: Paul Nelson (ATC); 'Martin Duerst'; 'Bert Bos'; 'Steven Pemberton'
Cc: www-style@w3.org; public-i18n-core@w3.org; 'Masayasu Ishikawa';
public-i18n-core@w3.org
Subject: RE: bidi-override scope in CSS2 and CSS 2.1

I'm unclear about the expected behaviour for bidi overrides set in CSS
and XHTML 2. And would like to get some clarifications. Some of these
questions relate more specifically to XHTML2, others to CSS.

Suppose we have the following code in and 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).




[Question2 (XHTML2)]
If XHTML2 does require the presence of the CSS, 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."

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

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

This seems to be at odds.  Am I correct?




[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?




[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?




[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.




[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?


Cheers,
RI




PS: I put together a short test page {4} that takes the code above and
does three things:
[a] applies unicode-bidi: bidi-override; direction: rtl; using a class
attribute to the div [b] remove the class attribute and add &#x202E;
(RLO) immediately after the opening tag and PDF immediately before the
closing tag [c] same as [b] but with all markup inside the div removed

The results are as follows: 
[a] IE, Firefox and Opera behave as per CSS2 - ie. inline text is
reordered, but text in the block is not.
[b] Firefox and Opera do the same as in [a], but IE (including IE6 and
IE7
CR1) do not reorder the line of inline text after the paragraph [c] IE,
Firefox and Opera reorder all the text and display without line breaks


{1}
http://www.w3.org/TR/2005/WD-xhtml2-20050527/mod-bidi.html#adef_bidi_dir
{2}
http://www.w3.org/TR/1998/REC-CSS2-19980512/visuren.html#propdef-unicode
-bid
i
{3} http://www.w3.org/TR/CSS21/visuren.html#propdef-unicode-bidi
{4} http://www.w3.org/International/tests/test-rlo-blocks.html

============
Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)

http://www.w3.org/People/Ishida/
http://www.w3.org/International/
http://people.w3.org/rishida/blog/
http://www.flickr.com/photos/ishida/
 
Received on Monday, 18 September 2006 21:30:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 October 2008 10:18:51 GMT