[webkit-changes] [WebKit/WebKit] 7e8c76: Unable to enter fullscreen in Counterstrike (http:...

aestes noreply at github.com
Tue Oct 10 10:11:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e8c765bf94d37bbbf56c279c81b63957cb88fff
      https://github.com/WebKit/WebKit/commit/7e8c765bf94d37bbbf56c279c81b63957cb88fff
  Author: Andy Estes <aestes at apple.com>
  Date:   2023-10-10 (Tue, 10 Oct 2023)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.html
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm

  Log Message:
  -----------
  Unable to enter fullscreen in Counterstrike (http://game.play-cs.com) in Safari 16.3
https://bugs.webkit.org/show_bug.cgi?id=251648
rdar://104984915

Reviewed by Jer Noble.

When entering fullscreen, WKFullScreenWindowController calls
WebPageProxy::setSuppressVisibilityUpdates to suppress visibility updates while the web view moves to
the new fullscreen window, since updating visibility is unnecessary when transitioning to fullscreen
and can even cause bugs (see the comment in -[WKFullScreenWindowController enterFullScreen:]). It
ends suppression in -beganEnterFullScreenWithInitialFrame:finalFrame: and schedules an activity
state update, but this occurs at a time when AppKit considers the fullscreen window to be occluded.
As a result a `visibilitychange` event is dispatched where `document.visibilityState == 'hidden'`,
and play-cs.com responds to this event by exiting fullscreen. The upshot is that the user cannot
stay in fullscreen as the page exits this mode as soon as the user enters it.

Resolved this by extending the period where visibility updates are suppressed to when
-finishedEnterFullScreenAnimation: is called. At this point AppKit no longer considers the
fullscreen window to be occluded, so WebPageProxy detects no change in activity state and does not
dispatch any `visibilitychange` events. This matches the behavior of Firefox and Chrome on macOS,
which also do not dispatch `visiblitychange` events when entering fullscreen.

Added an API test.

* Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.html:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm:
(-[FullscreenDelegateMessageHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/269150@main




More information about the webkit-changes mailing list