Skip to content

Commit 09d3c1c

Browse files
committed
Bidi fixes, r=aharon
1 parent 0532714 commit 09d3c1c

2 files changed

Lines changed: 184 additions & 118 deletions

File tree

css3-writing-modes/Overview.html

Lines changed: 121 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232

3333
<h1>CSS Writing Modes Module Level 3</h1>
3434

35-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 31 July 2012</h2>
35+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 2 August 2012</h2>
3636

3737
<dl>
3838
<dt>This version:
3939

4040
<dd><a
4141
href="http://dev.w3.org/csswg/css3-writing-modes/">http://dev.w3.org/csswg/css3-writing-modes/</a>
4242
<!--
43-
<dd><a href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20120731/">http://www.w3.org/TR/2012/ED-css3-writing-modes-20120731/</a>
43+
<dd><a href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20120802/">http://www.w3.org/TR/2012/ED-css3-writing-modes-20120802/</a>
4444
-->
4545

4646

@@ -545,9 +545,9 @@ <h2 id=text-direction><span class=secno>2. </span><a name=bidi> Inline
545545
<p>Two CSS properties, ‘<a href="#direction0"><code
546546
class=property>direction</code></a>’ and ‘<a
547547
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’,
548-
provide explicit embedding and override controls in the CSS layer. Because
549-
the base directionality of a text depends on the structure and semantics
550-
of the document, the ‘<a href="#direction0"><code
548+
provide explicit embedding, isolation, and override controls in the CSS
549+
layer. Because the base directionality of a text depends on the structure
550+
and semantics of the document, the ‘<a href="#direction0"><code
551551
class=property>direction</code></a>’ and ‘<a
552552
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>
553553
properties should in most cases be used only to map bidi information in
@@ -558,23 +558,18 @@ <h2 id=text-direction><span class=secno>2. </span><a name=bidi> Inline
558558

559559
<p>In general, the paragraph embedding level is set according to the ‘<a
560560
href="#direction0"><code class=property>direction</code></a>’ property
561-
of the element <i>immediately containing</i> the paragraph rather than by
562-
the heuristic given in steps P2 and P3 of the Unicode algorithm. <a
563-
href="#UAX9" rel=biblioentry>[UAX9]<!--{{!UAX9}}--></a> When the computed
564-
<a href="#unicode-bidi0"><code
565-
class=property>unicode-bidi</code></a>’ of the element <i>immediately
566-
containing</i> the paragraph is ‘<a href="#plaintext"><code
567-
class=css>plaintext</code></a>’, however, the Unicode heuristics are
568-
used instead. An element <dfn id=bidi-contains>immediately contains</dfn>
569-
a bidi paragraph if the element itself, but none of its descendants, both
570-
contains the entire bidi paragraph and is a block container or <a
571-
href="#bidi-isolate"><i>bidi-isolating</i></a> inline.
561+
of the paragraph's containing block rather than by the heuristic given in
562+
steps P2 and P3 of the Unicode algorithm. <a href="#UAX9"
563+
rel=biblioentry>[UAX9]<!--{{!UAX9}}--></a> When the computed ‘<a
564+
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’ of
565+
the paragraph's containing block is ‘<a href="#plaintext"><code
566+
class=css>plaintext</code></a>’, however, the Unicode heuristics (rules
567+
P2 and P3) are used instead.
572568

573569
<p>The HTML specifications (<a href="#HTML401"
574570
rel=biblioentry>[HTML401]<!--{{HTML401}}--></a>, section 8.2, and <a
575571
href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>, section 10.3.5)
576-
define bidirectionality behavior for HTML elements. The HTML 4
577-
specification also contains more information on bidirectionality issues.
572+
define bidirectionality behavior for HTML elements.
578573

579574
<p class=note>Because HTML UAs can turn off CSS styling, we advise HTML
580575
authors to use the HTML ‘<code class=property>dir</code>’ attribute
@@ -629,11 +624,12 @@ <h3 id=direction><span class=secno>2.1. </span> Specifying Directionality:
629624
</table>
630625

631626
<p>This property specifies the inline base direction or directionality of
632-
any bidi paragraph, embedding, or override established by the element.
633-
(See ‘<a href="#unicode-bidi0"><code
634-
class=property>unicode-bidi</code></a>’) In addition, it informs the
635-
ordering of <a href="http://www.w3.org/TR/CSS21/tables.html">table</a>
636-
column layout, the direction of horizontal <a
627+
any bidi paragraph, embedding, isolate, or override established by the
628+
element. (See ‘<a href="#unicode-bidi0"><code
629+
class=property>unicode-bidi</code></a>’.) <!-- except plaintext --> In
630+
addition, it informs the ordering of <a
631+
href="http://www.w3.org/TR/CSS21/tables.html">table</a> column layout, the
632+
direction of horizontal <a
637633
href="http://www.w3.org/TR/CSS21/visufx.html#overflow">overflow</a>, and
638634
the default alignment of text within a line, and other layout effects that
639635
depend on the element's inline base direction.
@@ -729,9 +725,9 @@ <h3 id=unicode-bidi><span class=secno>2.2. </span> Embeddings and
729725
<p>Normally (i.e. when ‘<a href="#unicode-bidi0"><code
730726
class=property>unicode-bidi</code></a>’ is ‘<a href="#normal"><code
731727
class=css>normal</code></a>’) an inline element is transparent to the
732-
unicode bidi algorithm; content is ordered as if the element boundaries
733-
were not there. The<a href="#unicode-bidi0"><code
734-
class=property>unicode-bidi</code></a>’ property allows inline elements
728+
unicode bidi algorithm; content is ordered as if the element's boundaries
729+
were not there. Other values of the<a href="#unicode-bidi0"><code
730+
class=property>unicode-bidi</code></a>’ property cause inline elements
735731
to create scopes within the algorithm, and to override the intrinsic
736732
directionality of text.
737733

@@ -808,51 +804,74 @@ <h3 id=unicode-bidi><span class=secno>2.2. </span> Embeddings and
808804

809805
<dt><dfn id=embed>embed</dfn>
810806

811-
<dd>If the element is inline, this value opens an additional level of
812-
embedding with respect to the bidirectional algorithm. The direction of
813-
this embedding level is given by the ‘<a href="#direction0"><code
814-
class=property>direction</code></a>’ property. Inside the element,
815-
reordering is done implicitly. This corresponds to adding a LRE (U+202A),
816-
for ‘<code class=css>direction: ltr</code>’, or RLE (U+202B), for
817-
<code class=css>direction: rtl</code>’, at the start of the element
818-
and a PDF (U+202C) at the end of the element. <span class=note>This value
819-
has no effect on elements that are not inline.</span>
807+
<dd>If the element is inline, this value creates a <dfn
808+
id=directional-embedding>directional embedding</dfn> by opening an
809+
additional level of embedding with respect to the bidirectional
810+
algorithm. The direction of this embedding level is given by the ‘<a
811+
href="#direction0"><code class=property>direction</code></a>’ property.
812+
Inside the element, reordering is done implicitly. This corresponds to
813+
adding a LRE (U+202A), for ‘<code class=css>direction: ltr</code>’,
814+
or RLE (U+202B), for ‘<code class=css>direction: rtl</code>’, at the
815+
start of the element and a PDF (U+202C) at the end of the element. <span
816+
class=note>This value has no effect on elements that are not
817+
inline.</span>
820818

821819
<dt><dfn id=isolate>isolate</dfn>
822820

823821
<dd>On an inline element, this <dfn id=bidi-isolate
824822
title="bidi-isolate|bidi isolation|isolation">bidi-isolates</dfn> its
825-
contents: for the purpose of bidi resolution in its containing bidi
826-
paragraph (if any), the element is treated as if it were an Object
827-
Replacement Character (U+FFFC). (If the element is broken across multiple
828-
lines, then each box of the element is treated as an Object Replacement
829-
Character.) Within the element, its contents are considered, for the
830-
purposes of bidi resolution, to be inside a separate, independent
831-
document whose <a href="#paragraph"><i>bidi paragraphs</i></a> are
832-
assigned the base directionality specified by the element's ‘<a
833-
href="#direction0"><code class=property>direction</code></a>’ property.
823+
contents. This is similar to a directional embedding (and increases the
824+
embedding level accordingly) except that each sequence of inline-level
825+
boxes uninterrupted by any block boundary or <a
826+
href="#forced-paragraph-break"><i>forced paragraph break</i></a> is
827+
treated as an <dfn id=isolated-sequence->isolated sequence<dfn>:
828+
</dfn></dfn>
829+
<ul>
830+
<li>the content within the sequence is ordered as if inside an
831+
independent paragraph with the base directionality specified by the
832+
element's ‘<a href="#direction0"><code
833+
class=property>direction</code></a>’ property.
834+
835+
<li>for the purpose of bidi resolution in its containing bidi paragraph,
836+
the sequence is treated as if it were a single Object Replacement
837+
Character (U+FFFC).
838+
</ul>
839+
In effect, neither is the content inside the element bidi-affected by the
840+
content surrounding the element, nor is the content surrounding the
841+
element bidi-affected by the content or specified directionality of the
842+
element. However, <a href="#forced-paragraph-break"><i>forced paragraph
843+
breaks</i></a> within the element still create a corresponding break in
844+
the containing paragraph.
845+
<p class=note>In Unicode 7.0 and beyond, this will correspond to adding
846+
an LRI (U+2066), for ‘<code class=css>direction: ltr</code>’, or RLI
847+
(U+2067), for ‘<code class=css>direction: rtl</code>’, at the start
848+
of the element, and a PDI (U+2069) at the end of the element.
849+
850+
<p class=note>This value has no effect on elements that are not inline.
834851

835852
<dt><dfn id=bidi-override>bidi-override</dfn>
836853

837-
<dd>For inline elements this creates an <dfn id=override>override</dfn>.
838-
(For block-container elements this creates an <a
839-
href="#override"><i>override</i></a> for inline-level descendants not
840-
within another block container element.) This means that inside the
841-
element, reordering is strictly in sequence according to the ‘<a
842-
href="#direction0"><code class=property>direction</code></a>’ property;
843-
the implicit part of the bidirectional algorithm is ignored. This
844-
corresponds to adding a LRO (U+202D), for ‘<code class=css>direction:
845-
ltr</code>’, or RLO (U+202E), for ‘<code class=css>direction:
846-
rtl</code>’, at the start of the element and a PDF (U+202C) at the end
847-
of the element.
854+
<dd>This value puts the element's immediate content in a <dfn
855+
id=directional-override>directional override</dfn>. For an inline, this
856+
means that the element acts like a <a
857+
href="#directional-embedding"><i>directional embedding</i></a> in the
858+
bidirectional algorithm, except that reordering within it is strictly in
859+
sequence according to the ‘<a href="#direction0"><code
860+
class=property>direction</code></a>’ property; the implicit part of the
861+
bidirectional algorithm is ignored. This corresponds to adding a LRO
862+
(U+202D), for ‘<code class=css>direction: ltr</code>’, or RLO
863+
(U+202E), for ‘<code class=css>direction: rtl</code>’, at the start
864+
of the element and a PDF (U+202C) at the end of the element. If the
865+
element is a block container, the override is applied to an anonymous
866+
inline element that surrounds all of its content.
848867

849868
<dt><dfn id=isolate-override>isolate-override<dfn></dfn></dfn>
850869

851870
<dd>This combines the <a href="#bidi-isolate"><i>isolation</i></a>
852871
behavior of ‘<a href="#isolate"><code class=css>isolate</code></a>
853-
with the <a href="#override"><i>override</i></a> behavior of ‘<a
854-
href="#bidi-override"><code class=css>bidi-override</code></a>’: to
855-
surrounding content, it is equivalent to ‘<a href="#isolate"><code
872+
with the <i>override</i> behavior of ‘<a href="#bidi-override"><code
873+
class=css>bidi-override</code></a>’: to surrounding content, it is
874+
equivalent to ‘<a href="#isolate"><code
856875
class=css>isolate</code></a>’, but within the element content is
857876
ordered as if ‘<a href="#bidi-override"><code
858877
class=css>bidi-override</code></a>’ were specified.
@@ -863,11 +882,16 @@ <h3 id=unicode-bidi><span class=secno>2.2. </span> Embeddings and
863882
<p>This value behaves as ‘<a href="#isolate"><code
864883
class=css>isolate</code></a>’ except that for the purposes of the
865884
Unicode bidirectional algorithm, the base directionality of each of the
866-
element's <a href="#paragraph"><i>bidi paragraphs</i></a> is determined
867-
by following the heuristic in rules P2 and P3 of the Unicode
868-
bidirectional algorithm (rather than by using the ‘<a
869-
href="#direction0"><code class=property>direction</code></a>’ property
870-
of the element).
885+
element's <a href="#paragraph"><i>bidi paragraphs</i></a> (if a block
886+
container) or <a href="#isolated-sequence-"><i>isolated
887+
sequences</i></a> (if an inline) is determined by following the
888+
heuristic in rules P2 and P3 of the Unicode bidirectional algorithm
889+
(rather than by using the ‘<a href="#direction0"><code
890+
class=property>direction</code></a>’ property of the element).
891+
892+
<p class=note>In Unicode 7.0 and beyond, for inline elements this will
893+
correspond to adding an FSI (U+2068) at the start of the element, and a
894+
PDI (U+2069) at the end of the element.
871895
</dl>
872896

873897
<p class=note>Because the ‘<a href="#unicode-bidi0"><code
@@ -906,22 +930,38 @@ <h3 id=unicode-bidi><span class=secno>2.2. </span> Embeddings and
906930
<p>If an inline element is broken around a <a href="#paragraph"><i>bidi
907931
paragraph</i></a> boundary (e.g. if split by a block or <a
908932
href="#forced-paragraph-break"><i>forced paragraph break</i></a>), then
909-
the bidi control codes corresponding to the end of the element are added
910-
before the interruption and the codes corresponding to the start of the
911-
element are added after it. (In other words, any embedding levels or
912-
overrides started by the element are closed at the paragraph break and
913-
reopened on the other side of it.)
914-
915-
<p>Because the Unicode algorithm has a limit of 61 levels of embedding,
916-
care should be taken not to use ‘<a href="#unicode-bidi0"><code
917-
class=property>unicode-bidi</code></a>’ with a value other than ‘<a
918-
href="#normal"><code class=property>normal</code></a>’ unless
919-
appropriate. In particular, a value of ‘<code
920-
class=css>inherit</code>’ should be used with extreme caution. However,
921-
for elements that are, in general, intended to be displayed as blocks, a
922-
setting of ‘<code class=css>unicode-bidi: isolate</code>’ is preferred
923-
to keep the element together in case the ‘<code
924-
class=property>display</code>’ is changed to ‘<code
933+
the bidi control codes assigned to the end of the element are added before
934+
the interruption and the codes assigned to the start of the element are
935+
added after it. (In other words, any embedding levels or overrides started
936+
by the element are closed at the paragraph break and reopened on the other
937+
side of it.)
938+
939+
<div class=example>
940+
<p>For example, where &lt;BR/&gt; is a <a
941+
href="#forced-paragraph-break"><i>forced paragraph break</i></a> the bidi
942+
ordering is identical between
943+
944+
<pre>&lt;para>...&lt;i1>&lt;i2>...&lt;BR/>...&lt;/i2>&lt;i1>...&lt;/para></pre>
945+
946+
<p>and
947+
948+
<pre>&lt;para>...&lt;i1>&lt;i2>...&lt;/i2>&lt;i1>&lt;BR/>&lt;i1>&lt;i2>...&lt;/i2>&lt;i1>...&lt;/para></pre>
949+
950+
<p>for all values of ‘<a href="#unicode-bidi0"><code
951+
class=property>unicode-bidi</code></a>’ on inline elements &lt;i1&gt;
952+
and &lt;i2&gt;.
953+
</div>
954+
955+
<p class=note> Because the Unicode algorithm has a limit of 61 levels of
956+
embedding, care should be taken not to use ‘<a
957+
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’ with
958+
a value other than ‘<a href="#normal"><code
959+
class=property>normal</code></a>’ unless appropriate. In particular, a
960+
value of ‘<code class=css>inherit</code>’ should be used with extreme
961+
caution. However, for elements that are, in general, intended to be
962+
displayed as blocks, a setting of ‘<code class=css>unicode-bidi:
963+
isolate</code>’ is preferred to keep the element together in case the
964+
<code class=property>display</code>’ is changed to ‘<code
925965
class=css>inline</code>’ (see example below).
926966

927967
<h3 id=bidi-example><span class=secno>2.3. </span> Example of Bidirectional
@@ -4048,8 +4088,8 @@ <h2 class=no-num id=intrinsic-sizing>Appendix D: Intrinsic Dimensions</h2>
40484088

40494089
<p>For replaced elements, the <a href="#min-content"><i>min-content</i></a>
40504090
and <a href="#max-content"><i>max-content</i></a> sizes are equivalent and
4051-
correspond used size of the replaced element according to the<code
4052-
class=css>auto</code>’ width and height calculations.
4091+
correspond to the used size of the replaced element according to the
4092+
<code class=css>auto</code>’ width and height calculations.
40534093

40544094
<h3 class=no-num id=multicol-intrinsic> Intrinsic Sizes in Multi-column
40554095
Layout</h3>

0 commit comments

Comments
 (0)