From eb91b1c9655cebfe048222b5d6dfbd354962002a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 5 Feb 2021 10:03:12 +0900 Subject: [PATCH] fix: avoid flicker when leaving fullscreen in frameless window (#27587) --- shell/browser/native_window_mac.mm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 6c89b6ecc04c..04672dd8168d 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1490,11 +1490,6 @@ void NativeWindowMac::NotifyWindowEnterFullScreen() { void NativeWindowMac::NotifyWindowLeaveFullScreen() { NativeWindow::NotifyWindowLeaveFullScreen(); exiting_fullscreen_ = false; - // Add back buttonsView after leaving fullscreen mode. - if (buttons_view_) { - InternalSetStandardButtonsVisibility(false); - [[window_ contentView] addSubview:buttons_view_]; - } } void NativeWindowMac::NotifyWindowWillEnterFullScreen() { @@ -1507,9 +1502,12 @@ void NativeWindowMac::NotifyWindowWillEnterFullScreen() { } void NativeWindowMac::NotifyWindowWillLeaveFullScreen() { - // Hide window title after leaving fullscreen. - if (buttons_view_) + // Hide window title and restore buttonsView when leaving fullscreen. + if (buttons_view_) { [window_ setTitleVisibility:NSWindowTitleHidden]; + InternalSetStandardButtonsVisibility(false); + [[window_ contentView] addSubview:buttons_view_]; + } exiting_fullscreen_ = true; RedrawTrafficLights(); }