[webkit-changes] [WebKit/WebKit] e82dfc: [iOS] Adjust the bindings-exposed screen size in h...

Wenson Hsieh noreply at github.com
Thu May 18 06:56:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e82dfc6a2175995d6e92081192b7cbd8faaa0ce4
      https://github.com/WebKit/WebKit/commit/e82dfc6a2175995d6e92081192b7cbd8faaa0ce4
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-05-18 (Thu, 18 May 2023)

  Changed paths:
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] Adjust the bindings-exposed screen size in headless browser mode
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




More information about the webkit-changes mailing list