Add support for toggling device orientation API support per site
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2019 22:11:58 +0000 (22:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2019 22:11:58 +0000 (22:11 +0000)
commit349379dce9fed6aa458b030acf302df5867b7752
tree509e37d4660f6f22de433e5a7b80efeb53aa3779
parent28e1aa8a888b99cc3e91cae467b430dd17a374fb
Add support for toggling device orientation API support per site
https://bugs.webkit.org/show_bug.cgi?id=193143
<rdar://problem/46605724>

Reviewed by Alex Christensen.

Source/WebCore:

Add support for toggling device orientation API support per site via _WKWebsitePolicies.

* dom/Document.cpp:
(WebCore::Document::simulateDeviceOrientationChange):
* dom/Document.h:
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::deviceOrientationEventEnabled const):
(WebCore::DocumentLoader::setDeviceOrientationEventEnabled):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):

Source/WebKit:

Add support for toggling device orientation API support per site via _WKWebsitePolicies.

* Shared/WebsitePoliciesData.cpp:
(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):
* Shared/WebsitePoliciesData.h:
* UIProcess/API/APIWebsitePolicies.cpp:
(API::WebsitePolicies::data):
* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies setDeviceOrientationEventEnabled:]):
(-[_WKWebsitePolicies deviceOrientationEventEnabled]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::simulateDeviceOrientationChange):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::simulateDeviceOrientationChange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[DataMappingSchemeHandler setTaskHandler:]):
(-[DataMappingSchemeHandler webView:startURLSchemeTask:]):
(-[WebsitePoliciesDeviceOrientationDelegate initWithDeviceOrientationEventEnabled:]):
(-[WebsitePoliciesDeviceOrientationDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]):
(-[WebsitePoliciesDeviceOrientationDelegate webView:didFinishNavigation:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/page/DOMWindow.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePoliciesData.cpp
Source/WebKit/Shared/WebsitePoliciesData.h
Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
Source/WebKit/UIProcess/API/APIWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm