Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 57ddad105b2faa750dc3c15b4e17b872b71ab0e2
      
https://github.com/WebKit/WebKit/commit/57ddad105b2faa750dc3c15b4e17b872b71ab0e2
  Author: Jessica Cheung <[email protected]>
  Date:   2026-05-20 (Wed, 20 May 2026)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/WindowOrientation.mm

  Log Message:
  -----------
  REGRESSION (302333@main): The window.orientation property incorrectly returns 
0 on initial load in WKWebView regardless of device orientation
https://bugs.webkit.org/show_bug.cgi?id=315120
rdar://175523434

Reviewed by Aditya Keerthi.

Currently, if a device is in landscape mode upon loading a WKWebView,
the window orientation reports as 0, when it should be 90 or -90.

In 302333@main, there is a check for whether a process has
a connection. If so, a message is sent to SetDeviceOrientation.
If not, the code early returns.

Previously, this check was not there and Webkit sent the message
to SetDeviceOrientation unconditionally. Thus the orientation is
updated from the initial 0 to the current orientation. With the check,
this update is dropped by the early return since the process is still
launching and the connection has not been established yet.

So, reinstill the previous behavior of calling SetDeviceOrientation
unconditionally, keeping it for each process. This works because if the process
is still launching, the message to SetDeviceOrientation is stashed away
and sent once the process establishes the connection. If the process is
terminated, nothing happens.

Add a new file for window orientation tests. Test for all orientations.
Previously, there were no tests covering window orientation upon initial
load. Future window orientation related tests can be added to the file.

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setDeviceOrientation):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/WindowOrientation.mm: Added.
(TestWebKitAPI::runWindowOrientationTest):
(TestWebKitAPI::TEST(WindowOrientation, ReflectsLandscapeRightOnLoad)):
(TestWebKitAPI::TEST(WindowOrientation, ReflectsLandscapeLeftOnLoad)):
(TestWebKitAPI::TEST(WindowOrientation, ReflectsPortraitOnLoad)):
(TestWebKitAPI::TEST(WindowOrientation, ReflectsPortraitUpsideDownOnLoad)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to