Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS 16] All layout tests in fast/events/ios/rotation time out #1957

Merged
merged 1 commit into from Jun 30, 2022

Conversation

whsieh
Copy link
Member

@whsieh whsieh commented Jun 30, 2022

b751dd0

[iOS 16] All layout tests in fast/events/ios/rotation time out
https://bugs.webkit.org/show_bug.cgi?id=242199
rdar://93784344

Reviewed by Devin Rousso and Tim Horton.

For all apps linked on or after iOS 16, `-[UIDevice setOrientation:animated:]` is a no-op; this
causes all layout tests that attempt to simulate rotation (i.e., all the tests inside
fast/events/ios/rotation) to time out while waiting for the web view to resize during rotation.

In its place, UIKit has added `-[UIWindowScene requestGeometryUpdateWithPreferences:errorHandler:]`,
which can be used to request a scene-level transition to one or more requested interface
orientations; fix these failing layout tests by adopting this API instead on iOS 16.

* Source/WTF/wtf/PlatformHave.h:

Add a new build-time flag to guard the availability of the new UIKit API.

* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::restorePortraitOrientationIfNeeded):
(WTR::TestController::platformResetStateToConsistentValues):

Additionally refactor logic for restoring device orientation to portrait mode between tests, so that
it's also compatible with iOS 16.

* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::simulateRotation):
(WTR::UIScriptControllerIOS::simulateRotationLikeSafari):

Factor out common logic into a private helper method; use `-requestGeometryUpdateWithPreferences:`
on iOS 16, and fall back to `-setOrientation:animated:` elsewhere.

(WTR::toWindowSceneGeometryPreferences):
(WTR::toUIDeviceOrientation):

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

@whsieh whsieh requested a review from JonWBedard as a code owner June 30, 2022 19:26
@whsieh whsieh self-assigned this Jun 30, 2022
@whsieh whsieh added Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases WebKit Nightly Build labels Jun 30, 2022
@whsieh
Copy link
Member Author

whsieh commented Jun 30, 2022

(Note that these tests will fail with text diffs after these changes, but for other reasons — some of them, for example, hard-code the iPhone 8 screen width/height in the test, or in test expectations. However, these failures are not specific to iOS 16).

@@ -1256,9 +1256,14 @@
#define HAVE_VK_IMAGE_TRANSLATION_SUPPORT 1
#endif

#if !defined(HAVE_UIKIT_RESIZABLE_WINDOWS) && PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000
#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000
#if !defined(HAVE_UIKIT_RESIZABLE_WINDOWS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Is checking !defined really necessary here? Most other things in this file don't seem to bother 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything in the style guidelines (or webkit-dev) about this 🤷🏻‍♂️

@whsieh whsieh added the merge-queue Applied to send a pull request to merge-queue label Jun 30, 2022
https://bugs.webkit.org/show_bug.cgi?id=242199
rdar://93784344

Reviewed by Devin Rousso and Tim Horton.

For all apps linked on or after iOS 16, `-[UIDevice setOrientation:animated:]` is a no-op; this
causes all layout tests that attempt to simulate rotation (i.e., all the tests inside
fast/events/ios/rotation) to time out while waiting for the web view to resize during rotation.

In its place, UIKit has added `-[UIWindowScene requestGeometryUpdateWithPreferences:errorHandler:]`,
which can be used to request a scene-level transition to one or more requested interface
orientations; fix these failing layout tests by adopting this API instead on iOS 16.

* Source/WTF/wtf/PlatformHave.h:

Add a new build-time flag to guard the availability of the new UIKit API.

* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::restorePortraitOrientationIfNeeded):
(WTR::TestController::platformResetStateToConsistentValues):

Additionally refactor logic for restoring device orientation to portrait mode between tests, so that
it's also compatible with iOS 16.

* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::simulateRotation):
(WTR::UIScriptControllerIOS::simulateRotationLikeSafari):

Factor out common logic into a private helper method; use `-requestGeometryUpdateWithPreferences:`
on iOS 16, and fall back to `-setOrientation:animated:` elsewhere.

(WTR::toWindowSceneGeometryPreferences):
(WTR::toUIDeviceOrientation):

Canonical link: https://commits.webkit.org/252016@main
@webkit-commit-queue
Copy link
Collaborator

Committed 252016@main (b751dd0): https://commits.webkit.org/252016@main

Reviewed commits have been landed. Closing PR #1957 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit b751dd0 into WebKit:main Jun 30, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 30, 2022
@whsieh whsieh deleted the eng/242199 branch July 8, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases
Projects
None yet
5 participants