Closed Bug 503957 Opened 15 years ago Closed 15 years ago

RTL mixing hebrew & ascii characters + display:inline = weird layout

Categories

(Core :: Layout, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jbalogh, Assigned: smontagu)

Details

Attachments

(3 files)

The attached page shows 4 list items; one with mixed Hebrew and ascii characters, the rest all ascii (we get this sort of thing on AMO).  The three all-ascii items are displayed *inside* of the mixed item.

Webkit does the same thing, but it still seems like a bug to me.
Attached file Possible workaround
For "display: inline" this is the expected result. To avoid the issue, you can use "unicode-bidi: embed" as in this example.
Awesome, thanks Simon!
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Note that http://www.w3.org/TR/CSS21/visuren.html#propdef-unicode-bidi says:

Because the Unicode algorithm has a limit of 61 levels of embedding, care should be taken not to use 'unicode-bidi' with a value other than 'normal' unless appropriate. In particular, a value of 'inherit' should be used with extreme caution. However, for elements that are, in general, intended to be displayed as blocks, a setting of 'unicode-bidi: embed' is preferred to keep the element together in case display is changed to inline (see example below).
David, are you suggesting that we should add "unicode-bidi: embed" to elements with "display: block" in html.css?
Probably not, although possibly.  I can imagine authors doing things that lead to lots of nesting, though.
I'm not so sure this is invalid after all: see http://www.w3.org/TR/REC-html40/struct/dirlang.html#style-bidi:

"When a block element that does not have a dir attribute is transformed to the style of an inline element by a style sheet, the resulting presentation should be equivalent, in terms of bidirectional formatting, to the formatting obtained by explicitly adding a dir attribute (assigned the inherited value) to the transformed element."
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
So I tried to solve this by forcing unicode-bidi: embed in the bidi resolution code, but I wasn't convinced. The first problem with that approach is that it would be impossible to override in a style sheet. Secondly, I didn't succeed in finding a sane way to identify elements that have display: block by default, other than a hard-coded list (ewww) or adding an IsNodeOfType bit in nsINode.h, which seems like overkill.

So, assuming that we want to fix this at all (and AFAICT no other user agent conforms to the standard that I quoted in the previous comment), I don't see any way other than adding an html.css rule.
Attached patch html.css patchSplinter Review
Assignee: nobody → smontagu
Status: REOPENED → ASSIGNED
Attachment #393492 - Flags: review?(dbaron)
Comment on attachment 393492 [details] [diff] [review]
html.css patch

Looks good, except I'd suggest adding the following tags to the list:
  body
  html
  isindex
  listing
  map
  marquee
  plaintext
  xmp
(marquee is inline-block)
  
And I think you can remove:
  col
  colgroup
  hr
since they can't contain anything.
Attachment #393492 - Flags: review?(dbaron) → review+
This seems like the right approach to me.
http://hg.mozilla.org/mozilla-central/rev/2dd800a87d5a
Status: ASSIGNED → RESOLVED
Closed: 15 years ago15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: