[Web App Manifest] Support display-mode media feature
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 20:04:37 +0000 (20:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 20:04:37 +0000 (20:04 +0000)
commit63f68a6078e1db6bc8da47f423bd2bc50f5a11ff
tree00bfcf2b757f83ad7b9ebce5bbf9c38f02314d81
parent7ccc644065760cfa0dcce07f850d4e6ace7a3b41
[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
28 files changed:
LayoutTests/ChangeLog
LayoutTests/applicationmanifest/display-mode-expected.txt [new file with mode: 0644]
LayoutTests/applicationmanifest/display-mode-no-manifest-expected.txt [new file with mode: 0644]
LayoutTests/applicationmanifest/display-mode-no-manifest.html [new file with mode: 0644]
LayoutTests/applicationmanifest/display-mode-subframe-expected.txt [new file with mode: 0644]
LayoutTests/applicationmanifest/display-mode-subframe.html [new file with mode: 0644]
LayoutTests/applicationmanifest/display-mode.html [new file with mode: 0644]
LayoutTests/applicationmanifest/resources/display-mode-subframe-1.html [new file with mode: 0644]
LayoutTests/applicationmanifest/resources/standalone.manifest [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h
Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/MediaFeatureNames.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryExpression.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h
Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp
Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/display-mode.html [new file with mode: 0644]
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm