chrome: mac: Keep bubble popups on-screen

This commit is contained in:
Marshall Greenblatt 2023-06-30 16:53:17 +03:00
parent 59bfb32221
commit 1f11ce8700
2 changed files with 33 additions and 0 deletions

View File

@ -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'
}
]

View File

@ -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;