Index: components/autofill/content/renderer/autofill_agent.cc |
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc |
index 85dd8243a5776b90905bc6ceb6a26f50b91c45c7..4451d2dbe3b87184f979fdc797a1ad0cad8fd642 100644 |
--- a/components/autofill/content/renderer/autofill_agent.cc |
+++ b/components/autofill/content/renderer/autofill_agent.cc |
@@ -214,6 +214,7 @@ void AutofillAgent::DidChangeScrollOffset() { |
void AutofillAgent::FocusedNodeChanged(const WebNode& node) { |
HidePopup(); |
+ element_.reset(); |
Garrett Casto
2015/01/06 20:01:09
Is this safe? |element_| is mostly used to display
please use gerrit instead
2015/01/13 02:14:55
On a second look, nulling |element_| is not requir
|
if (node.isNull() || !node.isElementNode()) |
return; |
@@ -221,12 +222,6 @@ void AutofillAgent::FocusedNodeChanged(const WebNode& node) { |
if (node.document().frame() != render_frame()->GetWebFrame()) |
return; |
- if (password_generation_agent_ && |
- password_generation_agent_->FocusedNodeHasChanged(node)) { |
- is_popup_possibly_visible_ = true; |
- return; |
- } |
- |
WebElement web_element = node.toConst<WebElement>(); |
if (!web_element.document().frame()) |
@@ -235,16 +230,23 @@ void AutofillAgent::FocusedNodeChanged(const WebNode& node) { |
const WebInputElement* element = toWebInputElement(&web_element); |
if (!element || !element->isEnabled() || element->isReadOnly() || |
- !element->isTextField() || element->isPasswordField()) |
+ !element->isTextField()) |
return; |
element_ = *element; |
} |
-void AutofillAgent::Resized() { |
+void AutofillAgent::FocusedElementMovedOnResize() { |
HidePopup(); |
} |
+void AutofillAgent::FocusChangeComplete() { |
+ if (!element_.isNull() && password_generation_agent_ && |
+ password_generation_agent_->FocusedNodeHasChanged(element_)) { |
+ is_popup_possibly_visible_ = true; |
+ } |
+} |
+ |
void AutofillAgent::LegacyFrameWillClose(blink::WebFrame* frame) { |
if (in_flight_request_form_.isNull()) |
return; |
@@ -337,12 +339,6 @@ void AutofillAgent::FormControlElementClicked( |
switches::kEnableSingleClickAutofill)) { |
// Show full suggestions when clicking on an already-focused form field. On |
// the initial click (not focused yet), only show password suggestions. |
-#if defined(OS_ANDROID) |
- // TODO(gcasto): Remove after crbug.com/430318 has been fixed. |
- if (!was_focused) |
- return; |
-#endif |
- |
options.show_full_suggestion_list = |
options.show_full_suggestion_list || was_focused; |
options.show_password_suggestions_only = !was_focused; |
@@ -810,8 +806,12 @@ void AutofillAgent::LegacyAutofillAgent::FocusedNodeChanged( |
agent_->FocusedNodeChanged(node); |
} |
-void AutofillAgent::LegacyAutofillAgent::Resized() { |
- agent_->Resized(); |
+void AutofillAgent::LegacyAutofillAgent::FocusedElementMovedOnResize() { |
+ agent_->FocusedElementMovedOnResize(); |
+} |
+ |
+void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
+ agent_->FocusChangeComplete(); |
} |
void AutofillAgent::LegacyAutofillAgent::FrameWillClose( |