[webkit-changes] [WebKit/WebKit] 85d3ed: [iPadOS] Google search results page may be clipped...

Wenson Hsieh noreply at github.com
Mon Aug 28 14:53:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 85d3ed836d99c5f7e065ae5fe43ac1e44d73e2fc
      https://github.com/WebKit/WebKit/commit/85d3ed836d99c5f7e065ae5fe43ac1e44d73e2fc
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-08-28 (Mon, 28 Aug 2023)

  Changed paths:
    A LayoutTests/fast/viewport/ios/wide-desktop-viewport-in-enhanced-windowing-mode-expected.txt
    A LayoutTests/fast/viewport/ios/wide-desktop-viewport-in-enhanced-windowing-mode.html
    M Source/WebCore/page/ViewportConfiguration.cpp
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/WebKitTestRunner/TestController.h
    M Tools/WebKitTestRunner/TestOptions.cpp
    M Tools/WebKitTestRunner/TestOptions.h
    M Tools/WebKitTestRunner/ios/TestControllerIOS.mm

  Log Message:
  -----------
  [iPadOS] Google search results page may be clipped in portrait mode with stage manager enabled
https://bugs.webkit.org/show_bug.cgi?id=260773
rdar://109158566

Reviewed by Tim Horton.

When stage manager is enabled (i.e. `-[UIWindowScene _enhancedWindowingEnabled]` is `YES`) and we're
loading desktop-class websites with no meta viewport, our viewport configuration strategy is:

1.  If the web view is wider than 980 pt, shrink to fit the view.
2.  If the web view is narrower than 980 pt, shrink to fit 980 pt, and then let the rest of the page
    overflow horizontally. This was devised as a way to avoid extremely awkward viewport sizing
    behaviors when resizing windows on iPad to very narrow widths in stage manager, since the entire
    page would be scaled down so much, that it would be left with no legible text.

To achieve (2), 250431 at main adjusted some logic when shrinking the viewport to fit, so that we'd
shrink down to fit 980 pt instead of the actual view width when computing the initial scale, when
the stage manager window is smaller than 980 pt. However, this means that on some models of iPad
where portrait mode is as narrow as 820 pt, we get horizontal scrolling in portrait mode, even when
Safari is fullscreen. At the same time, shrinking down to 980 pt also breaks layout on Google search
results, due to (what appears to be) an issue with the site itself when determining which search
results layout to use.

To mitigate both the horizontal scrolling and the site issue on Google search results for now,
simply adjust the (arbitrarily chosen) desktop viewport width of 980 to 820, which is the width of
the narrowest iPad in portrait mode that currently supports Stage Manager, iPad Air (5th gen).

Test: fast/viewport/ios/wide-desktop-viewport-in-enhanced-windowing-mode.html

* LayoutTests/fast/viewport/ios/wide-desktop-viewport-in-enhanced-windowing-mode-expected.txt: Added.
* LayoutTests/fast/viewport/ios/wide-desktop-viewport-in-enhanced-windowing-mode.html: Added.

Add a layout test that enables stage manager and desktop-class website viewport behaviors, to verify
that we shrink a very wide webpage (1280pt) down to 820, and let the remainder overflow
horizontally. Note that this test runs and yields the same results on both iPhone and iPad, since
it doesn't matter what the actual viewport length is — as long as it's below 820pt. Running this on
iPhone effectively simulates changing the stage manager window width on iPad to the narrowest
possible setting, and verifying that it scrolls horizontally instead of scaling down to comically
small proportions.

* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::initialScaleFromSize const):
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _isWindowResizingEnabled]):

Drive-by fix: remove a runtime selector check that's no longer required.

* Tools/WebKitTestRunner/TestController.h:
* Tools/WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* Tools/WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::enhancedWindowingEnabled const):

Add a mechanism to simulate stage manager being enabled, by swizzling `-_enhancedWindowingEnabled`
and returning `YES`.

* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(overrideEnhancedWindowingEnabled):
(WTR::TestController::platformResetStateToConsistentValues):

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




More information about the webkit-changes mailing list