[Web App Manifest] Support display-mode media feature
https://bugs.webkit.org/show_bug.cgi?id=180376
rdar://problem/
35837993
Patch by David Quesada <david_quesada@apple.com> on 2017-12-07
Reviewed by Geoffrey Garen.
Source/WebCore:
Tests: applicationmanifest/display-mode-subframe.html
applicationmanifest/display-mode.html
* Modules/applicationmanifest/ApplicationManifest.h:
(WebCore::ApplicationManifest::encode const):
(WebCore::ApplicationManifest::decode):
* Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseManifest):
(WebCore::ApplicationManifestParser::parseDisplay):
* Modules/applicationmanifest/ApplicationManifestParser.h:
Add a 'display' property to ApplicationManifest and have ApplicationManifestParser
populate it by parsing the 'display' property from the raw manifest.
* css/CSSValueKeywords.in:
* css/MediaFeatureNames.h:
* css/MediaQueryEvaluator.cpp:
(WebCore::displayModeEvaluate):
To evaluate whether a display-mode query matches, compare the parameter to the
display mode of the manifest applied to the main frame. If there is no manifest,
use the fallback display mode 'browser' - the spec mandates that display-mode
must be exposed even if there is no applied manifest.
* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent):
(WebCore::isFeatureValidWithoutValue):
Source/WebKit:
* UIProcess/API/Cocoa/_WKApplicationManifest.h:
* UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(-[_WKApplicationManifest initWithCoder:]):
(-[_WKApplicationManifest encodeWithCoder:]):
(-[_WKApplicationManifest displayMode]):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp:
(WebCore::operator<<):
(ApplicationManifestParserTest::testDisplay):
(TEST_F):
Add unit tests for the parsing of the 'display' manifest property.
* TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/display-mode.html: Added.
Update API tests to include _WKApplicationManifest.displayMode.
* WebKitTestRunner/TestController.cpp:
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView):
Teach WKTR to look for and apply an app manifest. A new <!--webkit-test-runner-->
directive 'applicationManifest' can specify a path (relative to the test file itself)
to a JSON app manifest to be applied to the web view before running the test.
LayoutTests:
* applicationmanifest/display-mode-expected.txt: Added.
* applicationmanifest/display-mode-subframe-expected.txt: Added.
* applicationmanifest/display-mode-subframe.html: Added.
* applicationmanifest/display-mode.html: Added.
* applicationmanifest/resources/display-mode-subframe-1.html: Added.
* applicationmanifest/resources/standalone.manifest: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225639
268f45cc-cd09-0410-ab3c-
d52691b4dbfc