Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e82dfc6a2175995d6e92081192b7cbd8faaa0ce4
      
https://github.com/WebKit/WebKit/commit/e82dfc6a2175995d6e92081192b7cbd8faaa0ce4
  Author: Wenson Hsieh <[email protected]>
  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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to