OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 point_in_screen.x() - | 375 point_in_screen.x() - |
376 mouse_offset_.x(), 0); | 376 mouse_offset_.x(), 0); |
377 widget->SetVisibilityChangedAnimationsEnabled(false); | 377 widget->SetVisibilityChangedAnimationsEnabled(false); |
378 widget->Restore(); | 378 widget->Restore(); |
379 widget->SetBounds(new_bounds); | 379 widget->SetBounds(new_bounds); |
380 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 380 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
381 point_in_screen, | 381 point_in_screen, |
382 &drag_bounds); | 382 &drag_bounds); |
383 widget->SetVisibilityChangedAnimationsEnabled(true); | 383 widget->SetVisibilityChangedAnimationsEnabled(true); |
384 } | 384 } |
385 RunMoveLoop(GetWindowOffset(point_in_screen)); | 385 // Use the start point to initialize the move loop, otherwise the point |
| 386 // under the cursor will be offset by the drag threshold from where the |
| 387 // user originally clicked, which could be entirely off the window. |
| 388 RunMoveLoop(GetWindowOffset(start_point_in_screen_)); |
386 return; | 389 return; |
387 } | 390 } |
388 } | 391 } |
389 | 392 |
390 if (ContinueDragging(point_in_screen) == Liveness::DELETED) | 393 if (ContinueDragging(point_in_screen) == Liveness::DELETED) |
391 return; | 394 return; |
392 } | 395 } |
393 | 396 |
394 void TabDragController::EndDrag(EndDragReason reason) { | 397 void TabDragController::EndDrag(EndDragReason reason) { |
395 TRACE_EVENT0("views", "TabDragController::EndDrag"); | 398 TRACE_EVENT0("views", "TabDragController::EndDrag"); |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1826 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1824 for (auto* browser : *BrowserList::GetInstance()) { | 1827 for (auto* browser : *BrowserList::GetInstance()) { |
1825 if (browser->tab_strip_model()->empty()) | 1828 if (browser->tab_strip_model()->empty()) |
1826 exclude.insert(browser->window()->GetNativeWindow()); | 1829 exclude.insert(browser->window()->GetNativeWindow()); |
1827 } | 1830 } |
1828 #endif | 1831 #endif |
1829 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1832 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
1830 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1833 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
1831 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1834 return ref ? Liveness::ALIVE : Liveness::DELETED; |
1832 } | 1835 } |
OLD | NEW |