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] Adjust the bindings-exposed screen size in headless browser mode #13998
Conversation
EWS run on current version of this PR (hash c958a4c) |
return m_viewportConfiguration.minimumLayoutSize(); | ||
|
||
static constexpr std::array fixedSizes { | ||
FloatSize { 320, 568 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did these values come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values represent device metrics from several iPhone models. While somewhat arbitrary, I did make sure to pick the most prevalent width values, by number of models with that width.
Thanks for the review! |
https://bugs.webkit.org/show_bug.cgi?id=256939 Reviewed by Alan Baradlay. Add different, platform-specific strategies when returning an appropriate screen size for bindings in headless browsing. See below for more details. Changes covered by a new API test (and adjustments to some existing tests). * Source/WebCore/page/ChromeClient.h: (WebCore::ChromeClient::screenSizeForHeadlessMode const): Add a chrome client hook to return a screen size specifically for "headless mode", given the requesting frame and the actual screen size. * Source/WebCore/page/LocalFrame.cpp: (WebCore::LocalFrame::screenSize const): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::screenSizeForHeadlessMode const): Add some plumbing out to `WebPage`. * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::screenSizeForHeadlessMode const): Move the logic currently in `LocalFrame::screenSize` over to this method; additionally, instead of trying to counterscale the innerWidth/innerHeight, simply return the unobscured content rect; this does not change with `pageScaleFactor` on macOS, eliminating the need for counterscaling. * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::screenSizeForHeadlessMode const): Implement an iOS-specific strategy for `screenSizeForHeadlessMode`, returning one of three canned values on iPhone (based on the current user idiom), and falling back to the initial containing block (ignoring the current scale factor, by using `ViewportConfiguration::minimumLayoutSize()`) on iPad. Canonical link: https://commits.webkit.org/264200@main
c958a4c
to
e82dfc6
Compare
Committed 264200@main (e82dfc6): https://commits.webkit.org/264200@main Reviewed commits have been landed. Closing PR #13998 and removing active labels. |
e82dfc6
c958a4c