summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/web/PageScaleConstraintsSet.cpp3
-rw-r--r--Source/web/tests/WebFrameTest.cpp22
2 files changed, 24 insertions, 1 deletions
diff --git a/Source/web/PageScaleConstraintsSet.cpp b/Source/web/PageScaleConstraintsSet.cpp
index 113517d55..4aa0494f8 100644
--- a/Source/web/PageScaleConstraintsSet.cpp
+++ b/Source/web/PageScaleConstraintsSet.cpp
@@ -206,7 +206,8 @@ void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
if (wideViewportQuirkEnabled) {
if (useWideViewport && (description.maxWidth.isAuto() || description.maxWidth.type() == ExtendToZoom) && description.zoom != 1.0f) {
- adjustedLayoutSizeWidth = layoutFallbackWidth;
+ if (layoutFallbackWidth)
+ adjustedLayoutSizeWidth = layoutFallbackWidth;
adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayoutSizeWidth, m_viewSize);
} else if (!useWideViewport) {
const float nonWideScale = description.zoom < 1 && description.maxWidth.type() != DeviceWidth && description.maxWidth.type() != DeviceHeight ? -1 : oldInitialScale;
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 84c623244..2d24c78f3 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -1070,6 +1070,28 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag)
EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height());
}
+TEST_F(WebFrameTest, WideViewportSetsTo980WithXhtmlMp)
+{
+ UseMockScrollbarSettings mockScrollbarSettings;
+ registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html");
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.deviceScaleFactor = 1;
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
+ webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
+ webViewHelper.webView()->settings()->setUseWideViewport(true);
+ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport/viewport-legacy-xhtmlmp.html");
+
+ webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
+ EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width());
+ EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height());
+}
+
TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta)
{
UseMockScrollbarSettings mockScrollbarSettings;