WebKit Bugzilla
Attachment 362585 Details for
Bug 194892
: scalableNativeWebpageParameters() is not preserved on new page navigation.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
preserve_scalable_parameters.patch (text/plain), 16.43 KB, created by
Yongjun Zhang
on 2019-02-20 20:55:42 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yongjun Zhang
Created:
2019-02-20 20:55:42 PST
Size:
16.43 KB
patch
obsolete
>commit 7574ecb778e66fc250a18fd5807a0b93a654c584 >Author: Yongjun Zhang <yongjun_zhang@apple.com> >Date: Mon Feb 11 22:27:21 2019 -0800 > > scalableNativeWebpageParameters() is not preserved on new page navigation. > https://bugs.webkit.org/show_bug.cgi?id=194892 > <rdar://problem/47538280> > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f344270aabe..699c710dbb3 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-02-20 Yongjun Zhang <yongjun_zhang@apple.com> >+ >+ scalableNativeWebpageParameters() is not preserved on new page navigation. >+ https://bugs.webkit.org/show_bug.cgi?id=194892 >+ <rdar://problem/47538280> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/viewport/ios/resources/go-back.html: Added. >+ * fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation-expected.txt: Added. >+ * fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html: Added. >+ * resources/ui-helper.js: >+ (window.UIHelper.setAllowsViewportShrinkToFit): >+ > 2019-02-20 Antti Koivisto <antti@apple.com> > > Make programmatic frame scrolling work on iOS >diff --git a/LayoutTests/fast/viewport/ios/resources/go-back.html b/LayoutTests/fast/viewport/ios/resources/go-back.html >new file mode 100644 >index 00000000000..fdad3c4cc09 >--- /dev/null >+++ b/LayoutTests/fast/viewport/ios/resources/go-back.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ shouldIgnoreMetaViewport=true ] --> >+ >+This page should go back. >+<script> >+ window.addEventListener("load", function() { >+ setTimeout(function() { >+ history.back(); >+ }, 0); >+ }, false); >+</script> >diff --git a/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation-expected.txt b/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation-expected.txt >new file mode 100644 >index 00000000000..38f781d6556 >--- /dev/null >+++ b/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation-expected.txt >@@ -0,0 +1,6 @@ >+ALERT: pageshow - not from cache >+ALERT: pageshow - from cache >+window size: [1008, 1726] >+zoom scale: 0.32 >+ >+ >diff --git a/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html b/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html >new file mode 100644 >index 00000000000..adb758334ae >--- /dev/null >+++ b/LayoutTests/fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html >@@ -0,0 +1,61 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ shouldIgnoreMetaViewport=true ] --> >+ >+<html> >+<head> >+ <script src="../../../resources/ui-helper.js"></script> >+ <script> >+ if (window.testRunner) { >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+ } >+ >+ async function finishTest() { >+ const appendOutput = message => { >+ output.appendChild(document.createTextNode(message)); >+ output.appendChild(document.createElement("br")); >+ }; >+ >+ appendOutput(`window size: [${innerWidth}, ${innerHeight}]`); >+ appendOutput(`zoom scale: ${(await UIHelper.zoomScale()).toFixed(2)}`); >+ appendOutput(""); >+ >+ testRunner.notifyDone(); >+ } >+ >+ async function setUp() { >+ await UIHelper.setAllowsViewportShrinkToFit(true); >+ await Promise.all([UIHelper.ensureVisibleContentRectUpdate(), UIHelper.ensurePresentationUpdate()]); >+ } >+ >+ window.addEventListener("pageshow", function(event) { >+ alert("pageshow - " + (event.persisted ? "" : "not ") + "from cache"); >+ if (event.persisted) >+ setTimeout(finishTest, 0); >+ else >+ setUp(); >+ >+ }, false); >+ >+ // Force a back navigation back to this page. >+ window.addEventListener("load", function(event) { >+ setTimeout(function() { >+ window.testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1); >+ window.location.href = "resources/go-back.html"; >+ }, 0); >+ }, false); >+ </script> >+ >+ <style> >+ .wide { >+ height: 1px; >+ width: 1000px; >+ background-color: gray; >+ } >+ </style> >+</head> >+ >+<body> >+<div class="wide"></div> >+<pre id="output"></pre> >+</body> >+</html> >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 4de0d14ea2a..ca431fe9ce4 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -636,6 +636,14 @@ window.UIHelper = class UIHelper { > return new Promise(resolve => testRunner.runUIScript(`uiController.setMinimumEffectiveWidth(${effectiveWidth})`, resolve)); > } > >+ static setAllowsViewportShrinkToFit(allows) >+ { >+ if (!this.isWebKit2()) >+ return Promise.resolve(); >+ >+ return new Promise(resolve => testRunner.runUIScript(`uiController.setAllowsViewportShrinkToFit(${allows})`, resolve)); >+ } >+ > static setKeyboardInputModeIdentifier(identifier) > { > if (!this.isWebKit2()) >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7ceda86a608..156c475cf70 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-02-20 Yongjun Zhang <yongjun_zhang@apple.com> >+ >+ scalableNativeWebpageParameters() is not preserved on new page navigation. >+ https://bugs.webkit.org/show_bug.cgi?id=194892 >+ <rdar://problem/47538280> >+ >+ If a page's current default viewport configuration is scalableNativeWebpageParameters due to >+ the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this >+ configuration until we derive the right values from viewport meta-tag. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html >+ >+ * page/ViewportConfiguration.cpp: >+ (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters(). >+ (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters. >+ (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration >+ based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth(). >+ (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters() >+ (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters. >+ * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old >+ static method to fixedNativeWebpageParameters which better reflects the actual behavior. >+ > 2019-02-20 Dean Jackson <dino@apple.com> > > Rotation animations sometimes use the wrong origin (affects apple.com) >diff --git a/Source/WebCore/page/ViewportConfiguration.cpp b/Source/WebCore/page/ViewportConfiguration.cpp >index ca9cd96850c..b1d6928cabe 100644 >--- a/Source/WebCore/page/ViewportConfiguration.cpp >+++ b/Source/WebCore/page/ViewportConfiguration.cpp >@@ -145,7 +145,7 @@ bool ViewportConfiguration::setDisabledAdaptations(const OptionSet<DisabledAdapt > > bool ViewportConfiguration::canOverrideConfigurationParameters() const > { >- return m_defaultConfiguration == ViewportConfiguration::nativeWebpageParameters() || m_defaultConfiguration == ViewportConfiguration::scalableNativeWebpageParameters(); >+ return m_defaultConfiguration == ViewportConfiguration::fixedNativeWebpageParameters() || m_defaultConfiguration == ViewportConfiguration::scalableNativeWebpageParameters(); > } > > void ViewportConfiguration::updateDefaultConfiguration() >@@ -153,15 +153,7 @@ void ViewportConfiguration::updateDefaultConfiguration() > if (!canOverrideConfigurationParameters()) > return; > >- if (m_canIgnoreScalingConstraints) { >- m_defaultConfiguration = ViewportConfiguration::scalableNativeWebpageParameters(); >- return; >- } >- >- if (shouldIgnoreMinimumEffectiveDeviceWidth()) >- m_defaultConfiguration = ViewportConfiguration::nativeWebpageParameters(); >- else >- m_defaultConfiguration = ViewportConfiguration::scalableNativeWebpageParameters(); >+ m_defaultConfiguration = nativeWebpageParameters(); > } > > bool ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments) >@@ -334,6 +326,14 @@ bool ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable() const > } > > ViewportConfiguration::Parameters ViewportConfiguration::nativeWebpageParameters() >+{ >+ if (m_canIgnoreScalingConstraints || !shouldIgnoreMinimumEffectiveDeviceWidth()) >+ return ViewportConfiguration::scalableNativeWebpageParameters(); >+ >+ return ViewportConfiguration::fixedNativeWebpageParameters(); >+} >+ >+ViewportConfiguration::Parameters ViewportConfiguration::fixedNativeWebpageParameters() > { > Parameters parameters; > parameters.width = ViewportArguments::ValueDeviceWidth; >@@ -350,7 +350,7 @@ ViewportConfiguration::Parameters ViewportConfiguration::nativeWebpageParameters > > ViewportConfiguration::Parameters ViewportConfiguration::scalableNativeWebpageParameters() > { >- Parameters parameters = ViewportConfiguration::nativeWebpageParameters(); >+ Parameters parameters = ViewportConfiguration::fixedNativeWebpageParameters(); > parameters.allowsShrinkToFit = true; > parameters.minimumScale = 0.25; > return parameters; >diff --git a/Source/WebCore/page/ViewportConfiguration.h b/Source/WebCore/page/ViewportConfiguration.h >index 63766df72f1..24181f003da 100644 >--- a/Source/WebCore/page/ViewportConfiguration.h >+++ b/Source/WebCore/page/ViewportConfiguration.h >@@ -102,7 +102,8 @@ public: > bool avoidsUnsafeArea() const { return m_configuration.avoidsUnsafeArea; } > > // Matches a width=device-width, initial-scale=1 viewport. >- WEBCORE_EXPORT static Parameters nativeWebpageParameters(); >+ WEBCORE_EXPORT Parameters nativeWebpageParameters(); >+ static Parameters fixedNativeWebpageParameters(); > static Parameters scalableNativeWebpageParameters(); > WEBCORE_EXPORT static Parameters webpageParameters(); > WEBCORE_EXPORT static Parameters textDocumentParameters(); >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 92c66d4dcfa..a0d3ee33e93 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2019-02-20 Yongjun Zhang <yongjun_zhang@apple.com> >+ >+ scalableNativeWebpageParameters() is not preserved on new page navigation. >+ https://bugs.webkit.org/show_bug.cgi?id=194892 >+ <rdar://problem/47538280> >+ >+ If a page's current default viewport configuration is scalableNativeWebpageParameters due to >+ the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this >+ configuration until we derive the right values from viewport meta-tag. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::resetViewportDefaultConfiguration): Use nativeWebpageParameters() instance method to >+ get the appropriate default configuration. >+ > 2019-02-20 Antti Koivisto <antti@apple.com> > > Make programmatic frame scrolling work on iOS >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index e15e79be153..d38ccf32b57 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2810,7 +2810,7 @@ void WebPage::resetViewportDefaultConfiguration(WebFrame* frame, bool hasMobileD > > auto parametersForStandardFrame = [&] { > if (m_page->settings().shouldIgnoreMetaViewport()) >- return ViewportConfiguration::nativeWebpageParameters(); >+ return m_viewportConfiguration.nativeWebpageParameters(); > > return ViewportConfiguration::webpageParameters(); > }; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index fa409e79237..23b137c9a2d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,24 @@ >+2019-02-20 Yongjun Zhang <yongjun_zhang@apple.com> >+ >+ scalableNativeWebpageParameters() is not preserved on new page navigation. >+ https://bugs.webkit.org/show_bug.cgi?id=194892 >+ <rdar://problem/47538280> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allow UIScriptController to set WKWebView's _allowsViewportShrinkToFit property with a new `setAllowsViewportShrinkToFit` method. >+ >+ * DumpRenderTree/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::setAllowsViewportShrinkToFit): >+ * DumpRenderTree/mac/UIScriptControllerMac.mm: >+ (WTR::UIScriptController::allowsViewportShrinkToFit): >+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: >+ (WTR::UIScriptController::setAllowsViewportShrinkToFit): >+ * TestRunnerShared/UIScriptContext/UIScriptController.h: >+ * WebKitTestRunner/UIScriptControllerCocoa.mm: >+ (WTR::UIScriptController::setAllowsViewportShrinkToFit): >+ > 2019-02-20 Don Olmstead <don.olmstead@sony.com> > > [CMake][Win] Only build DumpRenderTree when WebKit Legacy is enabled >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index ffb4dea6a2c..3c83db0f59b 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -94,6 +94,10 @@ void UIScriptController::setMinimumEffectiveWidth(double) > { > } > >+void UIScriptController::setAllowsViewportShrinkToFit(bool) >+{ >+} >+ > void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef) > { > } >diff --git a/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm b/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm >index 023c20723ca..a5b4f728e67 100644 >--- a/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm >+++ b/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm >@@ -101,6 +101,10 @@ void UIScriptController::setMinimumEffectiveWidth(double) > { > } > >+void UIScriptController::allowsViewportShrinkToFit(bool) >+{ >+} >+ > void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef) > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index 3a9c3e29b9c..ddee8d9b6ae 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -234,6 +234,7 @@ interface UIScriptController { > > void setViewScale(double scale); > void setMinimumEffectiveWidth(double effectiveWidth); >+ void setAllowsViewportShrinkToFit(boolean allows); > > void resignFirstResponder(); > readonly attribute boolean isPresentingModally; >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index b9472d0fd17..981d339d3f1 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -241,6 +241,10 @@ void UIScriptController::setMinimumEffectiveWidth(double) > { > } > >+void UIScriptController::setAllowsViewportShrinkToFit(bool) >+{ >+} >+ > void UIScriptController::resignFirstResponder() > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index 5f335ed2139..43a8dff367d 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -72,6 +72,7 @@ public: > void zoomToScale(double scale, JSValueRef callback); > void setViewScale(double); > void setMinimumEffectiveWidth(double); >+ void setAllowsViewportShrinkToFit(bool); > > void resignFirstResponder(); > >diff --git a/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm b/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >index 74f381331d2..5fafed4e3fc 100644 >--- a/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >@@ -54,6 +54,15 @@ void UIScriptController::setMinimumEffectiveWidth(double effectiveWidth) > #endif > } > >+void UIScriptController::setAllowsViewportShrinkToFit(bool allows) >+{ >+#if WK_API_ENABLED >+ TestController::singleton().mainWebView()->platformView()._allowsViewportShrinkToFit = allows; >+#else >+ UNUSED_PARAM(allows); >+#endif >+} >+ > void UIScriptController::resignFirstResponder() > { > #if WK_API_ENABLED
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 194892
:
362585
|
362594
|
362598
|
362619
|
362630
|
362642
|
362670
|
362768
|
362953