summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp74
1 files changed, 28 insertions, 46 deletions
diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp
index 41e536d9944..f745a7aeaa3 100644
--- a/chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp
+++ b/chromium/third_party/WebKit/Source/core/html/HTMLMeterElement.cpp
@@ -22,10 +22,10 @@
#include "core/html/HTMLMeterElement.h"
-#include "HTMLNames.h"
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "core/HTMLNames.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/parser/HTMLParserIdioms.h"
@@ -47,11 +47,11 @@ HTMLMeterElement::~HTMLMeterElement()
{
}
-PassRefPtr<HTMLMeterElement> HTMLMeterElement::create(Document& document)
+PassRefPtrWillBeRawPtr<HTMLMeterElement> HTMLMeterElement::create(Document& document)
{
- RefPtr<HTMLMeterElement> meter = adoptRef(new HTMLMeterElement(document));
+ RefPtrWillBeRawPtr<HTMLMeterElement> meter = adoptRefWillBeNoop(new HTMLMeterElement(document));
meter->ensureUserAgentShadowRoot();
- return meter;
+ return meter.release();
}
RenderObject* HTMLMeterElement::createRenderer(RenderStyle* style)
@@ -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.throwDOMException(NotSupportedError, 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.throwDOMException(NotSupportedError, 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.throwDOMException(NotSupportedError, 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.throwDOMException(NotSupportedError, 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.throwDOMException(NotSupportedError, 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.throwDOMException(NotSupportedError, ExceptionMessages::notAFiniteNumber(optimum));
- return;
- }
setFloatingPointAttribute(optimumAttr, optimum);
}
@@ -223,10 +199,10 @@ void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
ASSERT(!m_value);
- RefPtr<MeterInnerElement> inner = MeterInnerElement::create(document());
+ RefPtrWillBeRawPtr<MeterInnerElement> inner = MeterInnerElement::create(document());
root.appendChild(inner);
- RefPtr<MeterBarElement> bar = MeterBarElement::create(document());
+ RefPtrWillBeRawPtr<MeterBarElement> bar = MeterBarElement::create(document());
m_value = MeterValueElement::create(document());
m_value->setWidthPercentage(0);
m_value->updatePseudo();
@@ -235,4 +211,10 @@ void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root)
inner->appendChild(bar);
}
+void HTMLMeterElement::trace(Visitor* visitor)
+{
+ visitor->trace(m_value);
+ LabelableElement::trace(visitor);
+}
+
} // namespace