Cherry-pick: Scale the layout width by the UA initial scale

Cherry-pick of chromium http://crrev.com/59073007

Bug: 10528370

Original description:

[Android WebView] Scale the layout width by the UA initial scale

Another subtle difference of the Classic WebView implementation. In non-wide
viewport mode, the UA initial scale (set via 'setInitialPageScaleOverride')
can stretch the resulting layout width.

BUG=315552

Change-Id: I1292a7cde36c86e8513758dd5e67e71a524c4f0f
diff --git a/Source/core/page/PageScaleConstraintsSet.cpp b/Source/core/page/PageScaleConstraintsSet.cpp
index 1e1b1b6..c1d51a1 100644
--- a/Source/core/page/PageScaleConstraintsSet.cpp
+++ b/Source/core/page/PageScaleConstraintsSet.cpp
@@ -181,6 +181,8 @@
         } else if (!useWideViewport) {
             const float nonWideScale = arguments.zoom < 1 && arguments.width != ViewportArguments::ValueDeviceWidth ? -1 : oldInitialScale;
             adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor;
+            if (m_userAgentConstraints.initialScale != -1 && (arguments.width == ViewportArguments::ValueDeviceWidth || (arguments.width == -1 && arguments.zoom == -1)))
+                adjustedLayoutSizeWidth /= m_userAgentConstraints.initialScale;
             adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayoutSizeWidth, viewSize);
             if (arguments.zoom < 1) {
                 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor;