| 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 cf3e782fff76104315e1dd055e03d697e5180824..530478fa01f2b7464761ae23a69c94b58e124463 100644
|
| --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
|
| +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
|
| @@ -1317,15 +1317,17 @@ int TabDragController::GetInsertionIndexForDraggedBounds(
|
| index = (dragged_bounds.right() > last_tab_right) ? tab_count : 0;
|
| }
|
|
|
| - if (!drag_data_[0].attached_tab) {
|
| - // If 'attached_tab' is NULL, it means we're in the process of attaching and
|
| - // don't need to constrain the index.
|
| - return index;
|
| + int last_insertion_point = attached_tabstrip_->GetModelIndexOfTab(
|
| + attached_tabstrip_->GetLastVisibleTab()) + 1;
|
| + if (drag_data_[0].attached_tab) {
|
| + // We're not in the process of attaching, so clamp the insertion point to
|
| + // keep it within the visible region.
|
| + last_insertion_point = std::max(
|
| + 0, last_insertion_point - static_cast<int>(drag_data_.size()));
|
| }
|
|
|
| - int max_index = GetModel(attached_tabstrip_)->count() -
|
| - static_cast<int>(drag_data_.size());
|
| - return std::max(0, std::min(max_index, index));
|
| + // Ensure the first dragged tab always stays in the visible index range.
|
| + return std::min(index, last_insertion_point);
|
| }
|
|
|
| bool TabDragController::ShouldDragToNextStackedTab(
|
|
|