WebKit Bugzilla
Attachment 340340 Details for
Bug 185347
: [Extra zoom mode] Google search results are excessively zoomed in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185347-20180514122556.patch (text/plain), 51.09 KB, created by
Wenson Hsieh
on 2018-05-14 12:25:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-05-14 12:25:57 PDT
Size:
51.09 KB
patch
obsolete
>Subversion Revision: 231737 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 80c27c853b14578ce5b3ff68c07bfaef9dae5d76..f8d33b8e5b9d8b6ace72863e451d29e3b2312dcd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,112 @@ >+2018-05-14 Wenson Hsieh <wenson_hsieh@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 NOBODY (OOPS!). >+ >+ 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/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-12 Zalan Bujtas <zalan@apple.com> > > Use WeakPtr for m_enclosingPaginationLayer in RenderLayer >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f2ec028e926944fc7bc0c22f1001c98270c19bd3..be31bf013d30976b2f2092b3dc6118228e457b4d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2018-05-14 Wenson Hsieh <wenson_hsieh@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 NOBODY (OOPS!). >+ >+ 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-11 Daniel Bates <dabates@apple.com> > > X-Frame-Options: SAMEORIGIN needs to check all ancestor frames >diff --git a/Source/WebKitLegacy/ios/ChangeLog b/Source/WebKitLegacy/ios/ChangeLog >index 1200f2211019982e0d01156b43539940517e0fae..e1d8e26a3bc8b0c9a37f77f7eb8ba049c5ec31a0 100644 >--- a/Source/WebKitLegacy/ios/ChangeLog >+++ b/Source/WebKitLegacy/ios/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-14 Wenson Hsieh <wenson_hsieh@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 NOBODY (OOPS!). >+ >+ Adds a WebKitLegacy method stub for disabled adaptation plumbing. >+ >+ * WebCoreSupport/WebChromeClientIOS.h: >+ * WebCoreSupport/WebChromeClientIOS.mm: >+ (WebChromeClientIOS::dispatchDisabledAdaptationsDidChange const): >+ > 2018-05-02 Eric Carlson <eric.carlson@apple.com> > > [iOS] Provide audio route information when invoking AirPlay picker >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index c7045af86c02d93897b8eb88121d9090fd8ca033..ff7ddbcfd07ba7c3abfd32e8e8b4e7b281a97ab2 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1355,6 +1355,7 @@ page/DebugPageOverlays.cpp > page/DeprecatedGlobalSettings.cpp > page/DeviceController.cpp > page/DiagnosticLoggingKeys.cpp >+page/DisabledAdaptations.cpp > page/DragController.cpp > page/EventHandler.cpp > page/EventSource.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index e5bb1b8c63209663bf55d1aecbf4de3ed852948e..8aa2cc8375af720c91d71da515bc5bdca181c190 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -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 */, >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 95a3033408177ab8d2f4b3bd9bd5b7cac39aa12a..1dc3a3bd43e29a04e5fd18e3c30292b3f3c7d9d0 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -3399,6 +3399,18 @@ void Document::processHttpEquiv(const String& equiv, const String& content, bool > } > } > >+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()); >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index b9eff10963e4b428e0ed238c93c5babc541b9a58..3a409090bb3574ac942e376ed85da8035d120f3c 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -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 @@ public: > > 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 @@ public: > #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 @@ private: > Timer m_loadEventDelayTimer; > > ViewportArguments m_viewportArguments; >+ OptionSet<DisabledAdaptations> m_disabledAdaptations; > > DocumentTiming m_documentTiming; > >diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp >index a5cde400dc36941ade2c50efe3882f0880bfa89c..edc38b3cd6445570bef75607ebfe0b3b6ee29620 100644 >--- a/Source/WebCore/html/HTMLMetaElement.cpp >+++ b/Source/WebCore/html/HTMLMetaElement.cpp >@@ -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 @@ void HTMLMetaElement::process() > > 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); >diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >index 31754c161e8f400dd68c6d86d8cd7a18ae3724c6..aa6e839b3a808e160e28d36533c617a68ddee8a1 100644 >--- a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >+++ b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >@@ -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 @@ public: > , m_linkIsStyleSheet(false) > , m_linkIsPreload(false) > , m_metaIsViewport(false) >+ , m_metaIsDisabledAdaptations(false) > , m_inputIsImage(false) > , m_deviceScaleFactor(deviceScaleFactor) > { >@@ -142,6 +144,9 @@ public: > > 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 @@ private: > 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 @@ private: > 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 }; >diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp >index a204b4f68b3442eb0ebb1f14226d963c12ef56d8..16bf82355fe06836d4330ab1a806e553b4a0f581 100644 >--- a/Source/WebCore/loader/FrameLoader.cpp >+++ b/Source/WebCore/loader/FrameLoader.cpp >@@ -1947,6 +1947,7 @@ void FrameLoader::commitProvisionalLoad() > 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()) >diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp >index d4d57efcfa9214f1fe6a95d86d651e4fd7408af8..e04a90fa50aa6d80f0da75010c94af2436437798 100644 >--- a/Source/WebCore/page/Chrome.cpp >+++ b/Source/WebCore/page/Chrome.cpp >@@ -448,6 +448,11 @@ FloatSize Chrome::overrideScreenSize() const > 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) >diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h >index 45d3f8bf099c953510cdc8f4434378ade1e3545e..2174cbe126df5f34c02329726faf625d6a211135 100644 >--- a/Source/WebCore/page/Chrome.h >+++ b/Source/WebCore/page/Chrome.h >@@ -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 @@ public: > void runOpenPanel(Frame&, FileChooser&); > void loadIconForFiles(const Vector<String>&, FileIconLoader&); > >+ void dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>&) const; > void dispatchViewportPropertiesDidChange(const ViewportArguments&) const; > > bool requiresFullscreenForVideoPlayback(); >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index f19927dc21b219b39c942eb950b331f72dae7254..e2422370e7edef4459edef0091b1ef6dfb3efbd2 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -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 @@ public: > 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; >diff --git a/Source/WebCore/page/DisabledAdaptations.cpp b/Source/WebCore/page/DisabledAdaptations.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b2e35b72bea2ae8228374494f73e495b3ee588fe >--- /dev/null >+++ b/Source/WebCore/page/DisabledAdaptations.cpp >@@ -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 >diff --git a/Source/WebCore/page/DisabledAdaptations.h b/Source/WebCore/page/DisabledAdaptations.h >new file mode 100644 >index 0000000000000000000000000000000000000000..27ce06bb5e45669b4697787d042abad4c253c156 >--- /dev/null >+++ b/Source/WebCore/page/DisabledAdaptations.h >@@ -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 >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index 633e3b97f7d65035139365d58e2df0d73b8d4279..66448a370c902b98efbb96448875753122214baf 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -358,6 +358,14 @@ uint64_t Page::renderTreeSize() const > 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(); >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index 3ebd041b4779af45ae5013063bb8a00e88ac487d..5cc15e8beeeae886c992dedba856bf69d4c35442 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -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 @@ public: > > WEBCORE_EXPORT void setNeedsRecalcStyleInAllFrames(); > >+ WEBCORE_EXPORT OptionSet<DisabledAdaptations> disabledAdaptations() const; > WEBCORE_EXPORT ViewportArguments viewportArguments() const; > > static void refreshPlugins(bool reload); >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index d7611254d68e3830b9cba45dc35c73361389e631..c6554b7608f6735672ead85e65e60e67335de5d2 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -262,6 +262,9 @@ public: > 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 @@ private: > > bool m_isServerTimingEnabled { false }; > >+ bool m_disabledAdaptationsMetaTagEnabled { false }; >+ > friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>; > }; > >diff --git a/Source/WebCore/page/ViewportConfiguration.cpp b/Source/WebCore/page/ViewportConfiguration.cpp >index 3126d9f7b9cc93a4062981b2ad9e7db133e6bfd5..f45902e3e130903dd25dc433ec267f389a0178e0 100644 >--- a/Source/WebCore/page/ViewportConfiguration.cpp >+++ b/Source/WebCore/page/ViewportConfiguration.cpp >@@ -54,6 +54,28 @@ static float platformDeviceWidthOverride() > #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 @@ bool ViewportConfiguration::setViewLayoutSize(const FloatSize& viewLayoutSize) > 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 @@ IntSize ViewportConfiguration::layoutSize() const > > 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 @@ void ViewportConfiguration::updateConfiguration() > 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; >diff --git a/Source/WebCore/page/ViewportConfiguration.h b/Source/WebCore/page/ViewportConfiguration.h >index f790cf60db838dd8c5c677fc9fa494a6fa1bed6d..266dbd7537509127a5932b0d27dd5cc79202450e 100644 >--- a/Source/WebCore/page/ViewportConfiguration.h >+++ b/Source/WebCore/page/ViewportConfiguration.h >@@ -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 @@ public: > 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 @@ private: > int layoutWidth() const; > int layoutHeight() const; > >+ bool shouldOverrideDeviceWidthAndShrinkToFit() const; > bool shouldIgnoreScalingConstraintsRegardlessOfContentSize() const; > bool shouldIgnoreScalingConstraints() const; > bool shouldIgnoreVerticalScalingConstraints() const; >@@ -129,6 +133,7 @@ private: > FloatSize m_minimumLayoutSize; > FloatSize m_viewLayoutSize; > ViewportArguments m_viewportArguments; >+ OptionSet<DisabledAdaptations> m_disabledAdaptations; > > bool m_canIgnoreScalingConstraints; > bool m_forceAlwaysUserScalable; >diff --git a/Source/WebCore/page/WindowFeatures.cpp b/Source/WebCore/page/WindowFeatures.cpp >index 666c20cc85f5193fe648b9c068f938eb33609337..11d0efa09c6e00ad31bbedc9ecaf60bea93f0322 100644 >--- a/Source/WebCore/page/WindowFeatures.cpp >+++ b/Source/WebCore/page/WindowFeatures.cpp >@@ -114,6 +114,19 @@ void processFeaturesString(StringView features, FeatureMode mode, const WTF::Fun > } > } > >+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 >diff --git a/Source/WebCore/page/WindowFeatures.h b/Source/WebCore/page/WindowFeatures.h >index 2abd83b6c4addfee7fc0a4ccb5aff107cece9322..22b86a90f5d134beded99952110b80d8939bf239 100644 >--- a/Source/WebCore/page/WindowFeatures.h >+++ b/Source/WebCore/page/WindowFeatures.h >@@ -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 @@ struct WindowFeatures { > > 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); >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 81a4009533f9cdf19b263f862513ba82b9335b40..7043b8536393389add8f0b2a22115cf194d3bc9b 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -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" >@@ -4505,6 +4506,11 @@ bool Internals::isSystemPreviewImage(Element& element) const > #endif > } > >+String Internals::extraZoomModeAdaptationName() const >+{ >+ return WebCore::extraZoomModeAdaptationName(); >+} >+ > bool Internals::usingAppleInternalSDK() const > { > #if USE(APPLE_INTERNAL_SDK) >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 1b83bcb18de773c5f34a5060572d4985ab9df2c1..7ab12c104e4c5736e668fc22b366ba302bb26359 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -661,6 +661,8 @@ public: > bool isSystemPreviewLink(Element&) const; > bool isSystemPreviewImage(Element&) const; > >+ String extraZoomModeAdaptationName() const; >+ > bool usingAppleInternalSDK() const; > > private: >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 8d9c267cdde0d465dbff7734e92b660c478fc388..7404689c1feabfc9bf7e947d297391cb714c9f10 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -593,5 +593,7 @@ enum EventThrottlingBehavior { > boolean isSystemPreviewLink(Element element); > boolean isSystemPreviewImage(Element element); > >+ DOMString extraZoomModeAdaptationName(); >+ > boolean usingAppleInternalSDK(); > }; >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index b54dc1357d04bce3ee08d81c3d444f79cda707f7..89abf5940c5dd146296533201cdc9e0be3d1c6ec 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1283,3 +1283,11 @@ ServerTimingEnabled: > 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 >diff --git a/Source/WebKit/Shared/WebPreferencesDefaultValues.h b/Source/WebKit/Shared/WebPreferencesDefaultValues.h >index 194e026413b562134fa51132d0c7749da27d600d..d09b3895d392eb421e363f9cb97c16cf318c67d4 100644 >--- a/Source/WebKit/Shared/WebPreferencesDefaultValues.h >+++ b/Source/WebKit/Shared/WebPreferencesDefaultValues.h >@@ -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. >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index dfc2a37662d921bca2e68864ce0071ac4196e70f..64ef63e11c72e58452fcad7eacdb45801b33335b 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -1025,6 +1025,11 @@ FloatSize WebChromeClient::overrideScreenSize() const > > #endif > >+void WebChromeClient::dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>& disabledAdaptations) const >+{ >+ m_page.disabledAdaptationsDidChange(disabledAdaptations); >+} >+ > void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const > { > m_page.viewportPropertiesDidChange(viewportArguments); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 1aa97ebc2c6ab01d56be1a795b4038342127bbc9..5846ae3c4bc205da93079a47e9f2e73c803d5e6b 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -284,6 +284,7 @@ private: > 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; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index c0bc4dee3ae0e6c23090c5c71b31dfbdec2c1e60..45a2356f4d7511b50f1ad80c03a5e27ae741c06d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -1788,6 +1788,16 @@ IntSize WebPage::fixedLayoutSize() const > 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) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 33f1bec487a7a9c010c77badd40f70116bf97c79..523b56645a09ce4e6feeefc2aa6abcd7fd14428a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -558,6 +558,7 @@ public: > 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); > >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >index c7dbeda2617cad4aa637a4625e9eb34f3df2a3f3..bc1583c1636b78a0792d484d02e4e93b834845f3 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >@@ -59,6 +59,7 @@ private: > 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; >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >index 0bf0c9516c14050e8721139920b6516baf65f411..c701870f4e0f1ecfc37918bb6b5dc38d1600c77f 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >@@ -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 @@ void WebChromeClientIOS::dispatchViewportPropertiesDidChange(const WebCore::View > [[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)]; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 6ab4ded78f199668894cf5ee0ca54fdebfd1a28d..424d5f769b1eb0bd7ee2c2ef9e487fef0516f21a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-14 Wenson Hsieh <wenson_hsieh@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 NOBODY (OOPS!). >+ >+ 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-12 Wenson Hsieh <wenson_hsieh@apple.com> > > Unreviewed, rebaseline a layout test after r231717 >diff --git a/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html b/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html >deleted file mode 100644 >index 50cd4e924198afd0b0be212ef94fe47f4e2ac0da..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html >+++ /dev/null >@@ -1,60 +0,0 @@ >-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> >-<html> >-<meta name="viewport" id="meta"> >-<head> >- <script src="../../../resources/js-test.js"></script> >- <script src="../../../resources/ui-helper.js"></script> >- <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> >diff --git a/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html b/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html >new file mode 100644 >index 0000000000000000000000000000000000000000..54e29a2d49f1708132daa9a815bb053c1350d0a0 >--- /dev/null >+++ b/LayoutTests/fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html >@@ -0,0 +1,107 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<meta name="viewport"> >+<head> >+ <script src="../../../resources/js-test.js"></script> >+ <script src="../../../resources/ui-helper.js"></script> >+ <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>
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 185347
:
339660
|
339665
|
339913
|
339915
|
339919
|
340340
|
340349