Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Hide Vertical tab strip even when it's browser fullscreen" (uplift to 1.58.x) #20210

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions browser/ui/views/frame/vertical_tab_strip_region_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,19 @@ void VerticalTabStripRegionView::OnWidgetDestroying(views::Widget* widget) {
widget_observation_.Reset();
}

bool VerticalTabStripRegionView::IsFullscreen() const {
auto* widget = GetWidget();
return widget && widget->GetTopLevelWidget()->IsFullscreen();
bool VerticalTabStripRegionView::IsTabFullscreen() const {
auto* exclusive_access_manager = browser_->exclusive_access_manager();
if (!exclusive_access_manager) {
return false;
}

auto* fullscreen_controller =
exclusive_access_manager->fullscreen_controller();
if (!fullscreen_controller) {
return false;
}

return fullscreen_controller->IsWindowFullscreenForTabOrPending();
}

void VerticalTabStripRegionView::SetState(State state) {
Expand Down Expand Up @@ -1184,7 +1194,7 @@ gfx::Size VerticalTabStripRegionView::GetPreferredSizeForState(
return {};
}

if (IsFullscreen()) {
if (IsTabFullscreen()) {
return {};
}

Expand Down
2 changes: 1 addition & 1 deletion browser/ui/views/frame/vertical_tab_strip_region_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class VerticalTabStripRegionView : public views::View,
FRIEND_TEST_ALL_PREFIXES(VerticalTabStripBrowserTest,
OriginalTabSearchButton);

bool IsFullscreen() const;
bool IsTabFullscreen() const;

void SetState(State state);

Expand Down
52 changes: 27 additions & 25 deletions browser/ui/views/tabs/vertical_tab_strip_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,31 +396,12 @@ IN_PROC_BROWSER_TEST_F(VerticalTabStripBrowserTest, MAYBE_Fullscreen) {
observer.Wait();
}

base::RunLoop run_loop;
auto wait_until = base::BindLambdaForTesting(
[&](base::RepeatingCallback<bool()> predicate) {
if (predicate.Run()) {
return;
}

base::RepeatingTimer scheduler;
scheduler.Start(FROM_HERE, base::Milliseconds(100),
base::BindLambdaForTesting([&]() {
if (predicate.Run()) {
run_loop.Quit();
}
}));
run_loop.Run();
});

// Vertical tab strip should be invisible on browser fullscreen.
// Vertical tab strip should be visible on browser fullscreen.
ASSERT_TRUE(fullscreen_controller->IsFullscreenForBrowser());
ASSERT_TRUE(browser_view()->IsFullscreen());
wait_until.Run(base::BindLambdaForTesting([&]() {
return !browser_view()
->vertical_tab_strip_host_view_->GetPreferredSize()
.width();
}));
EXPECT_TRUE(browser_view()
->vertical_tab_strip_host_view_->GetPreferredSize()
.width());

{
auto observer = FullscreenNotificationObserver(browser());
Expand All @@ -432,6 +413,7 @@ IN_PROC_BROWSER_TEST_F(VerticalTabStripBrowserTest, MAYBE_Fullscreen) {

{
auto observer = FullscreenNotificationObserver(browser());
// Vertical tab strip should become invisible on tab fullscreen.
fullscreen_controller->EnterFullscreenModeForTab(
browser_view()
->browser()
Expand All @@ -441,15 +423,35 @@ IN_PROC_BROWSER_TEST_F(VerticalTabStripBrowserTest, MAYBE_Fullscreen) {

observer.Wait();
}

// Vertical tab strip should be invisible on tab fullscreen.
ASSERT_TRUE(fullscreen_controller->IsTabFullscreen());
if (!browser_view()
->vertical_tab_strip_host_view_->GetPreferredSize()
.width()) {
return;
}

base::RunLoop run_loop;
auto wait_until = base::BindLambdaForTesting(
[&](base::RepeatingCallback<bool()> predicate) {
if (predicate.Run()) {
return;
}

base::RepeatingTimer scheduler;
scheduler.Start(FROM_HERE, base::Milliseconds(100),
base::BindLambdaForTesting([&]() {
if (predicate.Run()) {
run_loop.Quit();
} else {
LOG(ERROR) << browser_view()
->vertical_tab_strip_host_view_
->GetPreferredSize()
.width();
}
}));
run_loop.Run();
});

wait_until.Run(base::BindLambdaForTesting([&]() {
return !browser_view()
->vertical_tab_strip_host_view_->GetPreferredSize()
Expand Down