From 1f11ce87008665fc3a9b7c57336fb98ac860723a Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 30 Jun 2023 16:53:17 +0300 Subject: [PATCH] chrome: mac: Keep bubble popups on-screen --- patch/patch.cfg | 5 ++++ .../mac_platform_style_bubble_893292.patch | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 patch/patches/mac_platform_style_bubble_893292.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index 2e1031542..ba7ffa891 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -639,5 +639,10 @@ patches = [ # win/linux: Fix rounding errors with Screen[Win] DIP/pixel conversions. # https://bugs.chromium.org/p/chromium/issues/detail?id=1443650#c18 'name': 'screen_1443650' + }, + { + # mac: Keep bubble popups on-screen. + # https://bugs.chromium.org/p/chromium/issues/detail?id=893292#c10 + 'name': 'mac_platform_style_bubble_893292' } ] diff --git a/patch/patches/mac_platform_style_bubble_893292.patch b/patch/patches/mac_platform_style_bubble_893292.patch new file mode 100644 index 000000000..bf23dbf2c --- /dev/null +++ b/patch/patches/mac_platform_style_bubble_893292.patch @@ -0,0 +1,28 @@ +diff --git chrome/browser/ui/views/profiles/profile_menu_view_base.cc chrome/browser/ui/views/profiles/profile_menu_view_base.cc +index 4e887ec33d100..67af3165246e5 100644 +--- chrome/browser/ui/views/profiles/profile_menu_view_base.cc ++++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc +@@ -991,8 +991,8 @@ int ProfileMenuViewBase::GetMaxHeight() const { + ->GetDisplayNearestPoint(anchor_rect.CenterPoint()) + .work_area(); + int available_space = screen_space.bottom() - anchor_rect.bottom(); +-#if BUILDFLAG(IS_WIN) +- // On Windows the bubble can also be show to the top of the anchor. ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) ++ // On Windows and macOS the bubble can also be show to the top of the anchor. + available_space = + std::max(available_space, anchor_rect.y() - screen_space.y()); + #endif +diff --git ui/views/style/platform_style_mac.mm ui/views/style/platform_style_mac.mm +index 256bde37abf47..9ddfa6fc59f0a 100644 +--- ui/views/style/platform_style_mac.mm ++++ ui/views/style/platform_style_mac.mm +@@ -43,7 +43,7 @@ const bool PlatformStyle::kTableViewSupportsKeyboardNavigationByCell = false; + const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; + const bool PlatformStyle::kUseRipples = false; + const bool PlatformStyle::kInactiveWidgetControlsAppearDisabled = true; +-const bool PlatformStyle::kAdjustBubbleIfOffscreen = false; ++const bool PlatformStyle::kAdjustBubbleIfOffscreen = true; + const View::FocusBehavior PlatformStyle::kDefaultFocusBehavior = + View::FocusBehavior::ACCESSIBLE_ONLY; +