Index: third_party/WebKit/Source/web/WebFormControlElement.cpp |
diff --git a/third_party/WebKit/Source/web/WebFormControlElement.cpp b/third_party/WebKit/Source/web/WebFormControlElement.cpp |
index 7dbbea50b4756d937b75e21d3f5366c0421f14e0..64f0c9d2514d5b9f8b1bb74e6c78f0805c18f0e5 100644 |
--- a/third_party/WebKit/Source/web/WebFormControlElement.cpp |
+++ b/third_party/WebKit/Source/web/WebFormControlElement.cpp |
@@ -97,6 +97,26 @@ void WebFormControlElement::setValue(const WebString& value, bool sendEvents) |
unwrap<HTMLSelectElement>()->setValue(value, sendEvents); |
} |
+void WebFormControlElement::setAutofillValue(const WebString& value) |
+{ |
+ // The input and change events will be sent in setValue. |
+ if (isHTMLInputElement(*m_private) || isHTMLTextAreaElement(*m_private)) { |
+ if (!focused()) |
+ unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, nullptr); |
+ unwrap<Element>()->dispatchScopedEvent(Event::createBubble(EventTypeNames::keydown)); |
+ unwrap<HTMLTextFormControlElement>()->setValue(value, DispatchInputAndChangeEvent); |
+ unwrap<Element>()->dispatchScopedEvent(Event::createBubble(EventTypeNames::keyup)); |
+ if (!focused()) |
+ unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, nullptr); |
+ } else if (isHTMLSelectElement(*m_private)) { |
+ if (!focused()) |
+ unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, nullptr); |
+ unwrap<HTMLSelectElement>()->setValue(value, true); |
+ if (!focused()) |
+ unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, nullptr); |
+ } |
+} |
+ |
WebString WebFormControlElement::value() const |
{ |
if (isHTMLInputElement(*m_private)) |