diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebCore/html/HTMLProgressElement.cpp | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebCore/html/HTMLProgressElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLProgressElement.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index 2d47d820e..814afdf04 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -91,11 +91,8 @@ void HTMLProgressElement::attach() double HTMLProgressElement::value() const { - double value; - bool ok = parseToDoubleForNumberType(fastGetAttribute(valueAttr), &value); - if (!ok || value < 0) - return 0; - return (value > max()) ? max() : value; + double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); + return !isfinite(value) || value < 0 ? 0 : std::min(value, max()); } void HTMLProgressElement::setValue(double value, ExceptionCode& ec) @@ -109,11 +106,8 @@ void HTMLProgressElement::setValue(double value, ExceptionCode& ec) double HTMLProgressElement::max() const { - double max; - bool ok = parseToDoubleForNumberType(getAttribute(maxAttr), &max); - if (!ok || max <= 0) - return 1; - return max; + double max = parseToDoubleForNumberType(getAttribute(maxAttr)); + return !isfinite(max) || max <= 0 ? 1 : max; } void HTMLProgressElement::setMax(double max, ExceptionCode& ec) @@ -140,7 +134,7 @@ bool HTMLProgressElement::isDeterminate() const void HTMLProgressElement::didElementStateChange() { m_value->setWidthPercentage(position() * 100); - if (renderer()) { + if (renderer() && renderer()->isProgress()) { RenderProgress* render = toRenderProgress(renderer()); bool wasDeterminate = render->isDeterminate(); renderer()->updateFromElement(); |