Commit 75d292c0 authored by Charlene Yan's avatar Charlene Yan Committed by Commit Bot

[Tab Groups Collapse] Tab cycling does not select collapsed tabs.

Bug: 1018230
Change-Id: Iae567776524a5850171c91ded1afa4e11b58d77c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2232798Reviewed-by: default avatarConnie Wan <connily@chromium.org>
Commit-Queue: Charlene Yan <cyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775816}
parent 89c2c2ec
......@@ -1847,9 +1847,20 @@ void TabStripModel::SelectRelativeTab(bool next, UserGestureDetails detail) {
if (contents_data_.empty())
return;
int index = active_index();
int delta = next ? 1 : -1;
index = (index + count() + delta) % count();
const int start_index = active_index();
base::Optional<tab_groups::TabGroupId> start_group =
GetTabGroupForTab(start_index);
// Ensure the active tab is not in a collapsed group so the while loop can
// fallback on activating the active tab.
DCHECK(!start_group.has_value() || !IsGroupCollapsed(start_group.value()));
const int delta = next ? 1 : -1;
int index = (start_index + count() + delta) % count();
base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
while (group.has_value() && IsGroupCollapsed(group.value())) {
index = (index + count() + delta) % count();
group = GetTabGroupForTab(index);
}
ActivateTabAt(index, detail);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment