Repository navigation
fix: re-enable MacWebContentsOcclusion with embedder window fix - #50579
Conversation
Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews.
The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about.
748baaf to
572f42e
Compare
… window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
|
Release Notes Persisted
|
|
I was unable to backport this PR to "42-x-y" cleanly; |
|
I was unable to backport this PR to "40-x-y" cleanly; |
|
I was unable to backport this PR to "41-x-y" cleanly; |
* fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
* fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
* fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
|
@MarshallOfSound has manually backported this PR to "42-x-y", please check out #50712 |
|
@MarshallOfSound has manually backported this PR to "40-x-y", please check out #50713 |
|
@MarshallOfSound has manually backported this PR to "41-x-y", please check out #50715 |
* fix: re-enable MacWebContentsOcclusion with embedder window fix (#50579) * fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow. * fixup: adjust patch offsets for 40-x-y chromium
* fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
* fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
fix: re-enable MacWebContentsOcclusion with embedder window fix (#50579) * fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
fix: re-enable MacWebContentsOcclusion with embedder window fix (#50579) * fix: re-enable MacWebContentsOcclusion with embedder window fix Replace the full revert of Chromium's MacWebContentsOcclusion cleanup with a targeted patch that handles embedder windows shown after WebContentsViewCocoa attachment. This lets us drop the feature flag disable in feature_list.cc and re-enable upstream occlusion tracking. Adds tests for show/hide event counts on macOS and visibility tracking across multiple child WebContentsViews. * test: drop show/hide event count assertion The assertion that 'show' fires exactly once per w.show() call is not an API guarantee - macOS can send multiple occlusion state notifications during a single show() when other windows are on screen (common on CI after hundreds of prior tests). The visibilitychange-count test in api-web-contents-view-spec.ts covers the actual invariant we care about. * fix: ignore WebContentsOcclusionCheckerMac synthetic notifications in window delegate On macOS 13.3-25.x, Chromium's occlusion checker enables manual frame-intersection detection and posts synthetic NSWindowDidChangeOcclusionStateNotification tagged with its class name in userInfo. These fire when the checker's NSContainsRect heuristic decides a window is covered by another window's frame, but the real -[NSWindow occlusionState] hasn't changed. Our delegate was treating these the same as real macOS notifications and emitting show/hide events based on occlusionState, which was unchanged - resulting in spurious duplicate show events when e.g. Quick Look opened and its frame intersected the BrowserWindow.
Replaces the full revert of Chromium's
MacWebContentsOcclusioncleanup (revert_code_health_clean_up_stale_macwebcontentsocclusion.patch) with a targeted patch that handles embedder windows shown afterWebContentsViewCocoaattachment.Previously we carried the revert and force-disabled
kMacWebContentsOcclusioninfeature_list.ccbecause the upstream occlusion checker caused odd visibility behavior with multiple web contents. This PR fixes the root cause instead, so we can drop the revert and re-enable the feature.revert_code_health_clean_up_stale_macwebcontentsocclusion.patchfix_handle_embedder_windows_shown_after_webcontentsviewcocoa_attach.patchkMacWebContentsOcclusiondisable fromshell/browser/feature_list.ccWebContentsViewsCloses #45776
Notes: Fixed an issue on macOS where
show/hideevents andWebContentsvisibility state could be reported incorrectly when multipleWebContentsViews were attached to a window.