fix_put_nsvisualeffectview_before_viewscompositorsuperview.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Micha=C5=82=20Pichli=C5=84ski?=
  3. <[email protected]>
  4. Date: Tue, 29 Oct 2024 21:16:29 +0100
  5. Subject: fix: Put NSVisualEffectView before ViewsCompositorSuperview
  6. Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/6030552
  7. Otherwise when using `vibrancy` in `BrowserWindow` NSVisualEffectView
  8. will hide content displayed by the compositor.
  9. diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
  10. index 07c3997e6565cf77362ee73959c4d21da4fefe96..3353a7847df90b58eec34ea4d6ff8fb19617f5cc 100644
  11. --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
  12. +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
  13. @@ -223,8 +223,19 @@ NSComparisonResult SubviewSorter(__kindof NSView* lhs,
  14. void* rank_as_void) {
  15. DCHECK_NE(lhs, rhs);
  16. - if ([lhs isKindOfClass:[ViewsCompositorSuperview class]])
  17. +
  18. + // Put NSVisualEffectView before ViewsCompositorSuperview otherwise when using
  19. + // `vibrancy` in `BrowserWindow` NSVisualEffectView will hide content
  20. + // displayed by the compositor.
  21. + if ([lhs isKindOfClass:[NSVisualEffectView class]]) {
  22. return NSOrderedAscending;
  23. + }
  24. + if ([lhs isKindOfClass:[ViewsCompositorSuperview class]]) {
  25. + if ([rhs isKindOfClass:[NSVisualEffectView class]]) {
  26. + return NSOrderedDescending;
  27. + }
  28. + return NSOrderedAscending;
  29. + }
  30. const RankMap* rank = static_cast<const RankMap*>(rank_as_void);
  31. auto left_rank = rank->find(lhs);