Title: [231779] trunk
Revision
231779
Author
wenson_hs...@apple.com
Date
2018-05-14 18:07:36 -0700 (Mon, 14 May 2018)

Log Message

[Extra zoom mode] Google search results are excessively zoomed in
https://bugs.webkit.org/show_bug.cgi?id=185347
<rdar://problem/39999778>

Reviewed by Tim Horton.

Source/WebCore:

It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport
argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default
viewport shrinking behaviors in 1/3 multitasking mode on iPad.

One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in
extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe
using a single backwards-compatible viewport meta content attribute, and the need to suppress the default
behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story.

After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations".
The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a
known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web
content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout
size adjustments.

See per-method changes below for more details.

Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::processDisabledAdaptations):
* dom/Document.h:
(WebCore::Document::disabledAdaptations const):

Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled
adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled
adaptations (currently, this only affects the viewport configuration).

* dom/ViewportArguments.h:
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::process):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner):
(WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):

Restore the set of disabled adaptations when restoring a page from the cache.

* page/Chrome.cpp:
(WebCore::Chrome::dispatchDisabledAdaptationsDidChange const):
* page/Chrome.h:
* page/ChromeClient.h:

Add plumbing for changes to the set of disabled adaptations.

* page/DisabledAdaptations.cpp: Added.
(WebCore::extraZoomModeAdaptationName):
* page/DisabledAdaptations.h: Added.

Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to
return the extra zoom mode adaptation name.

* page/Page.cpp:
(WebCore::Page::disabledAdaptations const):

Returns the mainframe's set of adaptations to disable.

* page/Page.h:
* page/RemoteFrame.h:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled):
(WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const):

Add a new runtime feature to gate handling the "disabled-adaptations" meta tag.

* page/ViewportConfiguration.cpp:
(WebCore::shouldOverrideShrinkToFitArgument):
(WebCore::needsUpdateAfterChangingDisabledAdaptations):
(WebCore::ViewportConfiguration::setDisabledAdaptations):
(WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):

Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value.

(WebCore::ViewportConfiguration::updateConfiguration):
* page/ViewportConfiguration.h:

Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are
propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to
changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the
platform.

(WebCore::ViewportConfiguration::viewLayoutSize const):
(WebCore::ViewportConfiguration::disabledAdaptations const):
* page/WindowFeatures.cpp:
(WebCore::parseDisabledAdaptations):
* page/WindowFeatures.h:

Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled
adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower
case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported.

* testing/Internals.cpp:
(WebCore::Internals::extraZoomModeAdaptationName const):
* testing/Internals.h:
* testing/Internals.idl:

Expose the extra zoom mode adaptation name to the DOM, only when running layout tests.

Source/WebKit:

Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
extra zoom mode.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::disabledAdaptationsDidChange):
* WebProcess/WebPage/WebPage.h:

Source/WebKitLegacy/ios:

Adds a WebKitLegacy method stub for disabled adaptation plumbing.

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::dispatchDisabledAdaptationsDidChange const):

LayoutTests:

Refactor an existing layout test to exercise disabled adaptations in extra zoom mode.

* fast/viewport/extrazoom/viewport-change-min-device-width.html: Removed.
* fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231778 => 231779)


--- trunk/LayoutTests/ChangeLog	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/LayoutTests/ChangeLog	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1,3 +1,16 @@
+2018-05-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Google search results are excessively zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=185347
+        <rdar://problem/39999778>
+
+        Reviewed by Tim Horton.
+
+        Refactor an existing layout test to exercise disabled adaptations in extra zoom mode.
+
+        * fast/viewport/extrazoom/viewport-change-min-device-width.html: Removed.
+        * fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html: Added.
+
 2018-05-14  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Listbox and Combobox roles embedded in labels should participate in name calculation

Deleted: trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html (231778 => 231779)


--- trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1,60 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-<html>
-<meta name="viewport" id="meta">
-<head>
-    <script src=""
-    <script src=""
-    <style>
-        body, html {
-            margin: 0;
-            width: 100%;
-            height: 100%;
-        }
-    </style>
-    <script>
-        jsTestIsAsync = true;
-
-        function logWindowDimensionsAfterSettingViewportContent(content) {
-            return new Promise(async resolve => {
-                meta.setAttribute("content", content);
-                await UIHelper.ensureVisibleContentRectUpdate();
-                debug(`[${meta.getAttribute("content")}] (${innerWidth}, ${innerHeight})`);
-                resolve();
-            });
-        }
-
-        async function runTest() {
-            if (!window.testRunner) {
-                description("Please use WebKitTestRunner to run this test.");
-                return;
-            }
-
-            debug("1. Default viewport");
-            await logWindowDimensionsAfterSettingViewportContent("width=150");
-            await logWindowDimensionsAfterSettingViewportContent("width=device-width");
-            scaleAtDeviceWidthWithInitialShrinkToFit = parseFloat(await UIHelper.zoomScale()).toFixed(3);
-            await logWindowDimensionsAfterSettingViewportContent("width=600");
-
-            debug("\n2. shrink-to-fit explicitly disabled");
-            await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=no");
-            await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=0");
-            scaleAtDeviceWidthWithShrinkToFitDisabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
-            await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=-0.5");
-
-            debug("\n3. shrink-to-fit explicitly enabled");
-            await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=yes");
-            await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=1");
-            scaleAtDeviceWidthWithShrinkToFitEnabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
-            await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=device-width");
-
-            shouldBe("scaleAtDeviceWidthWithInitialShrinkToFit", "'0.488'");
-            shouldBe("scaleAtDeviceWidthWithShrinkToFitDisabled", "'1.000'");
-            shouldBe("scaleAtDeviceWidthWithShrinkToFitEnabled", "'0.488'");
-
-            finishJSTest();
-        }
-    </script>
-</head>
-<body _onload_="runTest()">
-</body>
-</html>

Added: trunk/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html (0 => 231779)


--- trunk/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html	2018-05-15 01:07:36 UTC (rev 231779)
@@ -0,0 +1,107 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport">
+<head>
+    <script src=""
+    <script src=""
+    <style>
+        body, html {
+            margin: 0;
+            width: 100%;
+            height: 100%;
+        }
+
+        #output {
+            width: 100%;
+            height: 100%;
+            overflow: scroll;
+        }
+    </style>
+    <script>
+        jsTestIsAsync = true;
+
+        function appendOutput(text) {
+            const span = document.createElement("span");
+            span.textContent = text;
+            output.appendChild(document.createElement("br"));
+            output.appendChild(span);
+        }
+
+        function logWindowDimensionsAfterSettingMetaContent(metaNameToContentMap) {
+            return new Promise(async resolve => {
+                for (const name in metaNameToContentMap)
+                    document.querySelector(`meta[name='${name}']`).content = metaNameToContentMap[name];
+
+                await UIHelper.ensureVisibleContentRectUpdate();
+                appendOutput(`[${Object.values(metaNameToContentMap).join("; ")}] (${innerWidth}, ${innerHeight})`);
+                resolve();
+            });
+        }
+
+        async function runTest() {
+            if (!window.testRunner) {
+                description("Please use WebKitTestRunner to run this test.");
+                return;
+            }
+
+            appendOutput();
+            appendOutput("1. Default viewport");
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=150"
+            });
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=device-width"
+            });
+            scaleAtDeviceWidthWithDefaultAdaptations = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=600"
+            });
+
+            const disabledAdaptationsMeta = document.createElement("meta");
+            disabledAdaptationsMeta.setAttribute("name", "disabled-adaptations");
+            document.head.appendChild(disabledAdaptationsMeta);
+
+            appendOutput();
+            appendOutput("2. extra zoom mode adaptations disabled");
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=150",
+                "disabled-adaptations" : `one,\t${internals.extraZoomModeAdaptationName()}   ,two`
+            });
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=device-width",
+                "disabled-adaptations" : `${internals.extraZoomModeAdaptationName()}, three, four, ${internals.extraZoomModeAdaptationName()}`
+            });
+            scaleAtDeviceWidthWithAdaptationDisabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=600",
+                "disabled-adaptations" : `five, ${internals.extraZoomModeAdaptationName()}`
+            });
+
+            appendOutput();
+            appendOutput("3. shrink-to-fit disabled");
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=150, shrink-to-fit=no",
+                "disabled-adaptations" : ""
+            });
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=device-width, shrink-to-fit=0",
+                "disabled-adaptations" : "bogus, values"
+            });
+            scaleAtDeviceWidthWithShrinkToFitDisabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+            await logWindowDimensionsAfterSettingMetaContent({
+                "viewport" : "width=600, shrink-to-fit=-0.5",
+                "disabled-adaptations" : ",,,"
+            });
+
+            shouldBe("scaleAtDeviceWidthWithDefaultAdaptations", "'0.488'");
+            shouldBe("scaleAtDeviceWidthWithAdaptationDisabled", "'1.000'");
+            shouldBe("scaleAtDeviceWidthWithShrinkToFitDisabled", "'0.488'");
+
+            finishJSTest();
+        }
+    </script>
+</head>
+<body _onload_="runTest()">
+<pre id="output"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (231778 => 231779)


--- trunk/Source/WebCore/ChangeLog	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/ChangeLog	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1,3 +1,113 @@
+2018-05-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Google search results are excessively zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=185347
+        <rdar://problem/39999778>
+
+        Reviewed by Tim Horton.
+
+        It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport
+        argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default
+        viewport shrinking behaviors in 1/3 multitasking mode on iPad.
+
+        One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in
+        extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe
+        using a single backwards-compatible viewport meta content attribute, and the need to suppress the default
+        behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story.
+
+        After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations".
+        The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a
+        known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web
+        content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout
+        size adjustments.
+
+        See per-method changes below for more details.
+
+        Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::processDisabledAdaptations):
+        * dom/Document.h:
+        (WebCore::Document::disabledAdaptations const):
+
+        Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled
+        adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled
+        adaptations (currently, this only affects the viewport configuration).
+
+        * dom/ViewportArguments.h:
+        * html/HTMLMetaElement.cpp:
+        (WebCore::HTMLMetaElement::process):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner):
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::commitProvisionalLoad):
+
+        Restore the set of disabled adaptations when restoring a page from the cache.
+
+        * page/Chrome.cpp:
+        (WebCore::Chrome::dispatchDisabledAdaptationsDidChange const):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+
+        Add plumbing for changes to the set of disabled adaptations.
+
+        * page/DisabledAdaptations.cpp: Added.
+        (WebCore::extraZoomModeAdaptationName):
+        * page/DisabledAdaptations.h: Added.
+
+        Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to
+        return the extra zoom mode adaptation name.
+
+        * page/Page.cpp:
+        (WebCore::Page::disabledAdaptations const):
+
+        Returns the mainframe's set of adaptations to disable.
+
+        * page/Page.h:
+        * page/RemoteFrame.h:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled):
+        (WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const):
+
+        Add a new runtime feature to gate handling the "disabled-adaptations" meta tag.
+
+        * page/ViewportConfiguration.cpp:
+        (WebCore::shouldOverrideShrinkToFitArgument):
+        (WebCore::needsUpdateAfterChangingDisabledAdaptations):
+        (WebCore::ViewportConfiguration::setDisabledAdaptations):
+        (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
+
+        Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value.
+
+        (WebCore::ViewportConfiguration::updateConfiguration):
+        * page/ViewportConfiguration.h:
+
+        Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are
+        propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to
+        changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the
+        platform.
+
+        (WebCore::ViewportConfiguration::viewLayoutSize const):
+        (WebCore::ViewportConfiguration::disabledAdaptations const):
+        * page/WindowFeatures.cpp:
+        (WebCore::parseDisabledAdaptations):
+        * page/WindowFeatures.h:
+
+        Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled
+        adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower
+        case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::extraZoomModeAdaptationName const):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
+        Expose the extra zoom mode adaptation name to the DOM, only when running layout tests.
+
 2018-05-14  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Listbox and Combobox roles embedded in labels should participate in name calculation

Modified: trunk/Source/WebCore/Sources.txt (231778 => 231779)


--- trunk/Source/WebCore/Sources.txt	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/Sources.txt	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1355,6 +1355,7 @@
 page/DeprecatedGlobalSettings.cpp
 page/DeviceController.cpp
 page/DiagnosticLoggingKeys.cpp
+page/DisabledAdaptations.cpp
 page/DragController.cpp
 page/EventHandler.cpp
 page/EventSource.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (231778 => 231779)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-05-15 01:07:36 UTC (rev 231779)
@@ -4782,6 +4782,7 @@
 		F45C231E1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h in Headers */ = {isa = PBXBuildFile; fileRef = F45C231C1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F46729281E0DE68500ACC3D8 /* ScrollSnapOffsetsInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F46729251E0DE5AB00ACC3D8 /* ScrollSnapOffsetsInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F478755419983AFF0024A287 /* ScrollSnapAnimatorState.h in Headers */ = {isa = PBXBuildFile; fileRef = F478755219983AFF0024A287 /* ScrollSnapAnimatorState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		F47A09D120A93A9700240FAE /* DisabledAdaptations.h in Headers */ = {isa = PBXBuildFile; fileRef = F47A09CF20A939F600240FAE /* DisabledAdaptations.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F47A5E3E195B8C8A00483100 /* StyleScrollSnapPoints.h in Headers */ = {isa = PBXBuildFile; fileRef = F47A5E3B195B8C8A00483100 /* StyleScrollSnapPoints.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F47A633D1FF6FD500081B3CC /* PromisedBlobInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F47A633C1FF6FD500081B3CC /* PromisedBlobInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F48223101E3869B80066FC79 /* WebItemProviderPasteboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = F482230E1E3869B80066FC79 /* WebItemProviderPasteboard.mm */; };
@@ -14467,6 +14468,8 @@
 		F46729251E0DE5AB00ACC3D8 /* ScrollSnapOffsetsInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollSnapOffsetsInfo.h; sourceTree = "<group>"; };
 		F478755219983AFF0024A287 /* ScrollSnapAnimatorState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollSnapAnimatorState.h; sourceTree = "<group>"; };
 		F478755319983AFF0024A287 /* ScrollSnapAnimatorState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollSnapAnimatorState.mm; sourceTree = "<group>"; };
+		F47A09CF20A939F600240FAE /* DisabledAdaptations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisabledAdaptations.h; sourceTree = "<group>"; };
+		F47A09D420A9DD0400240FAE /* DisabledAdaptations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisabledAdaptations.cpp; sourceTree = "<group>"; };
 		F47A5E3A195B8C8A00483100 /* StyleScrollSnapPoints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleScrollSnapPoints.cpp; sourceTree = "<group>"; };
 		F47A5E3B195B8C8A00483100 /* StyleScrollSnapPoints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleScrollSnapPoints.h; sourceTree = "<group>"; };
 		F47A633C1FF6FD500081B3CC /* PromisedBlobInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PromisedBlobInfo.h; sourceTree = "<group>"; };
@@ -19197,6 +19200,8 @@
 				CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */,
 				CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */,
 				8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */,
+				F47A09D420A9DD0400240FAE /* DisabledAdaptations.cpp */,
+				F47A09CF20A939F600240FAE /* DisabledAdaptations.h */,
 				BC5A86810C33676000EEA649 /* DOMSelection.cpp */,
 				BC5A86820C33676000EEA649 /* DOMSelection.h */,
 				BC5A86830C33676000EEA649 /* DOMSelection.idl */,
@@ -27600,6 +27605,7 @@
 				937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */,
 				2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */,
 				FDAF19991513D131008DB0C3 /* DirectConvolver.h in Headers */,
+				F47A09D120A93A9700240FAE /* DisabledAdaptations.h in Headers */,
 				7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */,
 				1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */,
 				0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */,

Modified: trunk/Source/WebCore/dom/Document.cpp (231778 => 231779)


--- trunk/Source/WebCore/dom/Document.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -3399,6 +3399,18 @@
     }
 }
 
+void Document::processDisabledAdaptations(const String& disabledAdaptationsString)
+{
+    auto disabledAdaptations = parseDisabledAdaptations(disabledAdaptationsString);
+    if (m_disabledAdaptations == disabledAdaptations)
+        return;
+
+    m_disabledAdaptations = disabledAdaptations;
+
+    if (page() && frame()->isMainFrame())
+        page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations);
+}
+
 void Document::processViewport(const String& features, ViewportArguments::Type origin)
 {
     ASSERT(!features.isNull());

Modified: trunk/Source/WebCore/dom/Document.h (231778 => 231779)


--- trunk/Source/WebCore/dom/Document.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/dom/Document.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -29,6 +29,7 @@
 
 #include "Color.h"
 #include "ContainerNode.h"
+#include "DisabledAdaptations.h"
 #include "DocumentEventQueue.h"
 #include "DocumentIdentifier.h"
 #include "DocumentTiming.h"
@@ -388,6 +389,7 @@
 
     void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; }
     ViewportArguments viewportArguments() const { return m_viewportArguments; }
+    OptionSet<DisabledAdaptations> disabledAdaptations() const { return m_disabledAdaptations; }
 #ifndef NDEBUG
     bool didDispatchViewportPropertiesChanged() const { return m_didDispatchViewportPropertiesChanged; }
 #endif
@@ -862,6 +864,7 @@
 #endif
     
     void processViewport(const String& features, ViewportArguments::Type origin);
+    void processDisabledAdaptations(const String& adaptations);
     void updateViewportArguments();
     void processReferrerPolicy(const String& policy);
 
@@ -1711,6 +1714,7 @@
     Timer m_loadEventDelayTimer;
 
     ViewportArguments m_viewportArguments;
+    OptionSet<DisabledAdaptations> m_disabledAdaptations;
 
     DocumentTiming m_documentTiming;
 

Modified: trunk/Source/WebCore/html/HTMLMetaElement.cpp (231778 => 231779)


--- trunk/Source/WebCore/html/HTMLMetaElement.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/html/HTMLMetaElement.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -27,6 +27,7 @@
 #include "Document.h"
 #include "HTMLHeadElement.h"
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -88,6 +89,8 @@
 
     if (equalLettersIgnoringASCIICase(name(), "viewport"))
         document().processViewport(contentValue, ViewportArguments::ViewportMeta);
+    else if (RuntimeEnabledFeatures::sharedFeatures().disabledAdaptationsMetaTagEnabled() && equalLettersIgnoringASCIICase(name(), "disabled-adaptations"))
+        document().processDisabledAdaptations(contentValue);
 #if PLATFORM(IOS)
     else if (equalLettersIgnoringASCIICase(name(), "format-detection"))
         document().processFormatDetection(contentValue);

Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (231778 => 231779)


--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -41,6 +41,7 @@
 #include "MediaQueryEvaluator.h"
 #include "MediaQueryParser.h"
 #include "RenderView.h"
+#include "RuntimeEnabledFeatures.h"
 #include "SizesAttributeParser.h"
 #include <wtf/MainThread.h>
 
@@ -106,6 +107,7 @@
         , m_linkIsStyleSheet(false)
         , m_linkIsPreload(false)
         , m_metaIsViewport(false)
+        , m_metaIsDisabledAdaptations(false)
         , m_inputIsImage(false)
         , m_deviceScaleFactor(deviceScaleFactor)
     {
@@ -142,6 +144,9 @@
 
         if (m_metaIsViewport && !m_metaContent.isNull())
             document.processViewport(m_metaContent, ViewportArguments::ViewportMeta);
+
+        if (m_metaIsDisabledAdaptations && !m_metaContent.isNull())
+            document.processDisabledAdaptations(m_metaContent);
     }
 
     std::unique_ptr<PreloadRequest> createPreloadRequest(const URL& predictedBaseURL)
@@ -266,6 +271,8 @@
                 m_metaContent = attributeValue;
             else if (match(attributeName, nameAttr))
                 m_metaIsViewport = equalLettersIgnoringASCIICase(attributeValue, "viewport");
+            else if (RuntimeEnabledFeatures::sharedFeatures().disabledAdaptationsMetaTagEnabled() && match(attributeName, nameAttr))
+                m_metaIsDisabledAdaptations = equalLettersIgnoringASCIICase(attributeValue, "disabled-adaptations");
             break;
         case TagId::Base:
         case TagId::Style:
@@ -359,6 +366,7 @@
     String m_asAttribute;
     String m_typeAttribute;
     bool m_metaIsViewport;
+    bool m_metaIsDisabledAdaptations;
     bool m_inputIsImage;
     float m_deviceScaleFactor;
     PreloadRequest::ModuleScript m_moduleScript { PreloadRequest::ModuleScript::No };

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (231778 => 231779)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1947,6 +1947,7 @@
         m_frame.page()->chrome().setDispatchViewportDataDidChangeSuppressed(false);
         m_frame.page()->chrome().dispatchViewportPropertiesDidChange(m_frame.page()->viewportArguments());
 #endif
+        m_frame.page()->chrome().dispatchDisabledAdaptationsDidChange(m_frame.page()->disabledAdaptations());
 
         auto& title = m_documentLoader->title();
         if (!title.string.isNull())

Modified: trunk/Source/WebCore/page/Chrome.cpp (231778 => 231779)


--- trunk/Source/WebCore/page/Chrome.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/Chrome.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -448,6 +448,11 @@
     return m_client.overrideScreenSize();
 }
 
+void Chrome::dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>& disabledAdaptations) const
+{
+    m_client.dispatchDisabledAdaptationsDidChange(disabledAdaptations);
+}
+
 void Chrome::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
 {
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/page/Chrome.h (231778 => 231779)


--- trunk/Source/WebCore/page/Chrome.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/Chrome.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -22,6 +22,7 @@
 #pragma once
 
 #include "Cursor.h"
+#include "DisabledAdaptations.h"
 #include "FocusDirection.h"
 #include "HostWindow.h"
 #include <wtf/Forward.h>
@@ -154,6 +155,7 @@
     void runOpenPanel(Frame&, FileChooser&);
     void loadIconForFiles(const Vector<String>&, FileIconLoader&);
 
+    void dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>&) const;
     void dispatchViewportPropertiesDidChange(const ViewportArguments&) const;
 
     bool requiresFullscreenForVideoPlayback();

Modified: trunk/Source/WebCore/page/ChromeClient.h (231778 => 231779)


--- trunk/Source/WebCore/page/ChromeClient.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/ChromeClient.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -25,6 +25,7 @@
 #include "AutoplayEvent.h"
 #include "Cursor.h"
 #include "DatabaseDetails.h"
+#include "DisabledAdaptations.h"
 #include "DisplayRefreshMonitor.h"
 #include "FocusDirection.h"
 #include "FrameLoader.h"
@@ -185,6 +186,7 @@
     virtual FloatSize availableScreenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
     virtual FloatSize overrideScreenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
 
+    virtual void dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>&) const { }
     virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const { }
 
     virtual void contentsSizeChanged(Frame&, const IntSize&) const = 0;

Copied: trunk/Source/WebCore/page/DisabledAdaptations.cpp (from rev 231778, trunk/Source/WebCore/page/RemoteFrame.h) (0 => 231779)


--- trunk/Source/WebCore/page/DisabledAdaptations.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/DisabledAdaptations.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisabledAdaptations.h"
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <WebKitAdditions/DisabledAdaptationsAdditions.cpp>
+
+#else
+
+String extraZoomModeAdaptationName()
+{
+    return emptyString();
+}
+
+#endif
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/page/DisabledAdaptations.h (from rev 231778, trunk/Source/WebCore/page/RemoteFrame.h) (0 => 231779)


--- trunk/Source/WebCore/page/DisabledAdaptations.h	                        (rev 0)
+++ trunk/Source/WebCore/page/DisabledAdaptations.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+WEBCORE_EXPORT String extraZoomModeAdaptationName();
+
+enum class DisabledAdaptations {
+    ExtraZoomMode = 1 << 0,
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/page/Page.cpp (231778 => 231779)


--- trunk/Source/WebCore/page/Page.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/Page.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -358,6 +358,14 @@
     return total;
 }
 
+OptionSet<DisabledAdaptations> Page::disabledAdaptations() const
+{
+    if (mainFrame().document())
+        return mainFrame().document()->disabledAdaptations();
+
+    return { };
+}
+
 ViewportArguments Page::viewportArguments() const
 {
     return mainFrame().document() ? mainFrame().document()->viewportArguments() : ViewportArguments();

Modified: trunk/Source/WebCore/page/Page.h (231778 => 231779)


--- trunk/Source/WebCore/page/Page.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/Page.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -21,6 +21,7 @@
 #pragma once
 
 #include "ActivityState.h"
+#include "DisabledAdaptations.h"
 #include "FindOptions.h"
 #include "FrameLoaderTypes.h"
 #include "LayoutMilestones.h"
@@ -174,6 +175,7 @@
 
     WEBCORE_EXPORT void setNeedsRecalcStyleInAllFrames();
 
+    WEBCORE_EXPORT OptionSet<DisabledAdaptations> disabledAdaptations() const;
     WEBCORE_EXPORT ViewportArguments viewportArguments() const;
 
     static void refreshPlugins(bool reload);

Modified: trunk/Source/WebCore/page/RemoteFrame.h (231778 => 231779)


--- trunk/Source/WebCore/page/RemoteFrame.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/RemoteFrame.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -28,6 +28,7 @@
 #include "AbstractFrame.h"
 #include "GlobalFrameIdentifier.h"
 #include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
 #include <wtf/TypeCasts.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (231778 => 231779)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -262,6 +262,9 @@
     void setServerTimingEnabled(bool isEnabled) { m_isServerTimingEnabled = isEnabled; }
     bool serverTimingEnabled() const { return m_isServerTimingEnabled; }
 
+    void setDisabledAdaptationsMetaTagEnabled(bool isEnabled) { m_disabledAdaptationsMetaTagEnabled = isEnabled; }
+    bool disabledAdaptationsMetaTagEnabled() const { return m_disabledAdaptationsMetaTagEnabled; }
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
@@ -404,6 +407,8 @@
 
     bool m_isServerTimingEnabled { false };
 
+    bool m_disabledAdaptationsMetaTagEnabled { false };
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (231778 => 231779)


--- trunk/Source/WebCore/page/ViewportConfiguration.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -54,6 +54,28 @@
 #endif
 }
 
+static bool shouldOverrideShrinkToFitArgument()
+{
+#if ENABLE(EXTRA_ZOOM_MODE)
+    return true;
+#else
+    return false;
+#endif
+}
+
+static bool needsUpdateAfterChangingDisabledAdaptations(const OptionSet<DisabledAdaptations>& oldDisabledAdaptations, const OptionSet<DisabledAdaptations>& newDisabledAdaptations)
+{
+    if (oldDisabledAdaptations == newDisabledAdaptations)
+        return false;
+
+#if ENABLE(EXTRA_ZOOM_MODE)
+    if (oldDisabledAdaptations.contains(DisabledAdaptations::ExtraZoomMode) != newDisabledAdaptations.contains(DisabledAdaptations::ExtraZoomMode))
+        return true;
+#endif
+
+    return false;
+}
+
 ViewportConfiguration::ViewportConfiguration()
     : m_minimumLayoutSize(1024, 768)
     , m_viewLayoutSize(1024, 768)
@@ -104,6 +126,19 @@
     return true;
 }
 
+bool ViewportConfiguration::setDisabledAdaptations(const OptionSet<DisabledAdaptations>& disabledAdaptations)
+{
+    auto previousDisabledAdaptations = m_disabledAdaptations;
+    m_disabledAdaptations = disabledAdaptations;
+
+    if (!needsUpdateAfterChangingDisabledAdaptations(previousDisabledAdaptations, disabledAdaptations))
+        return false;
+
+    updateMinimumLayoutSize();
+    updateConfiguration();
+    return true;
+}
+
 bool ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments)
 {
     if (m_viewportArguments == viewportArguments)
@@ -134,8 +169,11 @@
 
 bool ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit() const
 {
+    if (m_disabledAdaptations.contains(DisabledAdaptations::ExtraZoomMode))
+        return false;
+
     auto viewWidth = m_viewLayoutSize.width();
-    return m_viewportArguments.shrinkToFit != 0. && 0 < viewWidth && viewWidth < platformDeviceWidthOverride();
+    return 0 < viewWidth && viewWidth < platformDeviceWidthOverride();
 }
 
 bool ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints() const
@@ -368,7 +406,9 @@
     if (booleanViewportArgumentIsSet(m_viewportArguments.userZoom))
         m_configuration.allowsUserScaling = m_viewportArguments.userZoom != 0.;
 
-    if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
+    if (shouldOverrideShrinkToFitArgument())
+        m_configuration.allowsShrinkToFit = shouldOverrideDeviceWidthAndShrinkToFit();
+    else if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
         m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
 
     m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover;

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (231778 => 231779)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -25,10 +25,12 @@
 
 #pragma once
 
+#include "DisabledAdaptations.h"
 #include "FloatSize.h"
 #include "IntSize.h"
 #include "ViewportArguments.h"
 #include <wtf/Noncopyable.h>
+#include <wtf/OptionSet.h>
 
 namespace WTF {
 class TextStream;
@@ -74,16 +76,17 @@
     const IntSize& contentsSize() const { return m_contentSize; }
     WEBCORE_EXPORT bool setContentsSize(const IntSize&);
 
-    FloatSize viewLayoutSize() const { return m_viewLayoutSize; }
+    const FloatSize& viewLayoutSize() const { return m_viewLayoutSize; }
 
     const FloatSize& minimumLayoutSize() const { return m_minimumLayoutSize; }
     WEBCORE_EXPORT bool setViewLayoutSize(const FloatSize&);
 
+    const OptionSet<DisabledAdaptations>& disabledAdaptations() const { return m_disabledAdaptations; }
+    WEBCORE_EXPORT bool setDisabledAdaptations(const OptionSet<DisabledAdaptations>&);
+
     const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
     WEBCORE_EXPORT bool setViewportArguments(const ViewportArguments&);
 
-    bool shouldOverrideDeviceWidthAndShrinkToFit() const;
-
     WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool);
     void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
 
@@ -116,6 +119,7 @@
     int layoutWidth() const;
     int layoutHeight() const;
 
+    bool shouldOverrideDeviceWidthAndShrinkToFit() const;
     bool shouldIgnoreScalingConstraintsRegardlessOfContentSize() const;
     bool shouldIgnoreScalingConstraints() const;
     bool shouldIgnoreVerticalScalingConstraints() const;
@@ -129,6 +133,7 @@
     FloatSize m_minimumLayoutSize;
     FloatSize m_viewLayoutSize;
     ViewportArguments m_viewportArguments;
+    OptionSet<DisabledAdaptations> m_disabledAdaptations;
 
     bool m_canIgnoreScalingConstraints;
     bool m_forceAlwaysUserScalable;

Modified: trunk/Source/WebCore/page/WindowFeatures.cpp (231778 => 231779)


--- trunk/Source/WebCore/page/WindowFeatures.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/WindowFeatures.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -114,6 +114,19 @@
     }
 }
 
+OptionSet<DisabledAdaptations> parseDisabledAdaptations(const String& disabledAdaptationsString)
+{
+    OptionSet<DisabledAdaptations> disabledAdaptations;
+    Vector<String> disabledAdaptationNames;
+    disabledAdaptationsString.split(',', false, disabledAdaptationNames);
+    for (auto& name : disabledAdaptationNames) {
+        auto normalizedName = name.stripWhiteSpace().convertToASCIILowercase();
+        if (normalizedName == extraZoomModeAdaptationName())
+            disabledAdaptations |= DisabledAdaptations::ExtraZoomMode;
+    }
+    return disabledAdaptations;
+}
+
 static void setWindowFeature(WindowFeatures& features, StringView key, StringView value)
 {
     // Listing a key with no value is shorthand for key=yes

Modified: trunk/Source/WebCore/page/WindowFeatures.h (231778 => 231779)


--- trunk/Source/WebCore/page/WindowFeatures.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/page/WindowFeatures.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -28,6 +28,7 @@
 
 #pragma once
 
+#include "DisabledAdaptations.h"
 #include <wtf/Function.h>
 #include <wtf/Optional.h>
 #include <wtf/Vector.h>
@@ -59,6 +60,7 @@
 
 WindowFeatures parseWindowFeatures(StringView windowFeaturesString);
 WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect);
+OptionSet<DisabledAdaptations> parseDisabledAdaptations(const String&);
 
 enum class FeatureMode { Window, Viewport };
 void processFeaturesString(StringView features, FeatureMode, const WTF::Function<void(StringView type, StringView value)>& callback);

Modified: trunk/Source/WebCore/testing/Internals.cpp (231778 => 231779)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -53,6 +53,7 @@
 #include "DOMStringList.h"
 #include "DOMWindow.h"
 #include "DeprecatedGlobalSettings.h"
+#include "DisabledAdaptations.h"
 #include "DisplayList.h"
 #include "Document.h"
 #include "DocumentLoader.h"
@@ -4513,6 +4514,11 @@
 #endif
 }
 
+String Internals::extraZoomModeAdaptationName() const
+{
+    return WebCore::extraZoomModeAdaptationName();
+}
+
 bool Internals::usingAppleInternalSDK() const
 {
 #if USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebCore/testing/Internals.h (231778 => 231779)


--- trunk/Source/WebCore/testing/Internals.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/testing/Internals.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -664,6 +664,8 @@
     bool isSystemPreviewLink(Element&) const;
     bool isSystemPreviewImage(Element&) const;
 
+    String extraZoomModeAdaptationName() const;
+
     bool usingAppleInternalSDK() const;
 
 private:

Modified: trunk/Source/WebCore/testing/Internals.idl (231778 => 231779)


--- trunk/Source/WebCore/testing/Internals.idl	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebCore/testing/Internals.idl	2018-05-15 01:07:36 UTC (rev 231779)
@@ -596,5 +596,7 @@
     boolean isSystemPreviewLink(Element element);
     boolean isSystemPreviewImage(Element element);
 
+    DOMString extraZoomModeAdaptationName();
+
     boolean usingAppleInternalSDK();
 };

Modified: trunk/Source/WebKit/ChangeLog (231778 => 231779)


--- trunk/Source/WebKit/ChangeLog	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/ChangeLog	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1,3 +1,24 @@
+2018-05-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Google search results are excessively zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=185347
+        <rdar://problem/39999778>
+
+        Reviewed by Tim Horton.
+
+        Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
+        propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
+        extra zoom mode.
+
+        * Shared/WebPreferences.yaml:
+        * Shared/WebPreferencesDefaultValues.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::disabledAdaptationsDidChange):
+        * WebProcess/WebPage/WebPage.h:
+
 2018-05-14  Chris Dumez  <cdu...@apple.com>
 
         Overly aggressive timer throttling in service workers

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (231778 => 231779)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1283,3 +1283,11 @@
     category: experimental
     webcoreBinding: RuntimeEnabledFeatures
     webcoreName: serverTimingEnabled
+
+DisabledAdaptationsMetaTagEnabled:
+    type: bool
+    defaultValue: DISABLED_ADAPTATIONS_META_TAG_ENABLED
+    humanReadableName: "disabled-adaptations"
+    humanReadableDescription: "Enable the 'disabled-adaptations' meta tag"
+    category: experimental
+    webcoreBinding: RuntimeEnabledFeatures

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (231778 => 231779)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -178,9 +178,9 @@
 #endif
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-#define DEFAULT_MIN_DEVICE_WIDTH_ENABLED 1
+#define DISABLED_ADAPTATIONS_META_TAG_ENABLED true
 #else
-#define DEFAULT_MIN_DEVICE_WIDTH_ENABLED 0
+#define DISABLED_ADAPTATIONS_META_TAG_ENABLED false
 #endif
 
 // Cocoa ports must disable experimental features on release branches for now.

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (231778 => 231779)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1025,6 +1025,11 @@
 
 #endif
 
+void WebChromeClient::dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>& disabledAdaptations) const
+{
+    m_page.disabledAdaptationsDidChange(disabledAdaptations);
+}
+
 void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const
 {
     m_page.viewportPropertiesDidChange(viewportArguments);

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (231778 => 231779)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -284,6 +284,7 @@
     WebCore::FloatSize overrideScreenSize() const final;
 #endif
 
+    void dispatchDisabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&) const final;
     void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&) const final;
 
     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) final;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (231778 => 231779)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1788,6 +1788,16 @@
     return view->fixedLayoutSize();
 }
 
+void WebPage::disabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>& disabledAdaptations)
+{
+#if PLATFORM(IOS)
+    if (m_viewportConfiguration.setDisabledAdaptations(disabledAdaptations))
+        viewportConfigurationChanged();
+#else
+    UNUSED_PARAM(disabledAdaptations);
+#endif
+}
+
 void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArguments)
 {
 #if PLATFORM(IOS)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (231778 => 231779)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -50,6 +50,7 @@
 #include "WebUserContentController.h"
 #include <WebCore/ActivityState.h>
 #include <WebCore/DictionaryPopupInfo.h>
+#include <WebCore/DisabledAdaptations.h>
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/HTMLMenuElement.h>
 #include <WebCore/HTMLMenuItemElement.h>
@@ -558,6 +559,7 @@
     void elementDidBlur(WebCore::Node*);
     void resetAssistedNodeForFrame(WebFrame*);
 
+    void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
 

Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (231778 => 231779)


--- trunk/Source/WebKitLegacy/ios/ChangeLog	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog	2018-05-15 01:07:36 UTC (rev 231779)
@@ -1,3 +1,17 @@
+2018-05-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Google search results are excessively zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=185347
+        <rdar://problem/39999778>
+
+        Reviewed by Tim Horton.
+
+        Adds a WebKitLegacy method stub for disabled adaptation plumbing.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::dispatchDisabledAdaptationsDidChange const):
+
 2018-05-02  Eric Carlson  <eric.carl...@apple.com>
 
         [iOS] Provide audio route information when invoking AirPlay picker

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h (231778 => 231779)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2018-05-15 01:07:36 UTC (rev 231779)
@@ -59,6 +59,7 @@
     WebCore::FloatSize screenSize() const final;
     WebCore::FloatSize availableScreenSize() const final;
     WebCore::FloatSize overrideScreenSize() const final;
+    void dispatchDisabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&) const final;
     void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&) const final;
     void notifyRevealedSelectionByScrollingFrame(WebCore::Frame&) final;
     bool isStopping() final;

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm (231778 => 231779)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm	2018-05-15 00:32:06 UTC (rev 231778)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm	2018-05-15 01:07:36 UTC (rev 231779)
@@ -44,6 +44,7 @@
 #import "WebView.h"
 #import "WebViewInternal.h"
 #import "WebViewPrivate.h"
+#import <WebCore/DisabledAdaptations.h>
 #import <WebCore/FileChooser.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/Frame.h>
@@ -237,6 +238,10 @@
     [[webView() _UIKitDelegateForwarder] webView:webView() didReceiveViewportArguments:dictionaryForViewportArguments(arguments)];
 }
 
+void WebChromeClientIOS::dispatchDisabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&) const
+{
+}
+
 void WebChromeClientIOS::notifyRevealedSelectionByScrollingFrame(WebCore::Frame& frame)
 {
     [[webView() _UIKitDelegateForwarder] revealedSelectionByScrollingWebFrame:kit(&frame)];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to