Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d4fa89ab44bce81fa25269d46b955777dd1804fb
      
https://github.com/WebKit/WebKit/commit/d4fa89ab44bce81fa25269d46b955777dd1804fb
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

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

  Log Message:
  -----------
  visualViewport.scale() should be 1 at the default scale when using automatic 
view scale adjustment
https://bugs.webkit.org/show_bug.cgi?id=275260

Reviewed by Aditya Keerthi.

Report a `visualViewport.scale()` of 1 at the default scale (i.e. without any 
explicit user scaling)
when automatic view scale adjustments are enabled.

For context, the idea of applying a layout size scale factor is that WebKit can 
take the normal
minimum layout size it would've used, scale those dimensions by an arbitrary 
amount, perform layout
using those scaled dimensions, and finally scale down (or up) to fit the real 
view dimensions when
computing initial scale.

Without this change, `scale()` reports the actual page scale factor, which may 
not be equal to 1 (by
default) when `automaticallyAdjustsViewScaleUsingMinimumEffectiveDeviceWidth` 
is enabled. This
causes the entire page to be clipped on certain websites, where the result of
`(visualViewport.width * visualViewport.scale)` is used to compute an 
"effective layout width which
is used to size the rest of the webpage.

Mitigate this by pretending to be `scale=1` in this case, such that the result 
of `width * scale`
can no longer be used to infer the real size of the web view, and we can 
properly scale up to fit
the webpage to the view without clipping the page.

* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::baseViewportLayoutSizeScaleFactor const):

Add a chrome client hook to ask for the current base layout size scale factor, 
so that we can adjust
the scale factor reported by `visualViewport.scale()` by this amount. See above.

* Source/WebCore/page/VisualViewport.cpp:
(WebCore::VisualViewport::update):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::baseViewportLayoutSizeScaleFactor const):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::baseViewportLayoutSizeScaleFactor const):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationViewLayoutSize):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to