Skip to content

Commit

Permalink
Revert "Hide Vertical tab strip even when it's browser fullscreen" (u…
Browse files Browse the repository at this point in the history
…plift to 1.58.x) (#20210)

Uplift of #20208 (squashed) to release
  • Loading branch information
brave-builds authored Sep 20, 2023
1 parent 12b6d88 commit d97a9e2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
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

0 comments on commit d97a9e2

Please sign in to comment.