Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: webkit/glue/webview_impl.cc

Issue 50038: Fix for autofill bug 8627 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/editor_client_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 12331)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -88,6 +88,7 @@
#include "webkit/glue/clipboard_conversion.h"
#include "webkit/glue/context_menu_client_impl.h"
#include "webkit/glue/webdevtoolsagent_impl.h"
+#include "webkit/glue/dom_operations.h"
#include "webkit/glue/dragclient_impl.h"
#include "webkit/glue/editor_client_impl.h"
#include "webkit/glue/event_conversion.h"
@@ -424,21 +425,34 @@
return;
last_mouse_down_point_ = gfx::Point(event.x, event.y);
- // We need to remember who has focus, as if the user left-clicks an already
- // focused text-field, we may want to show the auto-fill popup.
- RefPtr<Node> focused_node;
- if (event.button == WebMouseEvent::BUTTON_LEFT)
- focused_node = GetFocusedNode();
+ // If a text field that has focus is clicked again, we should display the
+ // autocomplete popup.
+ RefPtr<Node> clicked_node;
+ if (event.button == WebMouseEvent::BUTTON_LEFT) {
+ RefPtr<Node> focused_node = GetFocusedNode();
+ if (focused_node.get() &&
+ webkit_glue::NodeToHTMLInputElement(focused_node.get())) {
+ IntPoint point(event.x, event.y);
+ HitTestResult result(point);
+ result = page_->mainFrame()->eventHandler()->hitTestResultAtPoint(point,
+ false);
+ if (result.innerNonSharedNode() == focused_node) {
+ // Already focused text field was clicked, let's remember this. If
+ // focus has not changed after the mouse event is processed, we'll
+ // trigger the autocomplete.
+ clicked_node = focused_node;
+ }
+ }
+ }
+
main_frame()->frame()->eventHandler()->handleMousePressEvent(
MakePlatformMouseEvent(main_frame()->frameview(), event));
- if (focused_node.get() && focused_node == GetFocusedNode()) {
- // Already focused node was clicked, ShowAutofillForNode will determine
- // whether to show the autofill (typically, if the node is a text-field and
- // is empty).
+ if (clicked_node.get() && clicked_node == GetFocusedNode()) {
+ // Focus has not changed, show the autocomplete popup.
static_cast<EditorClientImpl*>(page_->editorClient())->
- ShowAutofillForNode(focused_node.get());
+ ShowAutofillForNode(clicked_node.get());
}
}
« no previous file with comments | « webkit/glue/editor_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698