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 // Always use the start point so the MacViews' |
tapted
2016/04/06 09:38:51
This affects all platforms, so we need to say why
themblsha
2016/04/06 17:54:11
Thanks, your suggestion is correct and succinct.
| |
386 // BridgedNativeWidget::RunMoveLoop() could position the window so the | |
387 // mouse would be directly on top of start_point_in_screen_. Otherwise the | |
388 // point by which the window is dragged will be wrong. | |
389 // | |
390 // The DetachToBrowserTabDragControllerTest.DragAll/0 test on MacViews | |
391 // will detect the inconsistencies. | |
392 RunMoveLoop(GetWindowOffset(start_point_in_screen_)); | |
386 return; | 393 return; |
387 } | 394 } |
388 } | 395 } |
389 | 396 |
390 if (ContinueDragging(point_in_screen) == Liveness::DELETED) | 397 if (ContinueDragging(point_in_screen) == Liveness::DELETED) |
391 return; | 398 return; |
392 } | 399 } |
393 | 400 |
394 void TabDragController::EndDrag(EndDragReason reason) { | 401 void TabDragController::EndDrag(EndDragReason reason) { |
395 TRACE_EVENT0("views", "TabDragController::EndDrag"); | 402 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) | 1830 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1824 for (auto* browser : *BrowserList::GetInstance()) { | 1831 for (auto* browser : *BrowserList::GetInstance()) { |
1825 if (browser->tab_strip_model()->empty()) | 1832 if (browser->tab_strip_model()->empty()) |
1826 exclude.insert(browser->window()->GetNativeWindow()); | 1833 exclude.insert(browser->window()->GetNativeWindow()); |
1827 } | 1834 } |
1828 #endif | 1835 #endif |
1829 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1836 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
1830 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1837 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
1831 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1838 return ref ? Liveness::ALIVE : Liveness::DELETED; |
1832 } | 1839 } |
OLD | NEW |