Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Unified Diff: Source/core/html/HTMLProgressElement.cpp

Issue 262753004: Replace all remaining IDL finitude type checks with [TypeChecking=Unrestricted] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLProgressElement.h ('k') | Source/core/html/HTMLProgressElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLProgressElement.cpp
diff --git a/Source/core/html/HTMLProgressElement.cpp b/Source/core/html/HTMLProgressElement.cpp
index e99cc862c990b8e78bb05801d2de1a921cd24d47..dc80d3f72ef0ad0b6bb65f0b89daa4b1960dea38 100644
--- a/Source/core/html/HTMLProgressElement.cpp
+++ b/Source/core/html/HTMLProgressElement.cpp
@@ -95,30 +95,30 @@ void HTMLProgressElement::attach(const AttachContext& context)
double HTMLProgressElement::value() const
{
double value = getFloatingPointAttribute(valueAttr);
+ // 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 value 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.
return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max());
}
-void HTMLProgressElement::setValue(double value, ExceptionState& exceptionState)
+void HTMLProgressElement::setValue(double value)
{
- if (!std::isfinite(value)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(value));
- return;
- }
setFloatingPointAttribute(valueAttr, std::max(value, 0.));
}
double HTMLProgressElement::max() const
{
double max = getFloatingPointAttribute(maxAttr);
+ // Otherwise, if the element has no max 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.
return !std::isfinite(max) || max <= 0 ? 1 : max;
}
-void HTMLProgressElement::setMax(double max, ExceptionState& exceptionState)
+void HTMLProgressElement::setMax(double max)
{
- if (!std::isfinite(max)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(max));
- return;
- }
// FIXME: The specification says we should ignore the input value if it is inferior or equal to 0.
setFloatingPointAttribute(maxAttr, max > 0 ? max : 1);
}
« no previous file with comments | « Source/core/html/HTMLProgressElement.h ('k') | Source/core/html/HTMLProgressElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698