<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[260090] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/260090">260090</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2020-04-14 12:15:45 -0700 (Tue, 14 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window
https://bugs.webkit.org/show_bug.cgi?id=210501
<rdar://problem/54856323>

Reviewed by Tim Horton.

Source/WebCore:

In a 1/3 multitasking window, Safari currently uses the `-[WKWebView _allowsViewportShrinkToFit]` SPI to force
pages to shrink down by fitting the content width to the view width. This legacy method of shrinking to fit
involves laying the page out at the normal view width (320px in 1/3 multitasking), and then scaling the page
down such that any amount of horizontal overflow fits within the view.

In iOS 13, a new style of shrinking to fit was introduced in support of two new features: page zoom controls
(accessible via the page formatting menu), and on-by-default page scaling when loading desktop sites on certain
models of iPad where the page width is less than cutoffs of 1112px (in landscape) and 1024px (in portrait). This
new method of shrinking to fit involves laying out at a larger width (computed from a combination of the minimum
effective device width and layout size scale factor), and scaling to fit the effective layout size scale factor
instead of the entire contents of the page. This means that while we may still get horizontal scrolling after
shrinking to fit, the overall layout of the page is preserved.

Currently, in 1/3 multitasking, Safari still relies on the former to scale pages down to fit, which means that
Wikipedia articles (among other websites) do not lay out sensibly. Moreover, even if Safari adopted the second
mechanism for shrinking to fit, layout issues would still exist (albeit to a lesser degree), since we'd still
attempt to shrink the content width down to fit due to the fact that the desktop version of Wikipedia doesn't
have a meta viewport. While we wouldn't get a broken layout, we'd still have a blank column running down the
right side of the page, which is less than ideal.

It's clear that in this case, attempting to shrink page content down to fit the view is suboptimal (at best, it
leads to a large portion of the page being blank; at worst, it completely breaks page layout). To address this
bug for now, add a parallel minimumEffectiveDeviceWidth value that takes effect when ignoring scaling
constraints (i.e. when we're in a multitasking window), and scale the page down to fit this value instead of
fitting the full content width when computing initial scale in `ViewportConfiguration::initialScaleFromSize`.
Maintaining this value separately from m_minimumEffectiveDeviceWidth makes it much easier to ensure that the
effects of this change are only ever active when the quirk is applied, and also when the view is embedded in a
multitasking window.

* page/Quirks.cpp:
(WebCore::Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints const):

Introduce a quirk to fix layout issues in multitasking mode on the desktop version of Wikipedia.

* page/Quirks.h:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::initialScaleFromSize const):
(WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidth):
(WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints):
* page/ViewportConfiguration.h:

Add a minimum effective device width value that only takes effect when ignoring scaling constraints, and update
`shouldIgnoreMinimumEffectiveDeviceWidth()` and `minimumEffectiveDeviceWidth()` to not always return `true` and
`0` (respectively) when ignoring scaling constraints, if m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints
is set.

(WebCore::ViewportConfiguration::minimumEffectiveDeviceWidth const):
(WebCore::ViewportConfiguration::shouldIgnoreMinimumEffectiveDeviceWidth const):
(WebCore::ViewportConfiguration::shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints const):

Source/WebKit:

Apply the viewport quirk if needed; see WebCore/ChangeLog for more details.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageQuirkscpp">trunk/Source/WebCore/page/Quirks.cpp</a></li>
<li><a href="#trunkSourceWebCorepageQuirksh">trunk/Source/WebCore/page/Quirks.h</a></li>
<li><a href="#trunkSourceWebCorepageViewportConfigurationcpp">trunk/Source/WebCore/page/ViewportConfiguration.cpp</a></li>
<li><a href="#trunkSourceWebCorepageViewportConfigurationh">trunk/Source/WebCore/page/ViewportConfiguration.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebCore/ChangeLog      2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window
+        https://bugs.webkit.org/show_bug.cgi?id=210501
+        <rdar://problem/54856323>
+
+        Reviewed by Tim Horton.
+
+        In a 1/3 multitasking window, Safari currently uses the `-[WKWebView _allowsViewportShrinkToFit]` SPI to force
+        pages to shrink down by fitting the content width to the view width. This legacy method of shrinking to fit
+        involves laying the page out at the normal view width (320px in 1/3 multitasking), and then scaling the page
+        down such that any amount of horizontal overflow fits within the view.
+
+        In iOS 13, a new style of shrinking to fit was introduced in support of two new features: page zoom controls
+        (accessible via the page formatting menu), and on-by-default page scaling when loading desktop sites on certain
+        models of iPad where the page width is less than cutoffs of 1112px (in landscape) and 1024px (in portrait). This
+        new method of shrinking to fit involves laying out at a larger width (computed from a combination of the minimum
+        effective device width and layout size scale factor), and scaling to fit the effective layout size scale factor
+        instead of the entire contents of the page. This means that while we may still get horizontal scrolling after
+        shrinking to fit, the overall layout of the page is preserved.
+
+        Currently, in 1/3 multitasking, Safari still relies on the former to scale pages down to fit, which means that
+        Wikipedia articles (among other websites) do not lay out sensibly. Moreover, even if Safari adopted the second
+        mechanism for shrinking to fit, layout issues would still exist (albeit to a lesser degree), since we'd still
+        attempt to shrink the content width down to fit due to the fact that the desktop version of Wikipedia doesn't
+        have a meta viewport. While we wouldn't get a broken layout, we'd still have a blank column running down the
+        right side of the page, which is less than ideal.
+
+        It's clear that in this case, attempting to shrink page content down to fit the view is suboptimal (at best, it
+        leads to a large portion of the page being blank; at worst, it completely breaks page layout). To address this
+        bug for now, add a parallel minimumEffectiveDeviceWidth value that takes effect when ignoring scaling
+        constraints (i.e. when we're in a multitasking window), and scale the page down to fit this value instead of
+        fitting the full content width when computing initial scale in `ViewportConfiguration::initialScaleFromSize`.
+        Maintaining this value separately from m_minimumEffectiveDeviceWidth makes it much easier to ensure that the
+        effects of this change are only ever active when the quirk is applied, and also when the view is embedded in a
+        multitasking window.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints const):
+
+        Introduce a quirk to fix layout issues in multitasking mode on the desktop version of Wikipedia.
+
+        * page/Quirks.h:
+        * page/ViewportConfiguration.cpp:
+        (WebCore::ViewportConfiguration::initialScaleFromSize const):
+        (WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidth):
+        (WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints):
+        * page/ViewportConfiguration.h:
+
+        Add a minimum effective device width value that only takes effect when ignoring scaling constraints, and update
+        `shouldIgnoreMinimumEffectiveDeviceWidth()` and `minimumEffectiveDeviceWidth()` to not always return `true` and
+        `0` (respectively) when ignoring scaling constraints, if m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints
+        is set.
+
+        (WebCore::ViewportConfiguration::minimumEffectiveDeviceWidth const):
+        (WebCore::ViewportConfiguration::shouldIgnoreMinimumEffectiveDeviceWidth const):
+        (WebCore::ViewportConfiguration::shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints const):
+
</ins><span class="cx"> 2020-04-14  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Factor PseudoElement creation calls into a single Element::ensurePseudoElement(pseudoId) method
</span></span></pre></div>
<a id="trunkSourceWebCorepageQuirkscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Quirks.cpp (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Quirks.cpp     2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebCore/page/Quirks.cpp        2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -750,4 +750,14 @@
</span><span class="cx">     return m_needsCanPlayAfterSeekedQuirk.value();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints() const
+{
+    if (!needsQuirks())
+        return false;
+
+    // FIXME: We should consider replacing this with a heuristic to determine whether
+    // or not the edges of the page mostly lack content after shrinking to fit.
+    return m_document->url().host().endsWithIgnoringASCIICase(".wikipedia.org");
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorepageQuirksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Quirks.h (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Quirks.h       2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebCore/page/Quirks.h  2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx">     WEBCORE_EXPORT bool shouldAvoidScrollingWhenFocusedContentIsVisible() const;
</span><span class="cx">     WEBCORE_EXPORT bool shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation() const;
</span><span class="cx">     WEBCORE_EXPORT bool shouldIgnoreAriaForFastPathContentObservationCheck() const;
</span><ins>+    WEBCORE_EXPORT bool shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints() const;
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorepageViewportConfigurationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ViewportConfiguration.cpp      2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp 2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -270,6 +270,8 @@
</span><span class="cx">         static const double maximumContentWidthBeforePreferringExplicitWidthToAvoidExcessiveScaling = 1920;
</span><span class="cx">         if (width > maximumContentWidthBeforePreferringExplicitWidthToAvoidExcessiveScaling && m_configuration.widthIsSet && 0 < m_configuration.width && m_configuration.width < width)
</span><span class="cx">             initialScale = m_viewLayoutSize.width() / m_configuration.width;
</span><ins>+        else if (shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints())
+            initialScale = effectiveLayoutSizeScaleFactor();
</ins><span class="cx">         else if (width > 0)
</span><span class="cx">             initialScale = m_viewLayoutSize.width() / width;
</span><span class="cx">     }
</span><span class="lines">@@ -622,6 +624,21 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ViewportConfiguration::setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints(double width)
+{
+    if (WTF::areEssentiallyEqual(m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints, width))
+        return false;
+
+    bool wasShrinkingToFitMinimumEffectiveDeviceWidth = shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints();
+    m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints = width;
+    if (wasShrinkingToFitMinimumEffectiveDeviceWidth == shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints())
+        return false;
+
+    updateMinimumLayoutSize();
+    updateConfiguration();
+    return true;
+}
+
</ins><span class="cx"> bool ViewportConfiguration::setIsKnownToLayOutWiderThanViewport(bool value)
</span><span class="cx"> {
</span><span class="cx">     if (m_isKnownToLayOutWiderThanViewport == value)
</span></span></pre></div>
<a id="trunkSourceWebCorepageViewportConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ViewportConfiguration.h        2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h   2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -88,12 +88,13 @@
</span><span class="cx">     WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool);
</span><span class="cx">     constexpr bool canIgnoreScalingConstraints() const { return m_canIgnoreScalingConstraints; }
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT bool setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints(double);
</ins><span class="cx">     WEBCORE_EXPORT bool setMinimumEffectiveDeviceWidth(double);
</span><span class="cx">     constexpr double minimumEffectiveDeviceWidth() const
</span><span class="cx">     {
</span><span class="cx">         if (shouldIgnoreMinimumEffectiveDeviceWidth())
</span><span class="cx">             return 0;
</span><del>-        return m_minimumEffectiveDeviceWidth;
</del><ins>+        return m_canIgnoreScalingConstraints ? m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints : m_minimumEffectiveDeviceWidth;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     constexpr bool isKnownToLayOutWiderThanViewport() const { return m_isKnownToLayOutWiderThanViewport; }
</span><span class="lines">@@ -101,6 +102,9 @@
</span><span class="cx"> 
</span><span class="cx">     constexpr bool shouldIgnoreMinimumEffectiveDeviceWidth() const
</span><span class="cx">     {
</span><ins>+        if (shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints())
+            return false;
+
</ins><span class="cx">         if (m_canIgnoreScalingConstraints)
</span><span class="cx">             return true;
</span><span class="cx"> 
</span><span class="lines">@@ -113,6 +117,11 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    constexpr bool shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints() const
+    {
+        return m_canIgnoreScalingConstraints && m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints;
+    }
+
</ins><span class="cx">     void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
</span><span class="cx">     double layoutSizeScaleFactor() const { return m_layoutSizeScaleFactor; }
</span><span class="cx"> 
</span><span class="lines">@@ -192,6 +201,7 @@
</span><span class="cx"> 
</span><span class="cx">     double m_layoutSizeScaleFactor { 1 };
</span><span class="cx">     double m_minimumEffectiveDeviceWidth { 0 };
</span><ins>+    double m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints { 0 };
</ins><span class="cx">     bool m_canIgnoreScalingConstraints;
</span><span class="cx">     bool m_forceAlwaysUserScalable;
</span><span class="cx">     bool m_isKnownToLayOutWiderThanViewport { false };
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebKit/ChangeLog       2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window
+        https://bugs.webkit.org/show_bug.cgi?id=210501
+        <rdar://problem/54856323>
+
+        Reviewed by Tim Horton.
+
+        Apply the viewport quirk if needed; see WebCore/ChangeLog for more details.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
</ins><span class="cx"> 2020-04-14  Brent Fulgham  <bfulgham@apple.com>
</span><span class="cx"> 
</span><span class="cx">         InjectedBundle parameters often need initialization function called before unarchiving
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (260089 => 260090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2020-04-14 19:14:35 UTC (rev 260089)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm    2020-04-14 19:15:45 UTC (rev 260090)
</span><span class="lines">@@ -3880,6 +3880,21 @@
</span><span class="cx">     if (m_viewportConfiguration.setCanIgnoreScalingConstraints(visibleContentRectUpdateInfo.allowShrinkToFit()))
</span><span class="cx">         viewportConfigurationChanged();
</span><span class="cx"> 
</span><ins>+    double minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints = ([&] {
+        auto document = makeRefPtr(frame.document());
+        if (!document)
+            return 0;
+
+        if (!document->quirks().shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints())
+            return 0;
+
+        // This value is chosen to be close to the minimum width of a Safari window on macOS.
+        return 500;
+    })();
+
+    if (m_viewportConfiguration.setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints(minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints))
+        viewportConfigurationChanged();
+
</ins><span class="cx">     frameView.setUnobscuredContentSize(visibleContentRectUpdateInfo.unobscuredContentRect().size());
</span><span class="cx">     m_page->setContentInsets(visibleContentRectUpdateInfo.contentInsets());
</span><span class="cx">     m_page->setObscuredInsets(visibleContentRectUpdateInfo.obscuredInsets());
</span></span></pre>
</div>
</div>

</body>
</html>