Title: [246852] trunk
- Revision
- 246852
- Author
- [email protected]
- Date
- 2019-06-26 16:10:21 -0700 (Wed, 26 Jun 2019)
Log Message
[iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=199219
<rdar://problem/50425765>
Reviewed by Tim Horton.
Source/WebKit:
Currently, the heuristic to determine whether the page should be shrunk to fit the content width after loading
works by checking whether the page's content is wider than the layout width we've provided for the page.
However, in the case where an explicit width larger than the true view width is specified by the page's meta
viewport, we'll end up believing that the page's content is not wider than the layout width, which is dictated
by the fixed meta viewport width. Instead, we can shrink the page down in this scenario by comparing the content
width against the scaled size of the view when computing the amount of horizontal overflow.
Test: fast/viewport/ios/shrink-to-fit-content-large-constant-width.html
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::immediatelyShrinkToFitContent):
LayoutTests:
Add a new test to verify that if the meta viewport tag specifies a wide fixed width value, we will still try to
shrink the page down to fit within the viewport.
* fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt: Added.
* fast/viewport/ios/shrink-to-fit-content-large-constant-width.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (246851 => 246852)
--- trunk/LayoutTests/ChangeLog 2019-06-26 23:07:28 UTC (rev 246851)
+++ trunk/LayoutTests/ChangeLog 2019-06-26 23:10:21 UTC (rev 246852)
@@ -1,3 +1,17 @@
+2019-06-26 Wenson Hsieh <[email protected]>
+
+ [iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
+ https://bugs.webkit.org/show_bug.cgi?id=199219
+ <rdar://problem/50425765>
+
+ Reviewed by Tim Horton.
+
+ Add a new test to verify that if the meta viewport tag specifies a wide fixed width value, we will still try to
+ shrink the page down to fit within the viewport.
+
+ * fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt: Added.
+ * fast/viewport/ios/shrink-to-fit-content-large-constant-width.html: Added.
+
2019-06-26 Joseph Pecoraro <[email protected]>
Web Inspector: Implement console.countReset
Added: trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt (0 => 246852)
--- trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt 2019-06-26 23:10:21 UTC (rev 246852)
@@ -0,0 +1,11 @@
+This test verifies that a page with a constant width viewport smaller than the actual view width is scaled to fit the view. To test manually, load the page and verify that the bar spans the full width of the page.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS minScale is expectedScale
+PASS innerWidth is 1000
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html (0 => 246852)
--- trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html 2019-06-26 23:10:21 UTC (rev 246852)
@@ -0,0 +1,45 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ shouldIgnoreMetaViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=1000">
+<style>
+body, html {
+ margin: 0;
+}
+
+#bar {
+ width: 100%;
+ height: 100px;
+ background: linear-gradient(to right, red 0%, green 50%, blue 100%);
+}
+
+#description {
+ width: 300px;
+ overflow: scroll;
+}
+</style>
+<script src=""
+<script src=""
+<script>
+jsTestIsAsync = true;
+
+description("This test verifies that a page with a constant width viewport smaller than the actual view width is scaled to fit the view. To test manually, load the page and verify that the bar spans the full width of the page.");
+
+addEventListener("load", async () => {
+ if (!window.testRunner)
+ return;
+
+ await UIHelper.ensurePresentationUpdate();
+ minScale = (await UIHelper.minimumZoomScale()).toFixed(2);
+ expectedScale = (screen.width / 1000).toFixed(2);
+ shouldBe("minScale", "expectedScale");
+ shouldBe("innerWidth", "1000");
+ finishJSTest();
+});
+</script>
+</head>
+<body>
+<div id="bar"></div>
+<div id="description"></div>
+</body>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (246851 => 246852)
--- trunk/Source/WebKit/ChangeLog 2019-06-26 23:07:28 UTC (rev 246851)
+++ trunk/Source/WebKit/ChangeLog 2019-06-26 23:10:21 UTC (rev 246852)
@@ -1,3 +1,23 @@
+2019-06-26 Wenson Hsieh <[email protected]>
+
+ [iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
+ https://bugs.webkit.org/show_bug.cgi?id=199219
+ <rdar://problem/50425765>
+
+ Reviewed by Tim Horton.
+
+ Currently, the heuristic to determine whether the page should be shrunk to fit the content width after loading
+ works by checking whether the page's content is wider than the layout width we've provided for the page.
+ However, in the case where an explicit width larger than the true view width is specified by the page's meta
+ viewport, we'll end up believing that the page's content is not wider than the layout width, which is dictated
+ by the fixed meta viewport width. Instead, we can shrink the page down in this scenario by comparing the content
+ width against the scaled size of the view when computing the amount of horizontal overflow.
+
+ Test: fast/viewport/ios/shrink-to-fit-content-large-constant-width.html
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::immediatelyShrinkToFitContent):
+
2019-06-26 Zalan Bujtas <[email protected]>
[ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246851 => 246852)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-26 23:07:28 UTC (rev 246851)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-26 23:10:21 UTC (rev 246852)
@@ -3317,10 +3317,16 @@
static const int toleratedHorizontalScrollingDistance = 20;
static const int maximumExpandedLayoutWidth = 1280;
+
+ auto scaledViewWidth = [&] () -> int {
+ return std::round(m_viewportConfiguration.viewLayoutSize().width() / m_viewportConfiguration.initialScale());
+ };
+
int originalContentWidth = view->contentsWidth();
+ int originalViewWidth = scaledViewWidth();
int originalLayoutWidth = m_viewportConfiguration.layoutWidth();
- int originalHorizontalOverflowAmount = originalContentWidth - originalLayoutWidth;
- if (originalHorizontalOverflowAmount <= toleratedHorizontalScrollingDistance || originalLayoutWidth >= maximumExpandedLayoutWidth || originalContentWidth <= m_viewportConfiguration.viewLayoutSize().width())
+ int originalHorizontalOverflowAmount = originalContentWidth - originalViewWidth;
+ if (originalHorizontalOverflowAmount <= toleratedHorizontalScrollingDistance || originalLayoutWidth >= maximumExpandedLayoutWidth || originalContentWidth <= originalViewWidth)
return false;
auto changeMinimumEffectiveDeviceWidth = [this, mainDocument] (int targetLayoutWidth) -> bool {
@@ -3334,7 +3340,7 @@
m_viewportConfiguration.setIsKnownToLayOutWiderThanViewport(true);
double originalMinimumDeviceWidth = m_viewportConfiguration.minimumEffectiveDeviceWidth();
- if (changeMinimumEffectiveDeviceWidth(std::min(maximumExpandedLayoutWidth, originalContentWidth)) && view->contentsWidth() - m_viewportConfiguration.layoutWidth() > originalHorizontalOverflowAmount) {
+ if (changeMinimumEffectiveDeviceWidth(std::min(maximumExpandedLayoutWidth, originalContentWidth)) && view->contentsWidth() - scaledViewWidth() > originalHorizontalOverflowAmount) {
changeMinimumEffectiveDeviceWidth(originalMinimumDeviceWidth);
m_viewportConfiguration.setIsKnownToLayOutWiderThanViewport(false);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes