return parseToDoubleForNumberType(element().value());
}
-void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionState&) const
+void RangeInputType::setValueAsDouble(double newValue, TextFieldEventBehavior eventBehavior, ExceptionState& exceptionState) const
{
- element().setValue(serialize(newValue), eventBehavior);
+ setValueAsDecimal(Decimal::fromDouble(newValue), eventBehavior, exceptionState);
}
bool RangeInputType::typeMismatchFor(const String& value) const
{
DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rangeDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor));
+ const Decimal stepBase = findStepBase(rangeDefaultStepBase);
const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), rangeDefaultMinimum);
const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribute(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum);
const AtomicString& precisionValue = element().fastGetAttribute(precisionAttr);
if (!precisionValue.isNull()) {
const Decimal step = equalIgnoringCase(precisionValue, "float") ? Decimal::nan() : 1;
- return StepRange(minimum, minimum, maximum, step, stepDescription);
+ return StepRange(stepBase, minimum, maximum, step, stepDescription);
}
const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
- return StepRange(minimum, minimum, maximum, step, stepDescription);
+ return StepRange(stepBase, minimum, maximum, step, stepDescription);
}
bool RangeInputType::isSteppable() const
return;
if (event->type() == EventTypeNames::touchend) {
+ element().dispatchFormControlChangeEvent();
event->setDefaultHandled();
return;
}
if (newValue != current) {
EventQueueScope scope;
- TextFieldEventBehavior eventBehavior = DispatchChangeEvent;
+ TextFieldEventBehavior eventBehavior = DispatchInputAndChangeEvent;
setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION);
if (AXObjectCache* cache = element().document().existingAXObjectCache())
cache->postNotification(&element(), AXObjectCache::AXValueChanged, true);
- element().dispatchFormControlChangeEvent();
}
event->setDefaultHandled();
bool RangeInputType::shouldRespectListAttribute()
{
- return InputType::themeSupportsDataListUI(this);
+ return true;
}
inline SliderThumbElement* RangeInputType::sliderThumbElement() const
RefPtr<HTMLCollection> options = dataList->options();
m_tickMarkValues.reserveCapacity(options->length());
for (unsigned i = 0; i < options->length(); ++i) {
- Node* node = options->item(i);
- HTMLOptionElement* optionElement = toHTMLOptionElement(node);
+ Element* element = options->item(i);
+ HTMLOptionElement* optionElement = toHTMLOptionElement(element);
String optionValue = optionElement->value();
- if (!element().isValidValue(optionValue))
+ if (!this->element().isValidValue(optionValue))
continue;
m_tickMarkValues.append(parseToNumber(optionValue, Decimal::nan()));
}