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

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

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 8 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 83af3c9f2e632ed36142ec51513c4b3d89284620..bbbd829025c793b97c7bd53d594e65979cbd51be 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -166,8 +166,9 @@ bool MenuButton::OnMousePressed(const ui::MouseEvent& event) {
// If we're draggable (GetDragOperations returns a non-zero value), then
// don't pop on press, instead wait for release.
if (event.IsOnlyLeftMouseButton() &&
- HitTestPoint(event.location()) &&
- GetDragOperations(event.location()) == ui::DragDropTypes::DRAG_NONE) {
+ HitTestPoint(gfx::ToFlooredPoint(event.location())) &&
+ GetDragOperations(gfx::ToFlooredPoint(event.location())) ==
+ ui::DragDropTypes::DRAG_NONE) {
TimeDelta delta = TimeTicks::Now() - menu_closed_time_;
if (delta.InMilliseconds() > kMinimumMsBetweenButtonClicks)
return Activate();
@@ -181,9 +182,10 @@ void MenuButton::OnMouseReleased(const ui::MouseEvent& event) {
// !IsTriggerableEvent it could lead to a situation where we end up showing
// the menu and context menu (this would happen if the right button is not
// triggerable and there's a context menu).
- if (GetDragOperations(event.location()) != ui::DragDropTypes::DRAG_NONE &&
+ if (GetDragOperations(gfx::ToFlooredPoint(event.location())) !=
+ ui::DragDropTypes::DRAG_NONE &&
state() != STATE_DISABLED && !InDrag() && event.IsOnlyLeftMouseButton() &&
- HitTestPoint(event.location())) {
+ HitTestPoint(gfx::ToFlooredPoint(event.location()))) {
Activate();
} else {
TextButton::OnMouseReleased(event);

Powered by Google App Engine
This is Rietveld 408576698