diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-25 00:47:10 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-25 00:47:10 +0000 |
commit | ce8d3dceb9a54ab0ddda33794fbc335d3b45b577 (patch) | |
tree | 6f24f5ca0ab254c6fad53982646c76a7be527619 | |
parent | 81afecb92f381f14f0728be0b61bb89f87034956 (diff) | |
download | chromium_src-ce8d3dceb9a54ab0ddda33794fbc335d3b45b577.zip chromium_src-ce8d3dceb9a54ab0ddda33794fbc335d3b45b577.tar.gz chromium_src-ce8d3dceb9a54ab0ddda33794fbc335d3b45b577.tar.bz2 |
Revert 213469 "Merge 213120 "Require 100ms before re-opening a V..."
> Merge 213120 "Require 100ms before re-opening a Views Combobox m..."
>
> > Require 100ms before re-opening a Views Combobox menu.
> >
> > Views Comboboxes should close when clicked while open.
> > (this matches MenuButton and Native Win Comboboxes)
> >
> > Use a timer to require 100ms before re-opening the menu.
> > (required because of menu nested message loop complexity)
> > Share MenuButton's kMinimumTimeBetweenButtonClicks const.
> >
> > BUG=260146,175843
> > TEST=Clicking the combobox view while its menu is open causes the menu to close without re-opening. The menu will re-open after 100ms (about as fast as you can click it again). This behavior matches other Chrome menus like the hotdog menu, bookmark menus, etc. No other behavior changes.
> > R=sky@chromium.org
> >
> > Review URL: https://chromiumcodereview.appspot.com/19520020
>
> TBR=msw@chromium.org
>
> Review URL: https://codereview.chromium.org/19624007
TBR=msw@chromium.org
Review URL: https://codereview.chromium.org/20209003
git-svn-id: svn://svn.chromium.org/chrome/branches/1547/src@213562 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/views/controls/button/menu_button.cc | 7 | ||||
-rw-r--r-- | ui/views/controls/button/menu_button.h | 4 | ||||
-rw-r--r-- | ui/views/controls/combobox/native_combobox_views.cc | 7 | ||||
-rw-r--r-- | ui/views/controls/combobox/native_combobox_views.h | 9 |
4 files changed, 7 insertions, 20 deletions
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc index 5a20d52..765c9ef 100644 --- a/ui/views/controls/button/menu_button.cc +++ b/ui/views/controls/button/menu_button.cc @@ -26,15 +26,18 @@ using base::TimeDelta; namespace views { +// The amount of time, in milliseconds, we wait before allowing another mouse +// pressed event to show the menu. +static const int64 kMinimumTimeBetweenButtonClicks = 100; + // Default menu offset. static const int kDefaultMenuOffsetX = -2; static const int kDefaultMenuOffsetY = -4; // static -const char MenuButton::kViewClassName[] = "MenuButton"; -const int64 MenuButton::kMinimumTimeBetweenButtonClicks = 100; const int MenuButton::kMenuMarkerPaddingLeft = 3; const int MenuButton::kMenuMarkerPaddingRight = -1; +const char MenuButton::kViewClassName[] = "MenuButton"; //////////////////////////////////////////////////////////////////////////////// // diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h index e3f657b..e33ec18 100644 --- a/ui/views/controls/button/menu_button.h +++ b/ui/views/controls/button/menu_button.h @@ -28,10 +28,6 @@ class VIEWS_EXPORT MenuButton : public TextButton { public: static const char kViewClassName[]; - // The amount of time, in milliseconds, we wait before allowing another mouse - // pressed event to show the menu. - static const int64 kMinimumTimeBetweenButtonClicks; - // How much padding to put on the left and right of the menu marker. static const int kMenuMarkerPaddingLeft; static const int kMenuMarkerPaddingRight; diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc index 7a0d873..8ef1efa 100644 --- a/ui/views/controls/combobox/native_combobox_views.cc +++ b/ui/views/controls/combobox/native_combobox_views.cc @@ -19,7 +19,6 @@ #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/color_constants.h" -#include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/focusable_border.h" #include "ui/views/controls/menu/menu_runner.h" @@ -98,9 +97,7 @@ NativeComboboxViews::~NativeComboboxViews() { bool NativeComboboxViews::OnMousePressed(const ui::MouseEvent& mouse_event) { combobox_->RequestFocus(); - const base::TimeDelta delta = base::Time::Now() - closed_time_; - if (mouse_event.IsLeftMouseButton() && - (delta.InMilliseconds() > MenuButton::kMinimumTimeBetweenButtonClicks)) { + if (mouse_event.IsLeftMouseButton()) { UpdateFromModel(); ShowDropDownMenu(ui::MENU_SOURCE_MOUSE); } @@ -372,6 +369,7 @@ void NativeComboboxViews::PaintText(gfx::Canvas* canvas) { } void NativeComboboxViews::ShowDropDownMenu(ui::MenuSourceType source_type) { + if (!dropdown_list_menu_runner_.get()) UpdateFromModel(); @@ -403,7 +401,6 @@ void NativeComboboxViews::ShowDropDownMenu(ui::MenuSourceType source_type) { MenuRunner::MENU_DELETED) return; dropdown_open_ = false; - closed_time_ = base::Time::Now(); // Need to explicitly clear mouse handler so that events get sent // properly after the menu finishes running. If we don't do this, then diff --git a/ui/views/controls/combobox/native_combobox_views.h b/ui/views/controls/combobox/native_combobox_views.h index bdf7033..3384b8a 100644 --- a/ui/views/controls/combobox/native_combobox_views.h +++ b/ui/views/controls/combobox/native_combobox_views.h @@ -5,7 +5,6 @@ #ifndef UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ -#include "base/time/time.h" #include "ui/views/controls/combobox/native_combobox_wrapper.h" #include "ui/views/controls/menu/menu_delegate.h" #include "ui/views/view.h" @@ -91,14 +90,6 @@ class NativeComboboxViews : public views::View, // Is the drop down list showing bool dropdown_open_; - // Like MenuButton, we use a time object in order to keep track of when the - // combobox was closed. The time is used for simulating menu behavior; that - // is, if the menu is shown and the button is pressed, we need to close the - // menu. There is no clean way to get the second click event because the - // menu is displayed using a modal loop and, unlike regular menus in Windows, - // the button is not part of the displayed menu. - base::Time closed_time_; - // The selected index in the model. The default value is -1, which means no // selection. int selected_index_; |