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

Unified Diff: chrome/renderer/render_widget.cc

Issue 647047: Do not send extra blur and focus events if popup menu is showing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 | « chrome/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_widget.cc
===================================================================
--- chrome/renderer/render_widget.cc (revision 38812)
+++ chrome/renderer/render_widget.cc (working copy)
@@ -67,7 +67,9 @@
ime_control_busy_(false),
activatable_(activatable),
pending_window_rect_count_(0),
- suppress_next_char_events_(false) {
+ suppress_next_char_events_(false),
+ showing_popup_menu_(false),
+ popup_menu_owner_widget_(NULL) {
RenderProcess::current()->AddRefProcess();
DCHECK(render_thread_);
}
@@ -333,8 +335,19 @@
void RenderWidget::OnSetFocus(bool enable) {
has_focus_ = enable;
- if (webwidget_)
- webwidget_->setFocus(enable);
+ if (webwidget_) {
+ // Suppress focus / blur event if this RenderView creates a popup
+ // menu and the popup menu is showing.
+ // This is because the popup menu is a child of the RenderView and
+ // when user clicks select control to show popup, we should not
+ // consider this as focusing changes, so the focus / blur events
+ // after popup menu is showing should be suppressed. The flag
+ // will be reset once the popup menu is closed (see
+ // RenderWidget::PopupMenuClosed).
+ if (!showing_popup_menu_)
+ webwidget_->setFocus(enable);
+ }
+
if (enable) {
// Force to retrieve the state of the focused widget to determine if we
// should activate IMEs next time when this process calls the UpdateIME()
@@ -610,6 +623,11 @@
}
void RenderWidget::DoDeferredClose() {
+ if (popup_menu_owner_widget_.get()) {
+ popup_menu_owner_widget_->PopupMenuClosed();
+ popup_menu_owner_widget_ = NULL;
+ }
+
Send(new ViewHostMsg_Close(routing_id_));
}
@@ -857,3 +875,11 @@
}
}
}
+
+void RenderWidget::SetPopupMenuOwnerWidget(RenderWidget* widget) {
+ popup_menu_owner_widget_ = widget;
+}
+
+void RenderWidget::PopupMenuClosed() {
+ showing_popup_menu_ = false;
+}
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698