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

Unified Diff: Source/core/html/HTMLMeterElement.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/HTMLMeterElement.h ('k') | Source/core/html/HTMLMeterElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMeterElement.cpp
diff --git a/Source/core/html/HTMLMeterElement.cpp b/Source/core/html/HTMLMeterElement.cpp
index aabfb4264306630d37e0e22203f9714198c51023..eaf131f492db218d0a5155446cfc4dd18f8303ec 100644
--- a/Source/core/html/HTMLMeterElement.cpp
+++ b/Source/core/html/HTMLMeterElement.cpp
@@ -70,47 +70,35 @@ void HTMLMeterElement::parseAttribute(const QualifiedName& name, const AtomicStr
LabelableElement::parseAttribute(name, value);
}
-double HTMLMeterElement::min() const
+double HTMLMeterElement::value() const
{
- return getFloatingPointAttribute(minAttr, 0);
+ double value = getFloatingPointAttribute(valueAttr, 0);
+ return std::min(std::max(value, min()), max());
}
-void HTMLMeterElement::setMin(double min, ExceptionState& exceptionState)
+void HTMLMeterElement::setValue(double value)
{
- if (!std::isfinite(min)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(min));
- return;
- }
- setFloatingPointAttribute(minAttr, min);
+ setFloatingPointAttribute(valueAttr, value);
}
-double HTMLMeterElement::max() const
+double HTMLMeterElement::min() const
{
- return std::max(getFloatingPointAttribute(maxAttr, std::max(1.0, min())), min());
+ return getFloatingPointAttribute(minAttr, 0);
}
-void HTMLMeterElement::setMax(double max, ExceptionState& exceptionState)
+void HTMLMeterElement::setMin(double min)
{
- if (!std::isfinite(max)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(max));
- return;
- }
- setFloatingPointAttribute(maxAttr, max);
+ setFloatingPointAttribute(minAttr, min);
}
-double HTMLMeterElement::value() const
+double HTMLMeterElement::max() const
{
- double value = getFloatingPointAttribute(valueAttr, 0);
- return std::min(std::max(value, min()), max());
+ return std::max(getFloatingPointAttribute(maxAttr, std::max(1.0, min())), min());
}
-void HTMLMeterElement::setValue(double value, ExceptionState& exceptionState)
+void HTMLMeterElement::setMax(double max)
{
- if (!std::isfinite(value)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(value));
- return;
- }
- setFloatingPointAttribute(valueAttr, value);
+ setFloatingPointAttribute(maxAttr, max);
}
double HTMLMeterElement::low() const
@@ -119,12 +107,8 @@ double HTMLMeterElement::low() const
return std::min(std::max(low, min()), max());
}
-void HTMLMeterElement::setLow(double low, ExceptionState& exceptionState)
+void HTMLMeterElement::setLow(double low)
{
- if (!std::isfinite(low)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(low));
- return;
- }
setFloatingPointAttribute(lowAttr, low);
}
@@ -134,12 +118,8 @@ double HTMLMeterElement::high() const
return std::min(std::max(high, low()), max());
}
-void HTMLMeterElement::setHigh(double high, ExceptionState& exceptionState)
+void HTMLMeterElement::setHigh(double high)
{
- if (!std::isfinite(high)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(high));
- return;
- }
setFloatingPointAttribute(highAttr, high);
}
@@ -149,12 +129,8 @@ double HTMLMeterElement::optimum() const
return std::min(std::max(optimum, min()), max());
}
-void HTMLMeterElement::setOptimum(double optimum, ExceptionState& exceptionState)
+void HTMLMeterElement::setOptimum(double optimum)
{
- if (!std::isfinite(optimum)) {
- exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(optimum));
- return;
- }
setFloatingPointAttribute(optimumAttr, optimum);
}
« no previous file with comments | « Source/core/html/HTMLMeterElement.h ('k') | Source/core/html/HTMLMeterElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698