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

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

Issue 84713002: Add number() static methods to AtomicString class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Pass NaN as default argument Created 7 years, 1 month 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/HTMLOListElement.cpp ('k') | Source/core/html/HTMLSelectElement.cpp » ('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 ed23025a01191217a732299473644f75c56b6545..edbbab74f92d68bedf90806c3c581ae8363d4194 100644
--- a/Source/core/html/HTMLProgressElement.cpp
+++ b/Source/core/html/HTMLProgressElement.cpp
@@ -94,7 +94,7 @@ void HTMLProgressElement::attach(const AttachContext& context)
double HTMLProgressElement::value() const
{
- double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr));
+ double value = getFloatingPointAttribute(valueAttr);
return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max());
}
@@ -104,12 +104,12 @@ void HTMLProgressElement::setValue(double value, ExceptionState& exceptionState)
exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::failedToSet("value", "HTMLProgressElement", ExceptionMessages::notAFiniteNumber(value)));
return;
}
- setAttribute(valueAttr, String::number(value >= 0 ? value : 0));
+ setFloatingPointAttribute(valueAttr, std::max(value, 0.));
}
double HTMLProgressElement::max() const
{
- double max = parseToDoubleForNumberType(getAttribute(maxAttr));
+ double max = getFloatingPointAttribute(maxAttr);
return !std::isfinite(max) || max <= 0 ? 1 : max;
}
@@ -119,7 +119,8 @@ void HTMLProgressElement::setMax(double max, ExceptionState& exceptionState)
exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::failedToSet("max", "HTMLProgressElement", ExceptionMessages::notAFiniteNumber(max)));
return;
}
- setAttribute(maxAttr, String::number(max > 0 ? max : 1));
+ // FIXME: The specification says we should ignore the input value if it is inferior or equal to 0.
+ setFloatingPointAttribute(maxAttr, max > 0 ? max : 1);
}
double HTMLProgressElement::position() const
« no previous file with comments | « Source/core/html/HTMLOListElement.cpp ('k') | Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698