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

Unified Diff: ui/views/controls/button/button_dropdown.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/button_dropdown.cc
diff --git a/ui/views/controls/button/button_dropdown.cc b/ui/views/controls/button/button_dropdown.cc
index 5ee98b3b83444846d0bbea8a58d2cd2fb965cffb..92a42c1ab6b21bef86fa7eedfd66382806254e9d 100644
--- a/ui/views/controls/button/button_dropdown.cc
+++ b/ui/views/controls/button/button_dropdown.cc
@@ -58,8 +58,10 @@ bool ButtonDropDown::IsMenuShowing() const {
////////////////////////////////////////////////////////////////////////////////
bool ButtonDropDown::OnMousePressed(const MouseEvent& event) {
- if (enabled() && ShouldShowMenu() &&
- IsTriggerableEvent(event) && HitTest(event.location())) {
+ if (enabled() &&
+ ShouldShowMenu() &&
+ IsTriggerableEvent(event) &&
+ HitTest(gfx::Rect(event.location(), gfx::Size(0,0)))) {
// Store the y pos of the mouse coordinates so we can use them later to
// determine if the user dragged the mouse down (which should pop up the
// drag down menu immediately, instead of waiting for the timer)
@@ -93,14 +95,17 @@ bool ButtonDropDown::OnMouseDragged(const MouseEvent& event) {
void ButtonDropDown::OnMouseReleased(const MouseEvent& event) {
if (IsTriggerableEvent(event) ||
- (event.IsRightMouseButton() && !HitTest(event.location()))) {
+ (event.IsRightMouseButton() &&
+ !HitTest(gfx::Rect(event.location(), gfx::Size(0, 0))))) {
ImageButton::OnMouseReleased(event);
}
if (IsTriggerableEvent(event))
show_menu_factory_.InvalidateWeakPtrs();
- if (enabled() && event.IsRightMouseButton() && HitTest(event.location())) {
+ if (enabled() &&
+ event.IsRightMouseButton() &&
+ HitTest(gfx::Rect(event.location(), gfx::Size(0, 0)))) {
show_menu_factory_.InvalidateWeakPtrs();
ShowDropDownMenu();
}

Powered by Google App Engine
This is Rietveld 408576698