WebKit Bugzilla
Attachment 372953 Details for
Bug 199219
: [iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199219-20190626144034.patch (text/plain), 7.21 KB, created by
Wenson Hsieh
on 2019-06-26 14:40:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-06-26 14:40:35 PDT
Size:
7.21 KB
patch
obsolete
>Subversion Revision: 246826 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index c939e7662778cc2b3c75b642691a109fc47c2e81..35dfd3a541e43025f45ddf0278441b67e21a71df 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2019-06-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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-25 Daniel Bates <dabates@apple.com> > > Non-editable text selections should be modifiable with hardware keyboard >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 044e11f017876901c81d39124bf68fde38e1cfa0..7526223bcf8af0a940f47b2d6a4e5b3a9e3fcf59 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -3311,10 +3311,16 @@ bool WebPage::immediatelyShrinkToFitContent() > > 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 { >@@ -3328,7 +3334,7 @@ bool WebPage::immediatelyShrinkToFitContent() > > 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); > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4885271c3bf0fcfb76df23e0c4d8a3c468faf150..115610f194fe0a7462e0b0ae780349c05c7f76cb 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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-25 Justin Fan <justin_fan@apple.com> > > [WHLSL] Make whlsl-test-harness actually generate WHLSL shaders by default >diff --git a/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt b/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f106291ee552f5aafd58ba3b1d22a30b355f1944 >--- /dev/null >+++ b/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html b/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b588d33a683af9f8aae06fd39caa3a0c810295ea >--- /dev/null >+++ b/LayoutTests/fast/viewport/ios/shrink-to-fit-content-large-constant-width.html >@@ -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="../../../resources/ui-helper.js"></script> >+<script src="../../../resources/js-test.js"></script> >+<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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199219
: 372953