Allow override of viewport configuration.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 22:31:18 +0000 (22:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 22:31:18 +0000 (22:31 +0000)
commit61cee8bcadab3cff4c63ea7daa0c5959fd764f85
tree1b8ab55ac80f8e4a1e2bf7b99d5867730d2e71d4
parentca9b49165d27909939f13f5459583db5c871979c
Allow override of viewport configuration.
https://bugs.webkit.org/show_bug.cgi?id=188772.
<rdar://problem/43538892>.

Patch by James Savage <james.savage@apple.com> on 2018-09-26
Reviewed by Simon Fraser.

Source/WebCore:

* page/Settings.yaml:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::nativeWebpageParameters): Provide a viewport configuration
similar to width=device-width, with initial scale set to 1.
* page/ViewportConfiguration.h:

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setShouldIgnoreMetaViewport:]):
(-[WKPreferences _shouldIgnoreMetaViewport]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::viewportPropertiesDidChange): If we are ignoring the
<meta> viewport, short circuit calling setViewportArguments() and do not
do any updates.
(WebKit::WebPage::didCommitLoad): Ditto.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::resetViewportDefaultConfiguration): Select the default
configuration based on UIProcess setting.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader): Parse new test option key from comments.
* WebKitTestRunner/TestOptions.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformConfigureViewForTest): Handle new test option by
modifying the web view's preferences accordingly.

LayoutTests:

Add test proving that a document without a meta viewport specifying
width=device-width still gets a layout when this setting is enabled. I also
added a baseline case to prove that without this setting we do not layout
at device width.

* fast/viewport/ios/ipad/empty-viewport-expected.txt: Added.
* fast/viewport/ios/ipad/empty-viewport.html: Added.
* fast/viewport/ios/ipad/meta-viewport-disabled-expected.txt: Added.
* fast/viewport/ios/ipad/meta-viewport-disabled.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/viewport/ios/ipad/empty-meta-expected.txt [new file with mode: 0644]
LayoutTests/fast/viewport/ios/ipad/empty-meta.html [new file with mode: 0644]
LayoutTests/fast/viewport/ios/ipad/meta-viewport-ignored-expected.txt [new file with mode: 0644]
LayoutTests/fast/viewport/ios/ipad/meta-viewport-ignored.html [new file with mode: 0644]
LayoutTests/fast/viewport/ios/resources/viewport-test-utils.js
Source/WebCore/ChangeLog
Source/WebCore/page/Settings.yaml
Source/WebCore/page/ViewportConfiguration.cpp
Source/WebCore/page/ViewportConfiguration.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/ios/TestControllerIOS.mm