minor fixes and enable datalist elements in OSR

This commit is contained in:
Heilig Benedek 2017-05-21 19:55:19 +02:00
parent a95d6b997b
commit 218e28b136
12 changed files with 402 additions and 58 deletions

View file

@ -73,6 +73,7 @@ void AutofillAgent::DidChangeScrollOffset() {
}
void AutofillAgent::FocusedNodeChanged(const blink::WebNode&) {
focused_node_was_last_clicked_ = false;
was_focused_before_now_ = false;
HidePopup();
}
@ -139,8 +140,6 @@ void AutofillAgent::ShowSuggestions(
const ShowSuggestionsOptions& options) {
if (!element.isEnabled() || element.isReadOnly())
return;
if (!element.suggestedValue().isEmpty())
return;
const blink::WebInputElement* input_element = toWebInputElement(&element);
if (input_element) {
if (!input_element->isTextField())
@ -220,7 +219,7 @@ void AutofillAgent::ShowPopup(
void AutofillAgent::OnAcceptSuggestion(base::string16 suggestion) {
auto element = render_frame_->GetWebFrame()->document().focusedElement();
if (element.isFormControlElement()) {
toWebInputElement(&element)->setAutofillValue(
toWebInputElement(&element)->setSuggestedValue(
blink::WebString::fromUTF16(suggestion));
}
}
@ -233,7 +232,9 @@ void AutofillAgent::DoFocusChangeComplete() {
if (focused_node_was_last_clicked_ && was_focused_before_now_) {
ShowSuggestionsOptions options;
options.autofill_on_empty_values = true;
ShowSuggestions(*toWebInputElement(&element), options);
auto input_element = toWebInputElement(&element);
if (input_element)
ShowSuggestions(*input_element, options);
}
was_focused_before_now_ = true;