HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2001[Gecko] Define 'directionality' in terms of the dir='' attribute for cases where the 'direction' property has no computed value. (credit: db)2008-08-05 09:16
@@ -5858,32 +5858,42 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
 
   <h5>The <dfn title="attr-dir"><code>dir</code></dfn> attribute</h5>
 
   <p>The <code title="attr-dir">dir</code> attribute specifies the
   element's text directionality. The attribute is an <span>enumerated
   attribute</span> with the keyword <code title="">ltr</code> mapping
   to the state <em>ltr</em>, and the keyword <code title="">rtl</code>
   mapping to the state <em>rtl</em>. The attribute has no
   defaults.</p>
 
-  <p>If the attribute has the state <em>ltr</em>, the element's
-  directionality is left-to-right. If the attribute has the state
-  <em>rtl</em>, the element's directionality is
-  right-to-left. Otherwise, the element's directionality is the same
-  as its parent element, or <em>ltr</em> if there is no parent
+  <p>The processing of this attribute is primarily performed by the
+  presentation layer. For example, CSS 2.1 defines a mapping from this
+  attribute to the CSS 'direction' and 'unicode-bidi' properties, and
+  defines rendering in terms of those properties.</p>
+
+  <p><dfn>The directionality</dfn> of an element, which is used in
+  particular by the <code>canvas</code> element's text rendering API,
+  is either 'ltr' or 'rtl'. If the user agent supports CSS and the
+  'direction' property on this element has a computed value of either
+  'ltr' or 'rtl', then that is <span>the directionality</span> of the
+  element. Otherwise, if the element is being rendered, then <span>the
+  directionality</span> of the element is the directionality used by
+  the presentation layer, potentially determined from the value of the
+  <code title="attr-dir">dir</code> attribute on the
+  element. Otherwise, if the element's <code
+  title="attr-dir">dir</code> attribute has the state <em>ltr</em>,
+  the element's directionality is 'ltr' (left-to-right); if the
+  attribute has the state <em>rtl</em>, the element's directionality
+  is 'rtl' (right-to-left); and oherwise, the element's directionality
+  is the same as its parent element, or 'ltr' if there is no parent
   element.</p>
 
-  <p>The processing of this attribute depends on the presentation
-  layer. For example, CSS 2.1 defines a mapping from this attribute to
-  the CSS 'direction' and 'unicode-bidi' properties, and defines
-  rendering in terms of those properties.</p><!-- XXXDIR -->
-
   <p>The <dfn title="dom-dir"><code>dir</code></dfn> DOM attribute on
   an element must <span>reflect</span> the <code
   title="attr-dir">dir</code> content attribute of that element,
   <span>limited to only known values</span>.</p>
 
   <p>The <dfn title="dom-document-dir"><code>dir</code></dfn> DOM
   attribute on <code>HTMLDocument</code> objects must
   <span>reflect</span> the <code title="attr-dir">dir</code> content
   attribute of <span>the <code>html</code> element</span>, if any,
   <span>limited to only known values</span>. If there is no such
@@ -19512,26 +19522,24 @@ notes on what would need to be defined for dashed lines:
    browsing context, as given by the <code
    title="dom-context-2d-font">font</code> attribute.</p></li>
 
    <li><p>Replace all the <span title="space character">space
    characters</span> in <var title="">text</var> with U+0020 SPACE
    characters.</p></li>
 
    <li><p>Form a hypothetical infinitely wide CSS line box containing
    a single inline box containing the text <var title="">text</var>,
    with all the properties at their initial values except the 'font'
-   property of the inline element set to <var title="">font</var> and
-   the 'direction' property of the inline element set to the
-   'direction' property of the <code>canvas</code> element. <a
-   href="#refsCSS">[CSS]</a></p></li><!-- XXXDIR somehow mention
-   somewhere that if you don't support CSS, dir="" still maps to
-   'direction' for the purposes of things like this. -->
+   property of the inline box set to <var title="">font</var> and the
+   'direction' property of the inline box set to <span>the
+   directionality</span> of the <code>canvas</code> element. <a
+   href="#refsCSS">[CSS]</a></p></li>
 
    <!-- if you insert a step here, make sure to adjust the next step's
    final words -->
 
    <li><p>If the <var title="">maxWidth</var> argument was specified
    and the hypothetical width of the inline box in the hypothetical
    line box is greater than <var title="">maxWidth</var> CSS pixels,
    then change <var title="">font</var> to have a more condensed font
    (if one is available or if a reasonably readable one can be
    synthesized by applying a horizontal scale factor to the font) or a
@@ -19547,46 +19555,42 @@ notes on what would need to be defined for dashed lines:
 
     <p>Horizontal position:</p>
 
     <dl>
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">left</code></dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">start</code> and the 'direction'<!--XXXDIR--> property
-     on the <code>canvas</code> element has a computed value of
-     'ltr'</dt>
+     title="">start</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'ltr'</dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">end</code> and the 'direction'<!--XXXDIR--> property
-     on the <code>canvas</code> element has a computed value of
-     'rtl'</dt>
+     title="">end</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'rtl'</dt>
 
      <dd>Let the <var title="">anchor point</var>'s horizontal
      position be the left edge of the inline box.</dd>
 
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">right</code></dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">end</code> and the 'direction'<!--XXXDIR--> property
-     on the <code>canvas</code> element has a computed value of
-     'ltr'</dt>
+     title="">end</code> and  <span>the directionality<//span> of the
+     <code>canvas</code> element is 'ltr'</dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">start</code> and the 'direction'<!--XXXDIR--> property
-     on the <code>canvas</code> element has a computed value of
-     'rtl'</dt>
+     title="">start</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'rtl'</dt>
 
      <dd>Let the <var title="">anchor point</var>'s horizontal
      position be the right edge of the inline box.</dd>
 
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">center</code></dt>
 
      <dd>Let the <var title="">anchor point</var>'s horizontal
@@ -19716,24 +19720,24 @@ been waiting now?)
    browsing context, as given by the <code
    title="dom-context-2d-font">font</code> attribute.</p></li>
 
    <li><p>Replace all the <span title="space character">space
    characters</span> in <var title="">text</var> with U+0020 SPACE
    characters.</p></li>
 
    <li><p>Form a <em class="big-issue">whatever CSS ends up calling
    vertical line boxes and inline boxes</em> containing the text <var
    title="">text</var>, with all the properties at their initial
-   values except the 'font' property of the inline element set to <var
+   values except the 'font' property of the inline box set to <var
    title="">font</var> and the 'direction' property of the inline
-   element set to the 'direction' property of the <code>canvas</code>
-   element.</p></li><!- - XXXDIR - ->
+   box set to <span>the directionality<//span> of the <code>canvas</code>
+   element.</p></li>
 
    <!- - if you insert a step here, make sure to adjust the next step's
    final words - ->
 
    <li><p>If the <var title="">maxHeight</var> argument was specified
    and the hypothetical height of the <em class="big-issue">box</em>
    in the hypothetical line box is greater than <var
    title="">maxHeight</var> CSS pixels, then change <var
    title="">font</var> to have a more condensed font (if one is
    available or if a reasonably readable one can be synthesized by
@@ -19748,46 +19752,42 @@ been waiting now?)
 
     <p>Vertical position:</p>
 
     <dl>
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">start</code></dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">left</code> and the 'direction'<!- -XXXDIR- -> property
-     on the <code>canvas</code> element has a computed value of
-     'ltr'</dt>
+     title="">left</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'ltr'</dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">right</code> and the 'direction'<!- -XXXDIR- -> property
-     on the <code>canvas</code> element has a computed value of
-     'rtl'</dt>
+     title="">right</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'rtl'</dt>
 
      <dd>Let the <var title="">anchor point</var>'s vertical
      position be the top edge of the <em class="big-issue">inline
      box</em>.</dd>
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">end</code></dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">right</code> and the 'direction'<!- -XXXDIR- -> property
-     on the <code>canvas</code> element has a computed value of
-     'ltr'</dt>
+     title="">right</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'ltr'</dt>
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
-     title="">left</code> and the 'direction'<!- -XXXDIR- -> property on
-     the <code>canvas</code> element has a computed value of
-     'rtl'</dt>
+     title="">left</code> and <span>the directionality<//span> of the
+     <code>canvas</code> element is 'rtl'</dt>
 
      <dd>Let the <var title="">anchor point</var>'s vertical
      position be the bottom edge of the <em class="big-issue">inline
      box</em>.</dd>
 
 
      <dt> If <code
      title="dom-context-2d-textAlign">textAlign</code> is <code
      title="">center</code></dt>
 

|