Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eeee3a57785bca1656e063b64bf9cc6e6b13be63
https://github.com/WebKit/WebKit/commit/eeee3a57785bca1656e063b64bf9cc6e6b13be63
Author: Aditya Keerthi <[email protected]>
Date: 2025-11-11 (Tue, 11 Nov 2025)
Changed paths:
M Source/WebKit/UIProcess/ios/WKContentView.h
M Source/WebKit/UIProcess/ios/WKContentView.mm
M Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
M Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Log Message:
-----------
[iOS] Remove use of `-[UIScreen mainScreen]` in `WKContentView`
https://bugs.webkit.org/show_bug.cgi?id=302298
rdar://164439913
Reviewed by Wenson Hsieh.
`-[UIScreen mainScreen]` was deprecated in iOS 26. Work towards removing its
use in WebKit.
`WKContentView` uses `UIScreen` to determine display scale and scene capture
state. Use equivalent methods on `UITraitCollection` and register for trait
changes, to respond to changes.
* Source/WebKit/UIProcess/ios/WKContentView.h:
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
(-[WKContentView didMoveToWindow]):
Trait changes are triggered (if necessary) when a view moves windows, making
the existing code no longer necessary.
(-[WKContentView intrinsicDeviceScaleFactor]):
`displayScale` can be zero (unspecified). In that case, use
`WebCore::screenScaleFactor` (which still falls back to use of `UIScreen`).
This scenario is not expected to be common, but trait collections can be
overridden by clients.
(-[WKContentView screenIsBeingCaptured]):
(-[WKContentView _updateForScreen:]):
(-[WKContentView _displayScaleDidChange]):
(-[WKContentView _sceneCaptureStateDidChange]):
(-[WKContentView _screenCapturedDidChange:]): Deleted.
* Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView initWithFrame:configuration:]):
Now that the trait collection is used to determine display scale, force a scale
using a trait override.
* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformInitialize):
(WTR::TestController::platformResetStateToConsistentValues):
Canonical link: https://commits.webkit.org/302852@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications