[webkit-changes] [WebKit/WebKit] 524f1b: Initial scale of a page is not respected when both...

Abrar Rahman Protyasha noreply at github.com
Thu Jul 6 09:09:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 524f1bcc6830730eb57dc4458b500f1f4f051e2e
      https://github.com/WebKit/WebKit/commit/524f1bcc6830730eb57dc4458b500f1f4f051e2e
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2023-07-06 (Thu, 06 Jul 2023)

  Changed paths:
    R LayoutTests/fast/viewport/ios/adjust-fixed-width-and-initial-scale-to-avoid-excessive-zooming.html
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/ios/Viewport.mm

  Log Message:
  -----------
  Initial scale of a page is not respected when both initial scale and viewport width are set
https://bugs.webkit.org/show_bug.cgi?id=258663
rdar://111515914

Reviewed by Wenson Hsieh.

In 256476 at main, we introduce a viewport sizing heuristic to clamp the
maximum initial scale of a page. This was necessitated by Wikipedia's
dynamic initial scale assignment (to maintain their viewport width
invariant of 1000) leading to Wiki articles being excessively zoomed in
on large screens (such as when an iPad is connected to an external
display).

However, the somewhat arbitrarily chosen initial scale cap of 1.2 leads
to a sub-optimal web development experience because we perform the
initial scale clamping on every page (when the `IgnoreMetaViewport` is
enabled), meaning it isn't clear why the initial scale is not being
respected, even when a developer may have had a valid use-case.

To mitigate this situation, we only apply this initial scale clamping as
a quirk for pages on the "wikipedia.org" domain. This is a relatively
safe decision given that Wikipedia is probably the only top site that
performs a dynamic initial scale assignment (that too with potentially
*large* scale values).

We also introduce an API test to assert this behavior is only limited to
Wikipedia.

* LayoutTests/fast/viewport/ios/adjust-fixed-width-and-initial-scale-to-avoid-excessive-zooming.html: Removed.

This layout test is no longer valid.

* Source/WebCore/page/Quirks.cpp:
(WebCore::isWikipediaDomain):
(WebCore::Quirks::shouldIgnoreViewportArgumentsToAvoidExcessiveZoom const):
(WebCore::Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints const):
* Source/WebCore/page/Quirks.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::setCanIgnoreViewportArgumentsToAvoidExcessiveZoomIfNeeded):
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::updateWebsitePolicies):
* Tools/TestWebKitAPI/Tests/ios/Viewport.mm:
(TestWebKitAPI::makeViewportMetaTag):
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list