WebsitePolicies: let clients select specific autoplay quirks
authormrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 00:32:21 +0000 (00:32 +0000)
committermrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 00:32:21 +0000 (00:32 +0000)
commit738712d9208f3dcd64aeabefc96df3bc50f09bc6
tree6e0f3c9b82ad7e937c6127c5b866a0384371c39a
parentb81a6b9cdb21244538c8b70d40fae8ff95db7d56
WebsitePolicies: let clients select specific autoplay quirks
https://bugs.webkit.org/show_bug.cgi?id=173343

Reviewed by Alex Christensen.
Source/WebCore:

Tests: Updated API tests accordingly to use new values.

Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
pick auto-play quirks.

* dom/Document.cpp:
(WebCore::Document::processingUserGestureForMedia):
* html/HTMLMediaElement.cpp:
(WebCore::needsAutoplayPlayPauseEventsQuirk):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::allowedAutoplayQuirks):
(WebCore::DocumentLoader::setAllowedAutoplayQuirks):
(WebCore::DocumentLoader::allowsAutoplayQuirks): Deleted.
(WebCore::DocumentLoader::setAllowsAutoplayQuirks): Deleted.

Source/WebKit2:

Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
pick auto-play quirks.

* Shared/WebsitePolicies.h:
(WebKit::WebsitePolicies::encode):
(WebKit::WebsitePolicies::decode):
* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/C/WKWebsitePolicies.cpp:
(WKWebsitePoliciesSetAllowedAutoplayQuirks):
(WKWebsitePoliciesGetAllowedAutoplayQuirks):
(WKWebsitePoliciesSetAllowsAutoplayQuirks): Deleted.
(WKWebsitePoliciesGetAllowsAutoplayQuirks): Deleted.
* UIProcess/API/C/WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
(-[_WKWebsitePolicies allowedAutoplayQuirks]):
(-[_WKWebsitePolicies setAllowsAutoplayQuirks:]): Deleted.
(-[_WKWebsitePolicies allowsAutoplayQuirks]): Deleted.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateWebsitePolicies):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(-[AutoplayPoliciesDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST): Updated tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218229 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebsitePolicies.h
Source/WebKit2/UIProcess/API/APIWebsitePolicies.h
Source/WebKit2/UIProcess/API/C/WKWebsitePolicies.cpp
Source/WebKit2/UIProcess/API/C/WKWebsitePolicies.h
Source/WebKit2/UIProcess/API/Cocoa/_WKWebsitePolicies.h
Source/WebKit2/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm