diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 19:39:15 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 19:39:15 +0000 |
commit | b7fcc1b91c3a5690720347236d17a7e256e18c26 (patch) | |
tree | 391e2c32d6a9b113bf707c6d82ec3f1055f6f6ff /chrome | |
parent | 5808f7d72453c05c7e2722c6f30d1326c8759b4f (diff) | |
download | chromium_src-b7fcc1b91c3a5690720347236d17a7e256e18c26.zip chromium_src-b7fcc1b91c3a5690720347236d17a7e256e18c26.tar.gz chromium_src-b7fcc1b91c3a5690720347236d17a7e256e18c26.tar.bz2 |
Fixes bug in resetting selection during tab dragging that set the
active/anchor to the wrong index.
BUG=30572
TEST=none
R=ben@chromium.org
Review URL: http://codereview.chromium.org/6683046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78072 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/views/tabs/dragged_tab_controller.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index 9a523c1..02d1df6 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -1199,19 +1199,15 @@ void DraggedTabController::ResetSelection(TabStripModel* model) { for (size_t i = 0; i < drag_data_.size(); ++i) { // |contents| is NULL if a tab was deleted out from under us. if (drag_data_[i].contents) { - if (!has_one_valid_tab) { - // Reset the active/lead to the first tab. If the source tab is still - // valid we'll reset these again later on. - selection_model.set_active(i); - selection_model.set_anchor(i); - } - has_one_valid_tab = true; int index = model->GetIndexOfTabContents(drag_data_[i].contents); DCHECK_NE(-1, index); selection_model.AddIndexToSelection(index); - if (i == source_tab_index_) { - selection_model.set_active(i); - selection_model.set_anchor(i); + if (!has_one_valid_tab || i == source_tab_index_) { + // Reset the active/lead to the first tab. If the source tab is still + // valid we'll reset these again later on. + selection_model.set_active(index); + selection_model.set_anchor(index); + has_one_valid_tab = true; } } } |