[webkit-changes] [WebKit/WebKit] 9a6f00: Add initial support for screen orientation locking...

Chris Dumez noreply at github.com
Wed Oct 12 17:33:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a6f00e09dd1714190585288993b1edb9605b708
      https://github.com/WebKit/WebKit/commit/9a6f00e09dd1714190585288993b1edb9605b708
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-10-12 (Wed, 12 Oct 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/screen-orientation/non-fully-active-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/screen-orientation/non-fully-active.html
    M LayoutTests/imported/w3c/web-platform-tests/screen-orientation/onchange-event.html
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/active-lock-expected.txt
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/event-before-promise-expected.txt
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/lock-basic-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/lock-sandboxed-iframe-expected.txt
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/lock-unlock-check-expected.txt
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/onchange-event-expected.txt
    A LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/onchange-event-subframe-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/screen-orientation/orientation-reading-expected.txt
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/page/ScreenOrientation.cpp
    M Source/WebCore/page/ScreenOrientation.h
    M Source/WebCore/page/ScreenOrientationType.h
    A Source/WebCore/platform/ScreenOrientationManager.cpp
    M Source/WebCore/platform/ScreenOrientationManager.h
    M Source/WebKit/UIProcess/API/APIUIClient.h
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/C/WKPageUIClient.h
    M Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.h
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.cpp
    M Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.h
    M Tools/WebKitTestRunner/TestController.cpp
    M Tools/WebKitTestRunner/TestController.h
    M Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h
    M Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
    M Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
    M Tools/WebKitTestRunner/ios/TestControllerIOS.mm

  Log Message:
  -----------
  Add initial support for screen orientation locking / unlocking
https://bugs.webkit.org/show_bug.cgi?id=246302

Reviewed by Darin Adler.

Add initial support for screen orientation locking / unlocking:
- https://w3c.github.io/screen-orientation/#lock-method
- https://w3c.github.io/screen-orientation/#unlock-method

Locking / Unlocking is now functional in layout tests on iOS simulator,
allowing us to run the WPT tests for this feature.

* LayoutTests/TestExpectations:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/active-lock-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/event-before-promise-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/lock-basic-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/lock-unlock-check-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/onchange-event-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/onchange-event-subframe-expected.txt: Added.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/screen-orientation/orientation-reading-expected.txt: Added.
Rebaseline tests on iOS now that they are properly running.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/ScreenOrientation.cpp:
(WebCore::ScreenOrientation::lock):
(WebCore::ScreenOrientation::unlock): Deleted.
(WebCore::ScreenOrientation::type const): Deleted.
(WebCore::ScreenOrientation::angle const): Deleted.
(WebCore::ScreenOrientation::visibilityStateChanged): Deleted.
(WebCore::ScreenOrientation::shouldListenForChangeNotification const): Deleted.
(WebCore::ScreenOrientation::screenOrientationDidChange): Deleted.
(WebCore::ScreenOrientation::activeDOMObjectName const): Deleted.
(WebCore::ScreenOrientation::suspend): Deleted.
(WebCore::ScreenOrientation::resume): Deleted.
(WebCore::ScreenOrientation::stop): Deleted.
(WebCore::ScreenOrientation::virtualHasPendingActivity const): Deleted.
(WebCore::ScreenOrientation::eventListenersDidChange): Deleted.
* Source/WebCore/page/ScreenOrientation.h:
* Source/WebCore/page/ScreenOrientationType.h:
(WebCore::screenOrientationIsPortait):
(WebCore::screenOrientationIsLandscape):
* Source/WebCore/platform/ScreenOrientationManager.cpp: Copied from Source/WebCore/platform/ios/Device.h.
(WebCore::ScreenOrientationManager::setLockPromise):
(WebCore::ScreenOrientationManager::takeLockPromise):
* Source/WebCore/platform/ScreenOrientationManager.h:
(WebCore::ScreenOrientationManager::~ScreenOrientationManager): Deleted.
* Source/WebCore/platform/ios/Device.h:
* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::lockScreenOrientation):
(API::UIClient::unlockScreenOrientation):
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* Source/WebKit/UIProcess/API/C/WKPageUIClient.h:
* Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::toWKScreenOrientationType):
(WebKit::UIDelegate::UIClient::lockScreenOrientation):
(WebKit::UIDelegate::UIClient::unlockScreenOrientation):
(WebKit::toWKScreenOrientationLockType): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didExitFullscreen):
* Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.cpp:
(WebKit::WebScreenOrientationManagerProxy::~WebScreenOrientationManagerProxy):
(WebKit::resolveScreenOrientationLockType):
(WebKit::WebScreenOrientationManagerProxy::lock):
(WebKit::WebScreenOrientationManagerProxy::unlock):
(WebKit::WebScreenOrientationManagerProxy::screenOrientationDidChange):
(WebKit::WebScreenOrientationManagerProxy::unlockIfNecessary):
* Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::lockScreenOrientationCallback):
(WTR::unlockScreenOrientationCallback):
(WTR::TestController::createWebViewWithOptions):
* Tools/WebKitTestRunner/TestController.h:
* Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView initWithFrame:configuration:]):
(-[TestRunnerWKWebView setSupportedInterfaceOrientations:]):
(-[TestRunnerWKWebView supportedInterfaceOrientations]):
* Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(-[PlatformWebViewController supportedInterfaceOrientations]):
* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::restorePortraitOrientationIfNeeded):
The previous way of restoring portrait orientation caused a UI rotation animation
which could lead to flakiness on the next test. To address the flakiness I now lock
to portrait and then unlock, which gets us in portrait mode without any animation.

(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::lockScreenOrientation):
(WTR::TestController::unlockScreenOrientation):
(WTR::restorePortraitOrientationIfNeeded): Deleted.
Add screen orientation locking / unlocking to WebKitTestRunner on iOS.

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




More information about the webkit-changes mailing list