Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
scalableNativeWebpageParameters() is not preserved on new page naviga…
…tion. https://bugs.webkit.org/show_bug.cgi?id=194892 <rdar://problem/47538280> Source/WebCore: 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. Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2019-02-25 Reviewed by Wenson Hsieh. 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. Source/WebKit: 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. Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2019-02-25 Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::resetViewportDefaultConfiguration): Use nativeWebpageParameters() instance method to get the appropriate default configuration. Tools: Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2019-02-25 Reviewed by Wenson Hsieh. 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): LayoutTests: Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2019-02-25 Reviewed by Wenson Hsieh. * 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. * fast/viewport/ios/minimum-scale-after-changing-view-scale.html: When shouldIgnoreMetaViewport setting is on, for pages don't have viewport meta-tag, the default configuration is now changed to scalableNativeWebpageParameters(). The original test was under the assumption that the default configuration is always fixedNativeWebpageParameters(). To keep the test still valid, add a viewport meta-tag to it. * resources/ui-helper.js: (window.UIHelper.setAllowsViewportShrinkToFit): Canonical link: https://commits.webkit.org/209392@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
88fd784
commit 4d6c96eb00a3557152b584b127abeca0749e13f0
Showing
18 changed files
with
208 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,6 @@ | ||
ALERT: pageshow - not from cache | ||
ALERT: pageshow - from cache | ||
window size: [1008, 1726] | ||
zoom scale: 0.32 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,64 @@ | ||
<!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(""); | ||
|
||
await UIHelper.setAllowsViewportShrinkToFit(false); | ||
await Promise.all([UIHelper.ensureVisibleContentRectUpdate(), UIHelper.ensurePresentationUpdate()]); | ||
|
||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -94,6 +94,10 @@ | ||
{ | ||
} | ||
|
||
void UIScriptController::setAllowsViewportShrinkToFit(bool) | ||
{ | ||
} | ||
|
||
void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef) | ||
{ | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -101,6 +101,10 @@ | ||
{ | ||
} | ||
|
||
void UIScriptController::setAllowsViewportShrinkToFit(bool) | ||
{ | ||
} | ||
|
||
void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef) | ||
{ | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -241,6 +241,10 @@ void UIScriptController::setMinimumEffectiveWidth(double) | ||
{ | ||
} | ||
|
||
void UIScriptController::setAllowsViewportShrinkToFit(bool) | ||
{ | ||
} | ||
|
||
void UIScriptController::resignFirstResponder() | ||
{ | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters