Add WKWebView fullscreen delegate SPI
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 15:52:25 +0000 (15:52 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 15:52:25 +0000 (15:52 +0000)
commit8f8d2c380a5e356692e3d7c8dcdc5c38bd53ca49
treef5a4768fa975c358ec7462ea53c2b8600f9ad40a
parentfd9ad72ec293e39994cf5b521925884debd52149
Add WKWebView fullscreen delegate SPI
https://bugs.webkit.org/show_bug.cgi?id=163674

Reviewed by Anders Carlsson.

Source/WebKit2:

Add a new SPI property to WKWebView allowing clients to be notified when fullscreen mode enters and exits.

* UIProcess/API/APIFullscreenClient.h: Added.
(API::FullscreenClient::~FullscreenClient):
(API::FullscreenClient::willEnterFullscreen):
(API::FullscreenClient::didEnterFullscreen):
(API::FullscreenClient::willExitFullscreen):
(API::FullscreenClient::didExitFullscreen):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _setFullscreenDelegate:]):
(-[WKWebView _fullscreenDelegate]):
(-[WKWebView _isInFullscreen]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKFullscreenDelegate.h: Added.
* UIProcess/Cocoa/FullscreenClient.h: Added.
(WebKit::FullscreenClient::~FullscreenClient):
* UIProcess/Cocoa/FullscreenClient.mm: Added.
(WebKit::FullscreenClient::FullscreenClient):
(WebKit::FullscreenClient::delegate):
(WebKit::FullscreenClient::setDelegate):
(WebKit::FullscreenClient::willEnterFullscreen):
(WebKit::FullscreenClient::didEnterFullscreen):
(WebKit::FullscreenClient::willExitFullscreen):
(WebKit::FullscreenClient::didExitFullscreen):
* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::willExitFullScreen):
(WebKit::WebFullScreenManagerProxy::didExitFullScreen):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setFullscreenClient):
(WebKit::WebPageProxy::fullScreenManager): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::fullscreenClient):
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Add a new API test which verifies that the fullscreen delegate receives notifications.

* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.mm:
(-[FullscreenDelegateMessageHandler userContentController:didReceiveScriptMessage:]):
(-[FullscreenDelegateMessageHandler _webViewWillEnterFullscreen:]):
(-[FullscreenDelegateMessageHandler _webViewDidEnterFullscreen:]):
(-[FullscreenDelegateMessageHandler _webViewWillExitFullscreen:]):
(-[FullscreenDelegateMessageHandler _webViewDidExitFullscreen:]):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/APIFullscreenClient.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/_WKFullscreenDelegate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/Cocoa/FullscreenClient.h [new file with mode: 0644]
Source/WebKit2/UIProcess/Cocoa/FullscreenClient.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.mm [new file with mode: 0644]