Skip to content

Commit

Permalink
[visionOS] Safari can become unresponsive to pinches/gestures after e…
Browse files Browse the repository at this point in the history
…xiting fullscreen

https://bugs.webkit.org/show_bug.cgi?id=268970
rdar://121572842

Reviewed by Wenson Hsieh.

Hit-test redirection is applied by the system whenever a view controller with
a custom presentation style, such as WebKit's fullscreen view controller, is
presented.

Unlike on iOS, WebKit does not explicitly dismiss the view controller, since
window hiding is used for the exit transition. In most cases, this is fine,
since the `UIWindow` will also be deallocated on exit. However, there is no
guarantee that `UIWindow` deallocation will occur, and its object lifetime
cannot be relied upon for correctness. In this case, the system will still
attempt to redirect hit-testing to the presented view controller. Consequently,
pinches and gestures may get redirected to a hidden view controller, rather
than the visible Safari window, resulting in unresponsiveness.

Fix by explicitly dismissing the presented view controller on fullscreen exit.
In the longer term, hit-test redirection logic should be updated by the system,
to avoid hidden windows. However, as that is a riskier change, and dismissing
the fullscreen view controller is good cleanup, that is the immediate solution.

* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController _performSpatialFullScreenTransition:completionHandler:]):

Canonical link: https://commits.webkit.org/274309@main
  • Loading branch information
pxlcoder committed Feb 8, 2024
1 parent 9f2facf commit db96b72
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,9 @@ - (void)_performSpatialFullScreenTransition:(BOOL)enter completionHandler:(Compl

for (MRUIPlatterOrnament *ornament in [originalState ornamentProperties])
ornament.offset2D = [[[originalState ornamentProperties] objectForKey:ornament] offset2D];

// Dismiss the fullscreen view controller on exit to ensure hit-test redirection does not occur.
[controller->_fullscreenViewController dismissViewControllerAnimated:NO completion:nil];
}

scene.mrui_placement.preferredChromeOptions = [originalState sceneChromeOptions];
Expand Down

0 comments on commit db96b72

Please sign in to comment.