RE: :first-letter and bidi reordering interaction

> [Original Message]
> From: Boris Zbarsky <bzbarsky@MIT.EDU>
>
> An interesting question that came up [1] was what should happen in the 
> following situation:
>
> Stylesheet:
>    p { color: red; direction: ltr }
>    p:first-letter { color: green }
>
> DOM:
>    <p>"YERUSHALAYIM" is the Hebrew word for "Jerusalem."</p>
>
> (where YERUSHALAYIM is actually in Hebrew).
>
> In this case, after bidi reordering we have:
>
> Boxes:
>    <p>"MIYALAHSUREY" is the Hebrew word for "Jerusalem."</p>
>
> where the quote that comes next to the "M" is the one that came next to 
> the "Y" in the DOM.
>
> So in this case, what should be green, exactly?  And why?  In the 
> absence of bidi reordering the initial '"' and the 'Y' would be green, 
> but in this case that seems a little bizarre.... though implied by a 
> literal interpretation of the fictional tag sequence language in the spec.

You've given an extremely pathological case here thanks to
the direction:ltr.  Without the ltr, then by the bidi rules this would
be a rtl paragraph with a lot of ltr text embedded in it, so it would
make sense for the initial quote and the Y, which would be at the
right edge of the paragraph to receive the green color imparted
by :first-letter.

But back to case with the LTR embedding.  If the starting RTL
portion uses up more than a line, then trying to make the left
most RTL character have different properties such as size
could require considerable trial and error, which I think we want
CSS to avoid.  I think that the simplest thing to do would be
to treat a case where the initial letter has a direction opposite
from that of the paragraph the same as if the initial letter
were the first letter of a table-cell or inline-block.  That is,
the :first-letter pseudo element wouldn't apply.  That isn't
what the spec says, but that does make sense.  Whether or
not the initial quote should be green is another question.
What happens with <p>"<br>Text</p> ?  Does the quote
receive the first letter treatment or not?

Received on Monday, 19 April 2004 17:39:50 UTC