Skip to content

Commit

Permalink
[] (0) Correct the algorithm for <textarea> dimensions. (credit: ov)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@3193 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 5, 2009
1 parent b8da006 commit b015f4b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 33 deletions.
44 changes: 30 additions & 14 deletions index
Expand Up @@ -69250,14 +69250,6 @@ object[align=bottom] {
implement any relevant animations, etc, that are appropriate for the
platform. <a href=#refsCSSUI>[CSSUI]</a></p>

<hr><p>The <dfn id=converting-a-character-width-to-pixels>converting a character width to pixels</dfn> algorithm,
used by some of the bindings below, returns <span>(<var title="">size-1</var>)&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
<var title="">size</var> is the character width to convert, <var title="">avg</var> is the average character width of the primary
font for the element for which the algorithm is being run, in
pixels, and <var title="">max</var> is the maximum character width
of that same font, also in pixels. (The element's 'letter-spacing'
property does not affect the result.)</p>



<h4 id=the-bb-element-0><span class=secno>11.4.2 </span>The <code><a href=#the-bb-element>bb</a></code> element</h4>
Expand Down Expand Up @@ -69363,6 +69355,14 @@ input[type=password] { binding: <i title="">input-password</i>; }
from applying the <a href=#converting-a-character-width-to-pixels>converting a character width to
pixels</a> algorithm to the number 20.</p>

<p>The <dfn id=converting-a-character-width-to-pixels>converting a character width to pixels</dfn> algorithm
returns <span>(<var title="">size</var>-1)&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
<var title="">size</var> is the character width to convert, <var title="">avg</var> is the average character width of the primary
font for the element for which the algorithm is being run, in
pixels, and <var title="">max</var> is the maximum character width
of that same font, also in pixels. (The element's 'letter-spacing'
property does not affect the result.)</p>



<h4 id=the-input-element-as-domain-specific-widgets><span class=secno>11.4.7 </span>The <code><a href=#the-input-element>input</a></code> element as domain-specific widgets</h4>
Expand Down Expand Up @@ -69809,17 +69809,33 @@ textarea { binding: <i title="">textarea</i>; }</pre>
attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
for parsing non-negative integers</a> doesn't generate an error,
then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
'width' property on the element, with the value obtained from
applying the <a href=#converting-a-character-width-to-pixels>converting a character width to pixels</a>
algorithm to the value of the attribute and then adding the width of
a scroll bar.</p>
'width' property on the element, with the value being the
<a href=#textarea-effective-width>textarea effective width</a> (as defined below). Otherwise,
the user agent is expected to act as if it had a user-agent-level
style sheet rule setting the 'width' property on the element to the
<a href=#textarea-effective-width>textarea effective width</a>.</p>

<p>The <dfn id=textarea-effective-width>textarea effective width</dfn> of a
<code><a href=#the-textarea-element>textarea</a></code> element is <span><var title="">size</var>&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">sbw</var></span>, where <var title="">size</var> is the
element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character
width</a>, <var title="">avg</var> is the average character width
of the primary font of the element, in CSS pixels, and <var title="">sbw</var> is the width of a scroll bar, in CSS pixels. (The
element's 'letter-spacing' property does not affect the result.)</p>

<p>If the element has a <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>
attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
for parsing non-negative integers</a> doesn't generate an error,
then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
'height' property on the element, with the value being the specified
number of lines, plus the height of a scrollbar.</p>
'height' property on the element, with the value being the
<a href=#textarea-effective-height>textarea effective height</a> (as defined
below). Otherwise, the user agent is expected to act as if it had a
user-agent-level style sheet rule setting the 'height' property on
the element to the <a href=#textarea-effective-height>textarea effective height</a>.</p>

<p>The <dfn id=textarea-effective-height>textarea effective height</dfn> of a
<code><a href=#the-textarea-element>textarea</a></code> element is the height in CSS pixels of the
number of lines specified the element's <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>, plus the
height of a scrollbar in CSS pixels.</p>

<p>For historical reasons, if the element has a <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute whose value is an
<a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=attr-textarea-wrap-off>off</code>", then the user agent is
Expand Down
55 changes: 36 additions & 19 deletions source
Expand Up @@ -81660,19 +81660,6 @@ object[align=bottom] {
implement any relevant animations, etc, that are appropriate for the
platform. <a href="#refsCSSUI">[CSSUI]</a></p>

<hr>

<p>The <dfn>converting a character width to pixels</dfn> algorithm,
used by some of the bindings below, returns <span>(<var
title="">size-1</var>)&times;<var
title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
<var title="">size</var> is the character width to convert, <var
title="">avg</var> is the average character width of the primary
font for the element for which the algorithm is being run, in
pixels, and <var title="">max</var> is the maximum character width
of that same font, also in pixels. (The element's 'letter-spacing'
property does not affect the result.)</p>



<h4>The <code>bb</code> element</h4>
Expand Down Expand Up @@ -81792,6 +81779,16 @@ input[type=password] { binding: <i title="">input-password</i>; }
from applying the <span>converting a character width to
pixels</span> algorithm to the number 20.</p>

<p>The <dfn>converting a character width to pixels</dfn> algorithm
returns <span>(<var title="">size</var>-1)&times;<var
title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
<var title="">size</var> is the character width to convert, <var
title="">avg</var> is the average character width of the primary
font for the element for which the algorithm is being run, in
pixels, and <var title="">max</var> is the maximum character width
of that same font, also in pixels. (The element's 'letter-spacing'
property does not affect the result.)</p>



<h4>The <code>input</code> element as domain-specific widgets</h4>
Expand Down Expand Up @@ -82310,18 +82307,38 @@ textarea { binding: <i title="">textarea</i>; }</pre>
for parsing non-negative integers</span> doesn't generate an error,
then the user agent is expected to use the attribute as a <span
title="presentational hints">presentational hint</span> for the
'width' property on the element, with the value obtained from
applying the <span>converting a character width to pixels</span>
algorithm to the value of the attribute and then adding the width of
a scroll bar.</p>
'width' property on the element, with the value being the
<span>textarea effective width</span> (as defined below). Otherwise,
the user agent is expected to act as if it had a user-agent-level
style sheet rule setting the 'width' property on the element to the
<span>textarea effective width</span>.</p>

<p>The <dfn>textarea effective width</dfn> of a
<code>textarea</code> element is <span><var
title="">size</var>&times;<var title="">avg</var>&nbsp;+&nbsp;<var
title="">sbw</var></span>, where <var title="">size</var> is the
element's <span title="attr-textarea-cols-value">character
width</span>, <var title="">avg</var> is the average character width
of the primary font of the element, in CSS pixels, and <var
title="">sbw</var> is the width of a scroll bar, in CSS pixels. (The
element's 'letter-spacing' property does not affect the result.)</p>

<p>If the element has a <code title="attr-textarea-rows">rows</code>
attribute, and parsing that attribute's value using the <span>rules
for parsing non-negative integers</span> doesn't generate an error,
then the user agent is expected to use the attribute as a <span
title="presentational hints">presentational hint</span> for the
'height' property on the element, with the value being the specified
number of lines, plus the height of a scrollbar.</p>
'height' property on the element, with the value being the
<span>textarea effective height</span> (as defined
below). Otherwise, the user agent is expected to act as if it had a
user-agent-level style sheet rule setting the 'height' property on
the element to the <span>textarea effective height</span>.</p>

<p>The <dfn>textarea effective height</dfn> of a
<code>textarea</code> element is the height in CSS pixels of the
number of lines specified the element's <span
title="attr-textarea-rows-value">character height</span>, plus the
height of a scrollbar in CSS pixels.</p>

<p>For historical reasons, if the element has a <code
title="attr-textarea-wrap">wrap</code> attribute whose value is an
Expand Down

0 comments on commit b015f4b

Please sign in to comment.