| Index: ui/views/controls/menu/menu_controller.cc
|
| diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
|
| index f5d28ef1d79a610f3834115b463b4b74d7566fc0..9ff9394ef5f604b8c1af4dcd26a55cf79543970b 100644
|
| --- a/ui/views/controls/menu/menu_controller.cc
|
| +++ b/ui/views/controls/menu/menu_controller.cc
|
| @@ -387,8 +387,8 @@ MenuItemView* MenuController::Run(Widget* parent,
|
| const ui::Event* event =
|
| static_cast<internal::RootView*>(root_view)->current_event();
|
| if (event && event->type() == ui::ET_MOUSE_PRESSED) {
|
| - gfx::Point screen_loc(
|
| - static_cast<const ui::MouseEvent*>(event)->location());
|
| + gfx::Point screen_loc(gfx::ToFlooredPoint(
|
| + static_cast<const ui::MouseEvent*>(event)->location()));
|
| View::ConvertPointToScreen(
|
| static_cast<View*>(event->target()), &screen_loc);
|
| menu_start_mouse_press_loc_ = screen_loc;
|
| @@ -560,14 +560,15 @@ void MenuController::OnMousePressed(SubmenuView* source,
|
|
|
| void MenuController::OnMouseDragged(SubmenuView* source,
|
| const ui::MouseEvent& event) {
|
| - MenuPart part = GetMenuPart(source, event.location());
|
| + MenuPart part = GetMenuPart(source, gfx::ToFlooredPoint(event.location()));
|
| UpdateScrolling(part);
|
|
|
| if (!blocking_run_)
|
| return;
|
|
|
| if (possible_drag_) {
|
| - if (View::ExceededDragThreshold(event.location() - press_pt_))
|
| + if (View::ExceededDragThreshold(gfx::ToFlooredPoint(event.location()) -
|
| + press_pt_))
|
| StartDrag(source, press_pt_);
|
| return;
|
| }
|
| @@ -579,7 +580,7 @@ void MenuController::OnMouseDragged(SubmenuView* source,
|
| mouse_menu = part.menu;
|
| SetSelection(part.menu ? part.menu : state_.item, SELECTION_OPEN_SUBMENU);
|
| } else if (part.type == MenuPart::NONE) {
|
| - ShowSiblingMenu(source, event.location());
|
| + ShowSiblingMenu(source, gfx::ToFlooredPoint(event.location()));
|
| }
|
| UpdateActiveMouseView(source, event, mouse_menu);
|
| }
|
| @@ -592,7 +593,7 @@ void MenuController::OnMouseReleased(SubmenuView* source,
|
| DCHECK(state_.item);
|
| possible_drag_ = false;
|
| DCHECK(blocking_run_);
|
| - MenuPart part = GetMenuPart(source, event.location());
|
| + MenuPart part = GetMenuPart(source, gfx::ToFlooredPoint(event.location()));
|
| if (event.IsRightMouseButton() && part.type == MenuPart::MENU_ITEM) {
|
| MenuItemView* menu = part.menu;
|
| // |menu| is NULL means this event is from an empty menu or a separator.
|
| @@ -622,7 +623,7 @@ void MenuController::OnMouseReleased(SubmenuView* source,
|
| base::TimeDelta time_shown = base::TimeTicks::Now() - menu_start_time_;
|
| if (time_shown.InMilliseconds() < menu_selection_hold_time_ms) {
|
| // And it wasn't far from the mouse press location.
|
| - gfx::Point screen_loc(event.location());
|
| + gfx::Point screen_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc);
|
| gfx::Vector2d moved = screen_loc - menu_start_mouse_press_loc_;
|
| if (moved.Length() < kMaximumLengthMovedToActivate) {
|
| @@ -656,7 +657,7 @@ void MenuController::OnMouseReleased(SubmenuView* source,
|
|
|
| void MenuController::OnMouseMoved(SubmenuView* source,
|
| const ui::MouseEvent& event) {
|
| - HandleMouseLocation(source, event.location());
|
| + HandleMouseLocation(source, gfx::ToFlooredPoint(event.location()));
|
| }
|
|
|
| void MenuController::OnMouseEntered(SubmenuView* source,
|
| @@ -667,13 +668,13 @@ void MenuController::OnMouseEntered(SubmenuView* source,
|
|
|
| bool MenuController::OnMouseWheel(SubmenuView* source,
|
| const ui::MouseWheelEvent& event) {
|
| - MenuPart part = GetMenuPart(source, event.location());
|
| + MenuPart part = GetMenuPart(source, gfx::ToFlooredPoint(event.location()));
|
| return part.submenu && part.submenu->OnMouseWheel(event);
|
| }
|
|
|
| void MenuController::OnGestureEvent(SubmenuView* source,
|
| ui::GestureEvent* event) {
|
| - MenuPart part = GetMenuPart(source, event->location());
|
| + MenuPart part = GetMenuPart(source, gfx::ToFlooredPoint(event->location()));
|
| if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
|
| SetSelectionOnPointerDown(source, *event);
|
| event->StopPropagation();
|
| @@ -743,7 +744,7 @@ int MenuController::OnDragUpdated(SubmenuView* source,
|
| const ui::DropTargetEvent& event) {
|
| StopCancelAllTimer();
|
|
|
| - gfx::Point screen_loc(event.location());
|
| + gfx::Point screen_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(source, &screen_loc);
|
| if (valid_drop_coordinates_ && screen_loc == drop_pt_)
|
| return last_drop_operation_;
|
| @@ -761,7 +762,7 @@ int MenuController::OnDragUpdated(SubmenuView* source,
|
| MenuDelegate::DropPosition drop_position = MenuDelegate::DROP_NONE;
|
| int drop_operation = ui::DragDropTypes::DRAG_NONE;
|
| if (menu_item) {
|
| - gfx::Point menu_item_loc(event.location());
|
| + gfx::Point menu_item_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToTarget(source, menu_item, &menu_item_loc);
|
| MenuItemView* query_menu_item;
|
| if (!over_empty_menu) {
|
| @@ -953,7 +954,7 @@ void MenuController::SetSelectionOnPointerDown(SubmenuView* source,
|
|
|
| DCHECK(!GetActiveMouseView());
|
|
|
| - MenuPart part = GetMenuPart(source, event.location());
|
| + MenuPart part = GetMenuPart(source, gfx::ToFlooredPoint(event.location()));
|
| if (part.is_scroll())
|
| return; // Ignore presses on scroll buttons.
|
|
|
| @@ -987,7 +988,7 @@ void MenuController::SetSelectionOnPointerDown(SubmenuView* source,
|
| if (!menu_stack_.empty()) {
|
| // We're running nested menus. Only exit all if the mouse wasn't over one
|
| // of the menus from the last run.
|
| - gfx::Point screen_loc(event.location());
|
| + gfx::Point screen_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc);
|
| MenuPart last_part = GetMenuPartByScreenCoordinateUsingMenu(
|
| menu_stack_.back().item, screen_loc);
|
| @@ -1017,7 +1018,7 @@ void MenuController::SetSelectionOnPointerDown(SubmenuView* source,
|
| } else {
|
| if (part.menu->GetDelegate()->CanDrag(part.menu)) {
|
| possible_drag_ = true;
|
| - press_pt_ = event.location();
|
| + press_pt_ = gfx::ToFlooredPoint(event.location());
|
| }
|
| if (part.menu->HasSubmenu())
|
| selection_types |= SELECTION_OPEN_SUBMENU;
|
| @@ -1361,7 +1362,7 @@ bool MenuController::ShowContextMenu(MenuItemView* menu_item,
|
| if (state_.item == pending_state_.item && state_.submenu_open)
|
| selection_types |= SELECTION_OPEN_SUBMENU;
|
| SetSelection(pending_state_.item, selection_types);
|
| - gfx::Point loc(event.location());
|
| + gfx::Point loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc);
|
|
|
| if (menu_item->GetDelegate()->ShowContextMenu(
|
| @@ -2162,7 +2163,7 @@ void MenuController::RepostEvent(SubmenuView* source,
|
| state_.item->GetRootMenuItem()->GetSubmenu()->ReleaseCapture();
|
| #endif
|
|
|
| - gfx::Point screen_loc(event.location());
|
| + gfx::Point screen_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc);
|
| gfx::NativeView native_view = source->GetWidget()->GetNativeView();
|
| if (!native_view)
|
| @@ -2279,7 +2280,7 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source,
|
| const ui::MouseEvent& event,
|
| View* target_menu) {
|
| View* target = NULL;
|
| - gfx::Point target_menu_loc(event.location());
|
| + gfx::Point target_menu_loc(gfx::ToFlooredPoint(event.location()));
|
| if (target_menu && target_menu->has_children()) {
|
| // Locate the deepest child view to send events to. This code assumes we
|
| // don't have to walk up the tree to find a view interested in events. This
|
| @@ -2331,7 +2332,7 @@ void MenuController::SendMouseReleaseToActiveView(SubmenuView* event_source,
|
| if (!active_mouse_view)
|
| return;
|
|
|
| - gfx::Point target_loc(event.location());
|
| + gfx::Point target_loc(gfx::ToFlooredPoint(event.location()));
|
| View::ConvertPointToScreen(event_source->GetScrollViewContainer(),
|
| &target_loc);
|
| View::ConvertPointFromScreen(active_mouse_view, &target_loc);
|
|
|