Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 735e4235a2dedc7d662436831d96d28d57a40d05
https://github.com/WebKit/WebKit/commit/735e4235a2dedc7d662436831d96d28d57a40d05
Author: Aditya Keerthi <[email protected]>
Date: 2026-02-05 (Thu, 05 Feb 2026)
Changed paths:
M Source/WebKit/UIProcess/PageClient.h
M
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.h
M
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm
M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Source/WebKit/UIProcess/ios/WKContentView.h
M Source/WebKit/UIProcess/ios/WKContentView.mm
Log Message:
-----------
[iOS] Rendering updates may not happen when `WKWebView` moves between screens
https://bugs.webkit.org/show_bug.cgi?id=307005
rdar://169659972
Reviewed by Wenson Hsieh.
`-[CADisplayLink displayLinkWithTarget:selector:]` creates a display link
associated with the "main screen" (`-[UIScreen mainScreen]` in UIKit). It is
possible that the `CADisplayLink` associated with the main screen is paused
by the system. In these scenarios, the display link created in
`WKDisplayLinkHandler`
stops triggering, preventing rendering updates from occurring.
To fix, create a new display link associated with the screen the web view is
currently on. This is achieved using `-[UIScreen
displayLinkWithTarget:selector:]`,
ensuring the used display link is active and rendering updates occur.
* Source/WebKit/UIProcess/PageClient.h:
*
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.h:
*
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm:
(-[WKDisplayLinkHandler initWithDrawingAreaProxy:]):
(-[WKDisplayLinkHandler windowScreenDidChange]):
If the current screen is equal to the screen that created the display link,
avoid
recreation. Additionally, skip recreation is the current screen is the main
screen.
This can be done since `-[CADisplayLink displayLinkWithTarget:selector:]` vends
a display link associated with the main screen.
(-[WKDisplayLinkHandler _screenForDisplayLink]):
(-[WKDisplayLinkHandler _createDisplayLink]):
(WebKit::RemoteLayerTreeDrawingAreaProxyIOS::windowScreenDidChange):
`PlatformDisplayID` is not meaningful on iOS. `UIScreen`s do not have an
identifier.
Use `m_displayLinkHandler` rather than `displayLinkHandler()` to avoid
unnecessary
creation.
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::screen):
* Source/WebKit/UIProcess/ios/WKContentView.h:
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _updateForScreen:]):
Whenever the web view is moved/added to a screen, inform `WebPageProxy` and
the `DrawingAreaProxy`.
(-[WKContentView _screen]):
The screen is stored as a weak instance variable. This is necessary since WebKit
may first be informed of the screen in `-[WKContentView willMoveToWindow]`. In
this case, the `WKContentView`'s window may still be `nil`, resulting in an
inability to get the scene outside of the notification.
Canonical link: https://commits.webkit.org/306881@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications