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

Unified Diff: ui/views/controls/button/menu_button.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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
Index: ui/views/controls/button/menu_button.cc
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index 3395b420ff373bbc4982e535ef6e6fafd5e560bf..680ed95537ec2274b91a1d45f35a104ad0be9e0b 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -181,7 +181,8 @@ bool MenuButton::OnMousePressed(const MouseEvent& event) {
if (state() != BS_DISABLED) {
// If we're draggable (GetDragOperations returns a non-zero value), then
// don't pop on press, instead wait for release.
- if (event.IsOnlyLeftMouseButton() && HitTest(event.location()) &&
+ if (event.IsOnlyLeftMouseButton() &&
+ HitTest(gfx::Rect(event.location(), gfx::Size(0, 0))) &&
GetDragOperations(event.location()) == ui::DragDropTypes::DRAG_NONE) {
TimeDelta delta = Time::Now() - menu_closed_time_;
int64 delta_in_milliseconds = delta.InMilliseconds();
@@ -200,7 +201,7 @@ void MenuButton::OnMouseReleased(const MouseEvent& event) {
// triggerable and there's a context menu).
if (GetDragOperations(event.location()) != ui::DragDropTypes::DRAG_NONE &&
state() != BS_DISABLED && !InDrag() && event.IsOnlyLeftMouseButton() &&
- HitTest(event.location())) {
+ HitTest(gfx::Rect(event.location(), gfx::Size(0, 0)))) {
Activate();
} else {
TextButton::OnMouseReleased(event);

Powered by Google App Engine
This is Rietveld 408576698