[webkit-changes] [WebKit/WebKit] 3d721c: REGRESSION (UI-side compositing): Jumpy full scree...

Richard Robinson noreply at github.com
Mon Jul 24 17:38:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d721c09585b37b63eb4172c53ab61da282d2c3e
      https://github.com/WebKit/WebKit/commit/3d721c09585b37b63eb4172c53ab61da282d2c3e
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2023-07-24 (Mon, 24 Jul 2023)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebKit/Platform/spi/mac/AppKitSPI.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/mac/WKView.mm
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M Source/WebKit/UIProcess/mac/WKViewLayoutStrategy.h
    M Source/WebKit/UIProcess/mac/WKViewLayoutStrategy.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm

  Log Message:
  -----------
  REGRESSION (UI-side compositing): Jumpy full screen transition animation
https://bugs.webkit.org/show_bug.cgi?id=259375
rdar://111534888

Reviewed by Wenson Hsieh.

With UI-side compositing, when entering or exiting window fullscreen mode, the transition is
sometimes jumpy. This happens in cases where the UI process resizes before the web content has a
chance to resize. The web content and the UI Process should always resize in the same CA commit.

Fix by adopting an AppKit SPI to defer entering or exiting window fullscreen mode until the web
content has actually been resized to the new size. This is done by using a "window snapshot readiness handler".

* Source/WTF/wtf/PlatformHave.h:
Add a new `HAVE` definition to only enable this on macOS, and only on versions where the SPI exists.

* Source/WebKit/Platform/spi/mac/AppKitSPI.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView dealloc]):
(-[WKWebView _invalidateWindowSnapshotReadinessHandler]):
Invokes the readiness handler and then resets it, indicating to AppKit that the full screen should
be allowed to resume.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/mac/WKView.mm:
(-[WKView _web_windowWillEnterFullScreen]):
(-[WKView _web_windowWillExitFullScreen]):
Stub methods required to compile legacy WebKit.

* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _doWindowSnapshotReadinessUpdate]):
(-[WKWebView setFrameSize:]):
When `setFrameSize` gets called with the new frame size, the UI process waits for the next presentation
update of the web prcoess. Once in the completion handler, we know that the web content has properly
resized, and so we should now invalidate the readiness handler.

(-[WKWebView _web_windowWillEnterFullScreen]):
(-[WKWebView _web_windowWillExitFullScreen]):
Upon receiving one of these notifications, we take out a window snapshot readiness handler and store
it. This tells AppKit to defer the final stage of the enter and exit full screen animations until
the handler is invoked.

* Source/WebKit/UIProcess/mac/WKViewLayoutStrategy.h:
* Source/WebKit/UIProcess/mac/WKViewLayoutStrategy.mm:
(-[WKViewLayoutStrategy disableFrameSizeUpdates]):
(-[WKViewLayoutStrategy enableFrameSizeUpdates]):
(-[WKViewLayoutStrategy frameSizeUpdatesDisabled]):
(-[WKViewLayoutStrategy didChangeFrameSize]):
In some cases, `setFrameSize` would early return inside of `didChangeFrameSize` due to these set of
methods. This caused the bug to still reproduce, since the new drawing area size was no longer being set.

These methods have long been not actually needed, so their implementations are now removed and there is
no longer a need for an early return.

* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(-[WKWindowVisibilityObserver startObserving:]):
(-[WKWindowVisibilityObserver stopObserving:]):
(-[WKWindowVisibilityObserver _windowWillEnterFullScreen:]):
(-[WKWindowVisibilityObserver _windowWillExitFullScreen:]):
(WebKit::WebViewImpl::windowWillEnterFullScreen):
(WebKit::WebViewImpl::windowWillExitFullScreen):
When entering or exiting full screen, we now listen to their respective notifications.

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




More information about the webkit-changes mailing list