diff --git a/patches/series b/patches/series index ebc739d9..698c4028 100644 --- a/patches/series +++ b/patches/series @@ -2,6 +2,7 @@ upstream-fixes/missing-dependencies.patch upstream-fixes/fix-crash-without-enterprise-cloud-content-analysis.patch upstream-fixes/fix-python-codecs-deprecation.patch upstream-fixes/fix-macos-widget-rect.patch +upstream-fixes/fix-macos-fullscreen-ui-breakage.patch contrib/inox-patchset/fix-building-without-safebrowsing.patch contrib/inox-patchset/disable-autofill-download-manager.patch diff --git a/patches/upstream-fixes/fix-macos-fullscreen-ui-breakage.patch b/patches/upstream-fixes/fix-macos-fullscreen-ui-breakage.patch new file mode 100644 index 00000000..0be79658 --- /dev/null +++ b/patches/upstream-fixes/fix-macos-fullscreen-ui-breakage.patch @@ -0,0 +1,130 @@ +From 1e69bde8508191f45357b8c027bcd63a58d9ea8d Mon Sep 17 00:00:00 2001 +From: Dana Fried +Date: Fri, 31 Oct 2025 11:49:22 -0700 +Subject: [PATCH] [Browser Frame] Abandon reading Mac caption button positions + +These were not reliable during fullscreen transitions in a way that was +not possible to accurately filter out. This now uses the old fallback +hard-coded constants that were being used in all PWA windows anyway. + +Include-Ci-Only-Tests: chromium.mac:mac15-x64-rel-tests|browser_tests +Bug: 453717426 +Change-Id: Id102a321834c3dac0f56edcacda933c88db0b82a +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7107360 +Reviewed-by: Darryl James +Commit-Queue: Dana Fried +Cr-Commit-Position: refs/heads/main@{#1538756} +--- + +--- a/chrome/browser/ui/views/frame/browser_frame_view_mac.h ++++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.h +@@ -90,9 +90,6 @@ class BrowserFrameViewMac : public Brows + FRIEND_TEST_ALL_PREFIXES(BrowserFrameViewMacTest, + GetCaptionButtonPlaceholderBounds); + +- // Fetches the caption button bounds from the buttons themselves. +- BoundsAndMargins GetCaptionButtonBoundsNative() const; +- + // Creates an inset from the caption button size which controls for which edge + // the captions buttons exists on. Used to position elements like the tabstrip + // that are adjacent to the caption buttons. +--- a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm ++++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm +@@ -458,96 +458,9 @@ void BrowserFrameViewMac::PaintChildren( + } + + BrowserFrameViewMac::BoundsAndMargins +-BrowserFrameViewMac::GetCaptionButtonBoundsNative() const { +- BoundsAndMargins result; +- +- // Verify that this is not an out-of-process window. +- const auto native_window = GetWidget()->GetNativeWindow(); +- if (auto* const host = +- views::NativeWidgetMacNSWindowHost::GetFromNativeWindow( +- native_window); +- host && host->application_host()) { +- return result; +- } +- +- // Verify that there is a valid NSWindow. +- NSWindow* ns_window = native_window.GetNativeNSWindow(); +- if (!ns_window) { +- return result; +- } +- +- // Build a list of caption button bounds. +- std::vector button_rects; +- +- // Also track some other data that will be useful for calculating the visual +- // margins of the buttons against the window border. +- float min_x = width(); +- float max_x = 0; +- float min_y = height(); +- +- // Chrome coordinates are reversed in RTL but not in the Mac API, so we might +- // have to flip them. +- const bool is_rtl = base::i18n::IsRTL(); +- +- // Build the list. If any of the buttons are not present or are zero size, +- // abort (this will fall back to previous hard-coded values). +- for (NSButton* button : +- {[ns_window standardWindowButton:NSWindowCloseButton], +- [ns_window standardWindowButton:NSWindowMiniaturizeButton], +- [ns_window standardWindowButton:NSWindowZoomButton]}) { +- if (!button) { +- return result; +- } +- NSRect ns_rect = [button convertRect:[button bounds] toView:nil]; +- +- // When converting from Mac to Chrome coordinates: +- // - Y axis is inverted (Mac coordinates start at bottom-left). +- // - X axis is inverted in RTL mode only (Mac coordinates are invariant +- // while Chrome reverses them). +- button_rects.emplace_back( +- is_rtl ? width() - (ns_rect.origin.x + ns_rect.size.width) +- : ns_rect.origin.x, +- height() - (ns_rect.origin.y + ns_rect.size.height), ns_rect.size.width, +- ns_rect.size.height); +- const auto& rect = button_rects.back(); +- if (rect.IsEmpty()) { +- return result; +- } +- min_x = std::min(min_x, rect.x()); +- max_x = std::max(max_x, rect.right()); +- min_y = std::min(min_y, rect.y()); +- } +- +- // Calculate the margins that the buttons are using. +- const float block_margin = min_y; +- const float inline_margin = +- CaptionButtonsOnLeadingEdge() ? min_x : width() - max_x; +- +- // Accumulate the button bounds. +- for (const auto& rect : button_rects) { +- result.bounds.Union(rect); +- } +- +- // Apply the margins on the exterior of the region, so that the padding around +- // the buttons appears visually symmetrical. +- result.margins = gfx::OutsetsF::VH(block_margin, inline_margin); +- +- return result; +-} +- +-BrowserFrameViewMac::BoundsAndMargins + BrowserFrameViewMac::GetCaptionButtonBounds() const { +- BoundsAndMargins result = GetCaptionButtonBoundsNative(); +- if (!result.bounds.IsEmpty()) { +- return result; +- } ++ BoundsAndMargins result; + +- // If that doesn't work, fall back to some hard-coded constants. These will +- // apply for app windows, since the app is out of process and the caption +- // buttons can't be retrieved. Note that the app window actually positions its +- // buttons slightly differently from a standard browser window (it's unclear +- // why). +- // + // These are empirically determined; feel free to change them if they're + // not precise. + if (@available(macOS 26, *)) {