From deb3f7248b8a7f7ed92b1cd4eaa7fb8df4645efc Mon Sep 17 00:00:00 2001 From: pkotwicz Date: Tue, 24 Feb 2015 13:16:05 -0800 Subject: Pass location in screen coordinates to DragDropClient::StartDragAndDrop() This CL: - Avoids converting from screen coordinates in WebContentsViewAura::StartDragging() and back to screen coordinates in DragDropController::StartDragAndDrop() - Passes the location in the correct coordinates to StartDragAndDrop() in DragDownloadItem() in drag_download_item_views.cc BUG=456619 TEST=Manual, see bug Review URL: https://codereview.chromium.org/901563005 Cr-Commit-Position: refs/heads/master@{#317888} --- ash/drag_drop/drag_drop_controller.cc | 5 ++--- ash/drag_drop/drag_drop_controller.h | 2 +- ash/wm/overview/window_selector_controller.cc | 4 ++-- ash/wm/overview/window_selector_item.cc | 14 +++++++------- ash/wm/overview/window_selector_unittest.cc | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) (limited to 'ash') diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index dedfffd..b57b24c 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -149,7 +149,7 @@ int DragDropController::StartDragAndDrop( const ui::OSExchangeData& data, aura::Window* root_window, aura::Window* source_window, - const gfx::Point& root_location, + const gfx::Point& screen_location, int operation, ui::DragDropTypes::DragEventSource source) { if (IsDragDropInProgress()) @@ -194,8 +194,7 @@ int DragDropController::StartDragAndDrop( drag_image_scale = kTouchDragImageScale; drag_image_vertical_offset = kTouchDragImageVerticalOffset; } - gfx::Point start_location = root_location; - ::wm::ConvertPointToScreen(root_window, &start_location); + gfx::Point start_location = screen_location; drag_image_final_bounds_for_cancel_animation_ = gfx::Rect( start_location - provider->GetDragImageOffset(), provider->GetDragImage().size()); diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h index a9007f2..35b1d9a 100644 --- a/ash/drag_drop/drag_drop_controller.h +++ b/ash/drag_drop/drag_drop_controller.h @@ -46,7 +46,7 @@ class ASH_EXPORT DragDropController int StartDragAndDrop(const ui::OSExchangeData& data, aura::Window* root_window, aura::Window* source_window, - const gfx::Point& root_location, + const gfx::Point& screen_location, int operation, ui::DragDropTypes::DragEventSource source) override; void DragUpdate(aura::Window* target, const ui::LocatedEvent& event) override; diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc index bd0aaf1..6f21c8f 100644 --- a/ash/wm/overview/window_selector_controller.cc +++ b/ash/wm/overview/window_selector_controller.cc @@ -23,8 +23,8 @@ namespace ash { WindowSelectorController::WindowSelectorController() - : swipe_to_close_enabled_(base::CommandLine::ForCurrentProcess()-> - HasSwitch(switches::kAshEnableSwipeToCloseInOverviewMode)) { + : swipe_to_close_enabled_(base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshEnableSwipeToCloseInOverviewMode)) { } WindowSelectorController::~WindowSelectorController() { diff --git a/ash/wm/overview/window_selector_item.cc b/ash/wm/overview/window_selector_item.cc index 0ee5f7c..9fb6b8c 100644 --- a/ash/wm/overview/window_selector_item.cc +++ b/ash/wm/overview/window_selector_item.cc @@ -261,8 +261,9 @@ void WindowSelectorItem::ButtonPressed(views::Button* sender, } void WindowSelectorItem::OnGestureEvent(ui::GestureEvent* event) { - if (!Shell::GetInstance()->window_selector_controller()-> - swipe_to_close_enabled()) + if (!Shell::GetInstance() + ->window_selector_controller() + ->swipe_to_close_enabled()) return; int delta_x = 0; @@ -282,8 +283,7 @@ void WindowSelectorItem::OnGestureEvent(ui::GestureEvent* event) { } case ui::ET_GESTURE_SCROLL_UPDATE: { event->SetHandled(); - ScopedTransformOverviewWindow::ScopedAnimationSettings - animation_settings; + ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; transform_window_.BeginScopedAnimation( OverviewAnimationType::OVERVIEW_ANIMATION_SCROLL_SELECTOR_ITEM, &animation_settings); @@ -294,8 +294,8 @@ void WindowSelectorItem::OnGestureEvent(ui::GestureEvent* event) { transform_window_.get_overview_transform()); transform_window_.SetTransform(root_window(), new_transform); - const float opacity = CalculateOpacityFromScrollDistance(delta_x, - GetMinimumCloseDistance()); + const float opacity = CalculateOpacityFromScrollDistance( + delta_x, GetMinimumCloseDistance()); transform_window_.SetOpacity(opacity); break; } @@ -345,7 +345,7 @@ void WindowSelectorItem::ResetScrolledWindow() { &animation_settings); transform_window_.SetTransform(root_window(), - transform_window_.get_overview_transform()); + transform_window_.get_overview_transform()); transform_window_.SetOpacity(1.0); SetupFadeInAfterLayout(close_button_widget_.GetNativeWindow()); diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index b013a01..ec60952 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -1306,8 +1306,8 @@ TEST_F(WindowSelectorSwipeToCloseEnabledTest, ToggleOverview(); - gfx::Rect bounds = ToNearestRect(GetTransformedBoundsInRootWindow( - window.get())); + gfx::Rect bounds = + ToNearestRect(GetTransformedBoundsInRootWindow(window.get())); ui::test::EventGenerator event_generator(window->GetRootWindow()); const gfx::Point drag_start_point(bounds.CenterPoint()); -- cgit v1.1