void InputElement::setValueFromRenderer(InputElementData& data, InputElement* inputElement, Element* element, const String& value) { // Renderer and our event handler are responsible for sanitizing values. ASSERT_UNUSED(inputElement, value == inputElement->sanitizeValue(value) || inputElement->sanitizeValue(value).isEmpty()); // Workaround for bug where trailing \n is included in the result of textContent. // The assert macro above may also be simplified to: value == constrainValue(value) // http://bugs.webkit.org/show_bug.cgi?id=9661 if (value == "\n") data.setValue(""); else data.setValue(value); element->setFormControlValueMatchesRenderer(true); element->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); notifyFormStateChanged(element); }
void InputElement::setValueFromRenderer(InputElementData& data, Document* document, const String& value) { // Renderer and our event handler are responsible for constraining values. ASSERT(value == data.inputElement()->constrainValue(value) || data.inputElement()->constrainValue(value).isEmpty()); if (data.inputElement()->isTextField()) updatePlaceholderVisibility(data, document); // Workaround for bug where trailing \n is included in the result of textContent. // The assert macro above may also be simplified to: value == constrainValue(value) // http://bugs.webkit.org/show_bug.cgi?id=9661 if (value == "\n") data.setValue(""); else data.setValue(value); Element* element = data.element(); element->setFormControlValueMatchesRenderer(true); // Fire the "input" DOM event element->dispatchEvent(eventNames().inputEvent, true, false); notifyFormStateChanged(data, document); }