Bug 209372 - Adopt -[UIWindowScene interfaceOrientation] when determining device orientation
Summary: Adopt -[UIWindowScene interfaceOrientation] when determining device orientation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-20 21:38 PDT by Wenson Hsieh
Modified: 2020-03-22 12:29 PDT (History)
5 users (show)

See Also:


Attachments
Patch (6.87 KB, patch)
2020-03-21 16:26 PDT, Wenson Hsieh
darin: review+
Details | Formatted Diff | Diff
Patch for landing (6.87 KB, patch)
2020-03-22 12:05 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2020-03-20 21:38:47 PDT
<rdar://problem/60491857>
Comment 1 Wenson Hsieh 2020-03-21 16:26:31 PDT
Created attachment 394183 [details]
Patch
Comment 2 Darin Adler 2020-03-22 09:52:52 PDT
Comment on attachment 394183 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394183&action=review

How can we make an automated test for this?

> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:229
> +    auto *application = UIApplication.sharedApplication;

Just auto would be better. Let’s dodge the * placement issue.

> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:234
> +    else if (auto *windowScene = self.window.windowScene)

Ditto.
Comment 3 Wenson Hsieh 2020-03-22 12:00:19 PDT
Comment on attachment 394183 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394183&action=review

I considered writing an API test for this that would mock out -_appAdoptsUISceneLifecycle to return YES, but I don't think such a test would be very useful. Generally, writing an API test for this is tricky, because TestWebKitAPI isn't even a UI application on iOS, and so the UIApplication, windows, and their window scenes would all need to be mocked by the test.

I think when we eventually convert WebKitTestRunnerApp into a scene-based UIApplication, we'll be able to get test coverage for this codepath.

>> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:229
>> +    auto *application = UIApplication.sharedApplication;
> 
> Just auto would be better. Let’s dodge the * placement issue.

Sounds good — changed to just auto.

>> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:234
>> +    else if (auto *windowScene = self.window.windowScene)
> 
> Ditto.

Changed to just auto.
Comment 4 Wenson Hsieh 2020-03-22 12:05:28 PDT
Created attachment 394222 [details]
Patch for landing
Comment 5 EWS 2020-03-22 12:29:44 PDT
Committed r258821: <https://trac.webkit.org/changeset/258821>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394222 [details].