Bug 70373 - Putting a dir attribute on a bdi element makes it lose isolation
Summary: Putting a dir attribute on a bdi element makes it lose isolation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 63903
Blocks: 50910
  Show dependency treegraph
 
Reported: 2011-10-18 15:46 PDT by Aharon (Vladimir) Lanin
Modified: 2011-11-28 11:22 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aharon (Vladimir) Lanin 2011-10-18 15:46:20 PDT
This is true whether you say dir=ltr, dir=rtl, or even dir=auto (even though dir=auto is in fact supposed to imply isolation on any element - see https://bugs.webkit.org/show_bug.cgi?id=63903). Please note that <bdi dir="ltr|rtl"> is very useful - IMO, it should replace <span dir="ltr|rtl"> as the usual way of indicating an inline direction change: isolation extremely rarely hurts, and is often quite necessary. This is bad enough, but given that <bdi> currently does not have dir=auto by default (https://bugs.webkit.org/show_bug.cgi?id=68773), <bdi> is currently completely broken.

The bug is due to the current default stylesheet, which says that specifying a dir attribute sets unicode-bidi to embed. This is incorrect in HTML5, i.e. http://dev.w3.org/html5/spec/Overview.html#bidirectional-text, which says that the default stylesheet should go like this:

:dir(ltr) { direction: ltr; }
:dir(rtl) { direction: rtl; }
[dir] { unicode-bidi: embed; }
bdi, bdi[dir], output, output[dir], [dir=auto i] { unicode-bidi: isolate; }
bdo, bdo[dir] { unicode-bidi: bidi-override; }
bdo[dir=auto i] { unicode-bidi: bidi-override isolate; }
textarea[dir=auto i], pre[dir=auto i] { unicode-bidi: plaintext; }

Implementing this trivial fix would also fix https://bugs.webkit.org/show_bug.cgi?id=63903.
Comment 1 Aharon (Vladimir) Lanin 2011-10-25 06:29:38 PDT
It would have been better if I had left out the first two lines I quoted from the HTML5 spec re the default stylesheet. They set direction, and not unicode-bidi, and are irrelevant to the bug. Furthermore, they make use of the :dir() pseudo-class, which has not been implemented yet (as far as I know); I am guessing that the direction property currently gets set by means other than the default stylesheet. In any case, the relevant lines from the HTML5 spec are:

[dir] { unicode-bidi: embed; }
bdi, bdi[dir], output, output[dir], [dir=auto i] { unicode-bidi: isolate; }
bdo, bdo[dir] { unicode-bidi: bidi-override; }
bdo[dir=auto i] { unicode-bidi: bidi-override isolate; }
textarea[dir=auto i], pre[dir=auto i] { unicode-bidi: plaintext; }

I expect that some of these, e.g. the last one, are already in the default stylesheet. The rest need to go in, and the order is important.
Comment 2 Ryosuke Niwa 2011-11-28 11:21:57 PST
Fixed in http://trac.webkit.org/changeset/101268.