Skip to content

Commit

Permalink
[agiow] (0) Make progress.value clamp to the maximum on getting.
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10767

git-svn-id: http://svn.whatwg.org/webapps@5591 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 7, 2010
1 parent 7dc1187 commit 2d8a1a2
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 92 deletions.
70 changes: 40 additions & 30 deletions complete.html
Expand Up @@ -45050,19 +45050,16 @@ <h4 id=the-progress-element><span class=secno>4.10.16 </span>The <dfn><code>prog
</dl><p>The <code><a href=#the-progress-element>progress</a></code> element <a href=#represents>represents</a> the
completion progress of a task. The progress is either indeterminate,
indicating that progress is being made but that it is not clear how
much more work remains to be done before the task is complete
(e.g. because the task is waiting for a remote host to respond), or
the progress is a number in the range zero to a maximum, giving the
much more work remains to be done before the task is complete (e.g.
because the task is waiting for a remote host to respond), or the
progress is a number in the range zero to a maximum, giving the
fraction of work that has so far been completed.</p>

<p>There are two attributes that determine the current task
completion represented by the element.</p>

<p>The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn>
attribute specifies how much of the task has been completed, and the
<dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute
specifies how much work the task requires in total. The units are
arbitrary and not specified.</p>
completion represented by the element. The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn> attribute
specifies how much of the task has been completed, and the <dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute specifies
how much work the task requires in total. The units are arbitrary
and not specified.</p>

<p>Authors are encouraged to also include the current value and the
maximum value inline as text inside the element, so that the
Expand Down Expand Up @@ -45112,34 +45109,32 @@ <h4 id=the-progress-element><span class=secno>4.10.16 </span>The <dfn><code>prog
agent must parse the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
point number values</a>. If this does not result in an error, and
if the parsed value is greater than zero, then the maximum value of
the progress bar is that value. Otherwise, if the element has no
<code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, or if it has
one but parsing it resulted in an error, or if the parsed value was
less than or equal to zero, then the maximum value of the progress
bar is 1.0.</p>
if the parsed value is greater than zero, then the <dfn id=concept-progress-maximum title=concept-progress-maximum>maximum value</dfn> of the progress
bar is that value. Otherwise, if the element has no <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, or if it has one but
parsing it resulted in an error, or if the parsed value was less
than or equal to zero, then the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a> of the
progress bar is 1.0.</p>

<p>If the progress bar is a determinate progress bar, user agents
must parse the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
point number values</a>. If this does not result in an error, and
if the parsed value is less than the maximum value and greater than
zero, then the current value of the progress bar is that parsed
value. Otherwise, if the parsed value was greater than or equal to
the maximum value, then the current value of the progress bar is the
maximum value of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
in an error, or a number less than or equal to zero, then the
current value of the progress bar is zero.</p>
if the parsed value is less than the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a> and greater
than zero, then the <dfn id=concept-progress-value title=concept-progress-value>current
value</dfn> of the progress bar is that parsed value. Otherwise, if
the parsed value was greater than or equal to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>, then the
<a href=#concept-progress-value title=concept-progress-value>current value</a> of the
progress bar is the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum
value</a> of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
in an error, or a number less than or equal to zero, then the <a href=#concept-progress-value title=concept-progress-value>current value</a> of the
progress bar is zero.</p>

<p><strong>UA requirements for showing the progress bar</strong>:
When representing a <code><a href=#the-progress-element>progress</a></code> element to the user, the
UA should indicate whether it is a determinate or indeterminate
progress bar, and in the former case, should indicate the relative
position of the current value relative to the maximum value.</p>

<p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> and <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The default value for <code title=dom-progress-max><a href=#dom-progress-max>max</a></code> is 1.0.</p>
position of the <a href=#concept-progress-value title=concept-progress-value>current
value</a> relative to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

<p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
explicitly associate the <code><a href=#the-progress-element>progress</a></code> element with its
Expand All @@ -45157,12 +45152,27 @@ <h4 id=the-progress-element><span class=secno>4.10.16 </span>The <dfn><code>prog

<p>For an indeterminate progress bar, returns &minus;1.</p>

</dd>

</dl><div class=impl>

<p>If the progress bar is an indeterminate progress bar, then the
<dfn id=dom-progress-position title=dom-progress-position><code>position</code></dfn> IDL
attribute must return &minus;1. Otherwise, it must return the result of
dividing the current value by the maximum value.</p>
attribute must return &minus;1. Otherwise, it must return the
result of dividing the <a href=#concept-progress-value title=concept-progress-value>current value</a> by the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

<p>Similarly, if the progress bar is an indeterminate progress bar,
then the <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn>
IDL attribute, on getting, must &minus;1. Otherwise, it must return
the <a href=#concept-progress-value title=concept-progress-value>current value</a>. On
setting, the given value must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number>best
representation of the number as a floating point number</a> and
then the <code title=dom-progress-value><a href=#dom-progress-value>value</a></code> content
attribute must be set to that string.</p>

<p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> IDL
attribute must <a href=#reflect>reflect</a> the content attribute of the
same name. The default value for <code title=dom-progress-max><a href=#dom-progress-max>max</a></code> is 1.0.</p>

<p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides
a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the
Expand Down
70 changes: 40 additions & 30 deletions index
Expand Up @@ -45030,19 +45030,16 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
</dl><p>The <code><a href=#the-progress-element>progress</a></code> element <a href=#represents>represents</a> the
completion progress of a task. The progress is either indeterminate,
indicating that progress is being made but that it is not clear how
much more work remains to be done before the task is complete
(e.g. because the task is waiting for a remote host to respond), or
the progress is a number in the range zero to a maximum, giving the
much more work remains to be done before the task is complete (e.g.
because the task is waiting for a remote host to respond), or the
progress is a number in the range zero to a maximum, giving the
fraction of work that has so far been completed.</p>

<p>There are two attributes that determine the current task
completion represented by the element.</p>

<p>The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn>
attribute specifies how much of the task has been completed, and the
<dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute
specifies how much work the task requires in total. The units are
arbitrary and not specified.</p>
completion represented by the element. The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn> attribute
specifies how much of the task has been completed, and the <dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute specifies
how much work the task requires in total. The units are arbitrary
and not specified.</p>

<p>Authors are encouraged to also include the current value and the
maximum value inline as text inside the element, so that the
Expand Down Expand Up @@ -45092,34 +45089,32 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
agent must parse the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
point number values</a>. If this does not result in an error, and
if the parsed value is greater than zero, then the maximum value of
the progress bar is that value. Otherwise, if the element has no
<code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, or if it has
one but parsing it resulted in an error, or if the parsed value was
less than or equal to zero, then the maximum value of the progress
bar is 1.0.</p>
if the parsed value is greater than zero, then the <dfn id=concept-progress-maximum title=concept-progress-maximum>maximum value</dfn> of the progress
bar is that value. Otherwise, if the element has no <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, or if it has one but
parsing it resulted in an error, or if the parsed value was less
than or equal to zero, then the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a> of the
progress bar is 1.0.</p>

<p>If the progress bar is a determinate progress bar, user agents
must parse the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
point number values</a>. If this does not result in an error, and
if the parsed value is less than the maximum value and greater than
zero, then the current value of the progress bar is that parsed
value. Otherwise, if the parsed value was greater than or equal to
the maximum value, then the current value of the progress bar is the
maximum value of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
in an error, or a number less than or equal to zero, then the
current value of the progress bar is zero.</p>
if the parsed value is less than the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a> and greater
than zero, then the <dfn id=concept-progress-value title=concept-progress-value>current
value</dfn> of the progress bar is that parsed value. Otherwise, if
the parsed value was greater than or equal to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>, then the
<a href=#concept-progress-value title=concept-progress-value>current value</a> of the
progress bar is the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum
value</a> of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
in an error, or a number less than or equal to zero, then the <a href=#concept-progress-value title=concept-progress-value>current value</a> of the
progress bar is zero.</p>

<p><strong>UA requirements for showing the progress bar</strong>:
When representing a <code><a href=#the-progress-element>progress</a></code> element to the user, the
UA should indicate whether it is a determinate or indeterminate
progress bar, and in the former case, should indicate the relative
position of the current value relative to the maximum value.</p>

<p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> and <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The default value for <code title=dom-progress-max><a href=#dom-progress-max>max</a></code> is 1.0.</p>
position of the <a href=#concept-progress-value title=concept-progress-value>current
value</a> relative to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

<p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
explicitly associate the <code><a href=#the-progress-element>progress</a></code> element with its
Expand All @@ -45137,12 +45132,27 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme

<p>For an indeterminate progress bar, returns &minus;1.</p>

</dd>

</dl><div class=impl>

<p>If the progress bar is an indeterminate progress bar, then the
<dfn id=dom-progress-position title=dom-progress-position><code>position</code></dfn> IDL
attribute must return &minus;1. Otherwise, it must return the result of
dividing the current value by the maximum value.</p>
attribute must return &minus;1. Otherwise, it must return the
result of dividing the <a href=#concept-progress-value title=concept-progress-value>current value</a> by the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

<p>Similarly, if the progress bar is an indeterminate progress bar,
then the <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn>
IDL attribute, on getting, must &minus;1. Otherwise, it must return
the <a href=#concept-progress-value title=concept-progress-value>current value</a>. On
setting, the given value must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number>best
representation of the number as a floating point number</a> and
then the <code title=dom-progress-value><a href=#dom-progress-value>value</a></code> content
attribute must be set to that string.</p>

<p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> IDL
attribute must <a href=#reflect>reflect</a> the content attribute of the
same name. The default value for <code title=dom-progress-max><a href=#dom-progress-max>max</a></code> is 1.0.</p>

<p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides
a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the
Expand Down

0 comments on commit 2d8a1a2

Please sign in to comment.