[webkit-changes] [WebKit/WebKit] 36ed6c: [iPadOS] Wikipedia pages are excessively zoomed in...
Wenson Hsieh
noreply at github.com
Tue Nov 8 21:24:29 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 36ed6c6840cc6882c1b4cb1dd5cc1c283757a597
https://github.com/WebKit/WebKit/commit/36ed6c6840cc6882c1b4cb1dd5cc1c283757a597
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2022-11-08 (Tue, 08 Nov 2022)
Changed paths:
A LayoutTests/fast/viewport/ios/adjust-fixed-width-and-initial-scale-to-avoid-excessive-zooming-expected.txt
A LayoutTests/fast/viewport/ios/adjust-fixed-width-and-initial-scale-to-avoid-excessive-zooming.html
M Source/WebCore/page/ViewportConfiguration.cpp
M Source/WebCore/page/ViewportConfiguration.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
Log Message:
-----------
[iPadOS] Wikipedia pages are excessively zoomed in when viewed in an external display
https://bugs.webkit.org/show_bug.cgi?id=247636
rdar://99448942
Reviewed by Tim Horton.
When loading Wikipedia articles in an external display connected to iPad, the page dynamically sets
the meta viewport content string to `width=1000, initial-scale=3.6` (where the initial scale depends
on how wide the display is — in this example, 3600px wide). This leads to the contents of the
article being excessively zoomed, and difficult to read.
To mitigate this, we add a viewport sizing heuristic to cap the maximum initial scale of the page to
a much more reasonable value (somewhat arbitrarily chosen to be 1.2) in the case where both the
initial scale and viewport width are explicitly set. To keep this fixed-width viewport consistent
with the new initial scale, we also adjust the explicitly-specified viewport width as needed.
In the above example, this would turn the `width=1000, initial-scale=3.6` viewport specified by
Wikipedia into a `width=3000, initial-scale=1.2` viewport on an external display.
Test: fast/viewport/ios/adjust-fixed-width-and-initial-scale-to-avoid-excessive-zooming.html
* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::viewportArgumentValueIsValid):
(WebCore::adjustViewportArgumentsToAvoidExcessiveZooming):
(WebCore::ViewportConfiguration::setViewportArguments):
Adjust viewport arguments after setting them, if needed.
(WebCore::ViewportConfiguration::description const):
* Source/WebCore/page/ViewportConfiguration.h:
Add the new policy bit.
(WebCore::ViewportConfiguration::setCanIgnoreViewportArgumentsToAvoidExcessiveZoom):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::updateWebsitePolicies):
Set the above policy bit in the case where we're loading desktop-class content.
Canonical link: https://commits.webkit.org/256476@main
More information about the webkit-changes
mailing list