diff options
author | victorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 22:04:33 +0000 |
---|---|---|
committer | victorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 22:04:33 +0000 |
commit | 9d166afe522da91217060a34787b16fa705f15e3 (patch) | |
tree | e7651e38f525fde797c66b2240315de01eb4809e | |
parent | 702126c6af7e854d09274cc9540b909f4e0f3249 (diff) | |
download | chromium_src-9d166afe522da91217060a34787b16fa705f15e3.zip chromium_src-9d166afe522da91217060a34787b16fa705f15e3.tar.gz chromium_src-9d166afe522da91217060a34787b16fa705f15e3.tar.bz2 |
Revert 39670 which breaks suggestion popup
Do not send extra blur and focus events if popup menu is showing
Add flag to RenderWidget to remember the popup menu state and
suppress focus / blur events when popup menu is showing. This
fixes the issue that extra focus / blur events are fired after
select control is clicked.
R=darin
BUG=23499
TEST=none
Review URL: http://codereview.chromium.org/647047
TBR=victorw@chromium.org
Review URL: http://codereview.chromium.org/660408
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40445 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_view.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 32 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 16 |
3 files changed, 3 insertions, 51 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index fdf49a5..892735f 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1565,9 +1565,6 @@ WebWidget* RenderView::createPopupMenu(bool activatable) { RenderWidget* widget = RenderWidget::Create(routing_id_, render_thread_, activatable); - showing_popup_menu_ = true; - widget->SetPopupMenuOwnerWidget(this); - return widget->webwidget(); } @@ -1575,9 +1572,6 @@ WebWidget* RenderView::createPopupMenu(const WebPopupMenuInfo& info) { RenderWidget* widget = RenderWidget::Create(routing_id_, render_thread_, true); - showing_popup_menu_ = true; - widget->SetPopupMenuOwnerWidget(this); - widget->ConfigureAsExternalPopupMenu(info); return widget->webwidget(); } diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 75cd8d2..343db541 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -67,9 +67,7 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) ime_control_busy_(false), activatable_(activatable), pending_window_rect_count_(0), - suppress_next_char_events_(false), - showing_popup_menu_(false), - popup_menu_owner_widget_(NULL) { + suppress_next_char_events_(false) { RenderProcess::current()->AddRefProcess(); DCHECK(render_thread_); } @@ -345,19 +343,8 @@ void RenderWidget::OnMouseCaptureLost() { void RenderWidget::OnSetFocus(bool enable) { has_focus_ = 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 (webwidget_) + 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() @@ -633,11 +620,6 @@ void RenderWidget::didBlur() { } 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_)); } @@ -885,11 +867,3 @@ void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { } } } - -void RenderWidget::SetPopupMenuOwnerWidget(RenderWidget* widget) { - popup_menu_owner_widget_ = widget; -} - -void RenderWidget::PopupMenuClosed() { - showing_popup_menu_ = false; -} diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index feb3efe..ab591f0 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -105,10 +105,6 @@ class RenderWidget : public IPC::Channel::Listener, // Close the underlying WebWidget. virtual void Close(); - // Set owner widget who creates this popup menu. This is used to inform - // owner that popup menu is closed. - void SetPopupMenuOwnerWidget(RenderWidget* widget); - protected: // Friend RefCounted so that the dtor can be non-public. Using this class // without ref-counting is an error. @@ -210,9 +206,6 @@ class RenderWidget : public IPC::Channel::Listener, // just handled. virtual void DidHandleKeyEvent() {} - // Reset the popup menu state when it is closed. - void PopupMenuClosed(); - // Routing ID that allows us to communicate to the parent browser process // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. int32 routing_id_; @@ -324,15 +317,6 @@ class RenderWidget : public IPC::Channel::Listener, // Indicates if the next sequence of Char events should be suppressed or not. bool suppress_next_char_events_; - // These are for popup menu so the focus and blur events can be dispatched - // properly. - // - // Whether this RenderWidget is showing a popup menu widget. - bool showing_popup_menu_; - // This is for popup menu RenderWidget to remember its owner so it could - // inform the owner that popup menu is closed. - scoped_refptr<RenderWidget> popup_menu_owner_widget_; - DISALLOW_COPY_AND_ASSIGN(RenderWidget); }; |