Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| index 7fff1e9c3df45449a880f33580f733ee1c381380..a3fc6143189524c3e4cb1d4451dde5fae3da5b25 100644 |
| --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| @@ -112,7 +112,7 @@ class DockView : public views::View { |
| bool rtl_ui = base::i18n::IsRTL(); |
| if (rtl_ui) { |
| // Flip canvas to draw the mirrored tab images for RTL UI. |
| - canvas->Translate(gfx::Point(width(), 0)); |
| + canvas->Translate(gfx::Vector2d(width(), 0)); |
| canvas->Scale(-1, 1); |
| } |
| int x_of_active_tab = width() / 2 + kTabSpacing / 2; |
| @@ -502,8 +502,8 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) { |
| Attach(source_tabstrip_, gfx::Point()); |
| if (detach_into_browser_ && static_cast<int>(drag_data_.size()) == |
| GetModel(source_tabstrip_)->count()) { |
| - gfx::Point dragged_view_point = GetWindowOffset(point_in_screen); |
| - RunMoveLoop(dragged_view_point); |
| + gfx::Vector2d dragged_view_offset = GetWindowOffset(point_in_screen); |
|
Peter Kasting
2012/10/30 01:14:14
Nit: Inline
|
| + RunMoveLoop(dragged_view_offset); |
| return; |
| } |
| } |
| @@ -1297,8 +1297,8 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| // All the tabs in a browser are being dragged but all the tabs weren't |
| // initially being dragged. For this to happen the user would have to |
| // start dragging a set of tabs, the other tabs close, then detach. |
| - gfx::Point dragged_view_point = GetWindowOffset(point_in_screen); |
| - RunMoveLoop(dragged_view_point); |
| + gfx::Vector2d dragged_view_offset = GetWindowOffset(point_in_screen); |
|
Peter Kasting
2012/10/30 01:14:14
Nit: Inline
|
| + RunMoveLoop(dragged_view_offset); |
| return; |
| } |
| @@ -1312,7 +1312,7 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| std::vector<gfx::Rect> drag_bounds = |
| CalculateBoundsForDraggedTabs(attached_point.x()); |
| - gfx::Point drag_offset; |
| + gfx::Vector2d drag_offset; |
| Browser* browser = CreateBrowserForDrag( |
| attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); |
| Detach(DONT_RELEASE_CAPTURE); |
| @@ -1335,7 +1335,7 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| RunMoveLoop(drag_offset); |
| } |
| -void TabDragController::RunMoveLoop(const gfx::Point& drag_offset) { |
| +void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { |
| // If the user drags the whole window we'll assume they are going to attach to |
| // another window and therefor want to reorder. |
| move_behavior_ = REORDER; |
| @@ -1969,7 +1969,7 @@ bool TabDragController::AreTabsConsecutive() { |
| Browser* TabDragController::CreateBrowserForDrag( |
| TabStrip* source, |
| const gfx::Point& point_in_screen, |
| - gfx::Point* drag_offset, |
| + gfx::Vector2d* drag_offset, |
| std::vector<gfx::Rect>* drag_bounds) { |
| gfx::Point center(0, source->height() / 2); |
| views::View::ConvertPointToWidget(source, ¢er); |
| @@ -1996,7 +1996,7 @@ Browser* TabDragController::CreateBrowserForDrag( |
| break; // Nothing to do for DETACH_ABOVE_OR_BELOW. |
| } |
| - *drag_offset = point_in_screen.Subtract(new_bounds.origin()); |
| + *drag_offset = point_in_screen - new_bounds.origin(); |
| Browser::CreateParams create_params(drag_data_[0].contents->profile()); |
| create_params.initial_bounds = new_bounds; |
| @@ -2027,13 +2027,13 @@ gfx::Point TabDragController::GetCursorScreenPoint() { |
| return screen_->GetCursorScreenPoint(); |
| } |
| -gfx::Point TabDragController::GetWindowOffset( |
| +gfx::Vector2d TabDragController::GetWindowOffset( |
| const gfx::Point& point_in_screen) { |
| TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
| attached_tabstrip_ : source_tabstrip_; |
| views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
| - gfx::Point offset = point_in_screen; |
| - views::View::ConvertPointFromScreen(toplevel_view, &offset); |
| - return offset; |
| + gfx::Point point = point_in_screen; |
| + views::View::ConvertPointFromScreen(toplevel_view, &point); |
| + return point.OffsetFromOrigin(); |
|
Peter Kasting
2012/10/30 01:14:14
I wonder if view.h should change from having all t
danakj
2012/10/30 19:21:21
That sounds pretty reasonable, and like it would r
Peter Kasting
2012/10/30 20:24:37
Should there be a bug for this, then, or are you k
danakj
2012/10/30 21:14:52
Ya, /me makes bug.
|
| } |