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" #20208

Merged
merged 1 commit into from
Sep 19, 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 @@ -685,9 +685,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 @@ -1080,7 +1090,7 @@ gfx::Size VerticalTabStripRegionView::GetPreferredSizeForState(
return {};
}

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

Expand Down
4 changes: 2 additions & 2 deletions browser/ui/views/frame/vertical_tab_strip_region_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace views {
class ResizeArea;
} // namespace views
}

class BraveNewTabButton;
class BrowserView;
Expand Down Expand Up @@ -116,7 +116,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 @@ -391,31 +391,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 @@ -427,6 +408,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 @@ -436,15 +418,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