[PlayStation] Add minimal WKView API to enable TestWebKitAPI
authoryoshiaki.jitsukawa@sony.com <yoshiaki.jitsukawa@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 19:52:41 +0000 (19:52 +0000)
committeryoshiaki.jitsukawa@sony.com <yoshiaki.jitsukawa@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 19:52:41 +0000 (19:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211868

Reviewed by Alex Christensen.

Enable TestWebKitAPI

.:

* Source/cmake/OptionsPlayStation.cmake:
Disable FullScreen API and ContextMenus.

Source/WebCore:

* PlatformPlayStation.cmake:
Add WebKitRequirements library to WebCore_CopySharedLibs.

Source/WebKit:

* Platform/IPC/Connection.h:
* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::platformInvalidate):
(IPC::Connection::open):
Add SocketMonitor to monitor received messages.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID.

* UIProcess/Launcher/ProcessLauncher.h:
Add PlayStation specific members: Process path and user ID.

* NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
(loadLibraryOrExit):
(main):
* PlatformPlayStation.cmake:
* Shared/API/c/playstation/WKEventPlayStation.cpp: Added.
(WKKeyboardEventMake):
(WKMouseEventMake):
(WKWheelEventMake):
* Shared/API/c/playstation/WKEventPlayStation.h: Added.
* UIProcess/API/C/playstation/WKAPICastPlayStation.h:
(WebKit::toAPI<>):
(WebKit::toImpl<>):
* UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp.
(WKContextConfigurationSetWebProcessPath):
(WKContextConfigurationCopyWebProcessPath):
(WKContextConfigurationSetNetworkProcessPath):
(WKContextConfigurationCopyNetworkProcessPath):
(WKContextConfigurationSetUserId):
(WKContextConfigurationGetUserId):
* UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added.
(WKPageHandleKeyboardEvent):
(WKPageHandleMouseEvent):
(WKPageHandleWheelEvent):
* UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
* UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
(WKViewCreate):
(WKViewGetPage):
* UIProcess/API/C/playstation/WKView.h:
* UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp:
(WebKit::defaultProcessPath):
(WebKit::ProcessLauncher::launchProcess):
(WebKit::ProcessLauncher::terminateProcess):
(WebKit::ProcessLauncher::platformInvalidate):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getLaunchOptions):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions):
* UIProcess/playstation/PageClientImpl.cpp: Added.
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::createDrawingAreaProxy):
(WebKit::PageClientImpl::setViewNeedsDisplay):
(WebKit::PageClientImpl::requestScroll):
(WebKit::PageClientImpl::viewScrollPosition):
(WebKit::PageClientImpl::viewSize):
(WebKit::PageClientImpl::isViewWindowActive):
(WebKit::PageClientImpl::isViewFocused):
(WebKit::PageClientImpl::isViewVisible):
(WebKit::PageClientImpl::isViewInWindow):
(WebKit::PageClientImpl::processDidExit):
(WebKit::PageClientImpl::didRelaunchProcess):
(WebKit::PageClientImpl::pageClosed):
(WebKit::PageClientImpl::preferencesDidChange):
(WebKit::PageClientImpl::toolTipChanged):
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
(WebKit::PageClientImpl::handleDownloadRequest):
(WebKit::PageClientImpl::didChangeContentSize):
(WebKit::PageClientImpl::setCursor):
(WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
(WebKit::PageClientImpl::didChangeViewportProperties):
(WebKit::PageClientImpl::registerEditCommand):
(WebKit::PageClientImpl::clearAllEditCommands):
(WebKit::PageClientImpl::canUndoRedo):
(WebKit::PageClientImpl::executeUndoRedo):
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
(WebKit::PageClientImpl::convertToDeviceSpace):
(WebKit::PageClientImpl::convertToUserSpace):
(WebKit::PageClientImpl::screenToRootView):
(WebKit::PageClientImpl::rootViewToScreen):
(WebKit::PageClientImpl::accessibilityScreenToRootView):
(WebKit::PageClientImpl::rootViewToAccessibilityScreen):
(WebKit::PageClientImpl::doneWithKeyEvent):
(WebKit::PageClientImpl::createPopupMenuProxy):
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::exitAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
(WebKit::PageClientImpl::fullScreenManagerProxyClient):
(WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
(WebKit::PageClientImpl::navigationGestureDidBegin):
(WebKit::PageClientImpl::navigationGestureWillEnd):
(WebKit::PageClientImpl::navigationGestureDidEnd):
(WebKit::PageClientImpl::willRecordNavigationSnapshot):
(WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
(WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
(WebKit::PageClientImpl::didFinishLoadForMainFrame):
(WebKit::PageClientImpl::didFailLoadForMainFrame):
(WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
(WebKit::PageClientImpl::didChangeBackgroundColor):
(WebKit::PageClientImpl::isPlayingAudioWillChange):
(WebKit::PageClientImpl::isPlayingAudioDidChange):
(WebKit::PageClientImpl::refView):
(WebKit::PageClientImpl::derefView):
(WebKit::PageClientImpl::didRestoreScrollPosition):
(WebKit::PageClientImpl::userInterfaceLayoutDirection):
(WebKit::PageClientImpl::requestDOMPasteAccess):
* UIProcess/playstation/PageClientImpl.h: Added.
* UIProcess/playstation/WebProcessPoolPlayStation.cpp:
(WebKit::WebProcessPool::platformInitialize):
* UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp.
(WebKit::PlayStationWebView::create):
(WebKit::PlayStationWebView::PlayStationWebView):
(WebKit::PlayStationWebView::~PlayStationWebView):
(WebKit::PlayStationWebView::isActive const):
(WebKit::PlayStationWebView::isFocused const):
(WebKit::PlayStationWebView::isVisible const):
* UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
(WebKit::PlayStationWebView::page):
* WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
(loadLibraryOrExit):
(main):
* WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp:
(WebKit::InjectedBundle::initialize):
(WebKit::InjectedBundle::setBundleParameter):
* WebProcess/WebPage/AcceleratedSurface.cpp:
(WebKit::AcceleratedSurface::create):

Source/WTF:

* wtf/PlatformPlayStation.cmake:
Link libc as a system library.

Tools:

* TestWebKitAPI/PlatformPlayStation.cmake:
* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp:
(TestWebKitAPI::Util::createInjectedBundlePath):
(TestWebKitAPI::Util::createURLForResource):
* TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp:
(TestWebKitAPI::PlatformWebView::PlatformWebView):
(TestWebKitAPI::PlatformWebView::~PlatformWebView):
(TestWebKitAPI::PlatformWebView::initialize):
(TestWebKitAPI::PlatformWebView::resizeTo):
(TestWebKitAPI::PlatformWebView::page const):
(TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
(TestWebKitAPI::PlatformWebView::simulateMouseMove):
(TestWebKitAPI::PlatformWebView::simulateRightClick):
(TestWebKitAPI::PlatformWebView::simulateButtonClick):
* TestWebKitAPI/playstation/main.cpp:
(loadLibraryOrExit):
(main):
Add PlayStation Platform support.

* TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
(TestWebKitAPI::TEST):
Use the same expected default font preferences as GTK's.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262022 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformPlayStation.cmake
Source/WebCore/ChangeLog
Source/WebCore/PlatformPlayStation.cmake
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp [new file with mode: 0644]
Source/WebKit/Platform/IPC/Connection.h
Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp
Source/WebKit/PlatformPlayStation.cmake
Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.cpp [new file with mode: 0644]
Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/C/playstation/WKAPICastPlayStation.h
Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/playstation/WKView.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/playstation/WKView.h
Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
Source/WebKit/UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/playstation/PageClientImpl.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/playstation/PageClientImpl.h [new file with mode: 0644]
Source/WebKit/UIProcess/playstation/PlayStationWebView.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/playstation/PlayStationWebView.h [new file with mode: 0644]
Source/WebKit/UIProcess/playstation/WebProcessPoolPlayStation.cpp
Source/WebKit/WebProcess/EntryPoint/playstation/WebProcessMain.cpp [new file with mode: 0644]
Source/WebKit/WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp
Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp
Source/cmake/OptionsPlayStation.cmake
Tools/ChangeLog
Tools/TestWebKitAPI/PlatformPlayStation.cmake
Tools/TestWebKitAPI/PlatformWebView.h
Tools/TestWebKitAPI/Tests/WebKit/WKPreferences.cpp
Tools/TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp
Tools/TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp
Tools/TestWebKitAPI/playstation/main.cpp

index 9483054..39f0e19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
+
+        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=211868
+
+        Reviewed by Alex Christensen.
+
+        Enable TestWebKitAPI
+
+        * Source/cmake/OptionsPlayStation.cmake:
+        Disable FullScreen API and ContextMenus.
+
 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
 
         [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
index 40915da..1413467 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
+
+        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=211868
+
+        Reviewed by Alex Christensen.
+
+        Enable TestWebKitAPI
+
+        * wtf/PlatformPlayStation.cmake:
+        Link libc as a system library.
+
 2020-05-21  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, fix the iOS 13.4 build after r261978
index 9af682d..301608f 100644 (file)
@@ -18,7 +18,6 @@ list(APPEND WTF_SOURCES
 )
 
 list(APPEND WTF_LIBRARIES
-    ${C_STD_LIBRARY}
     ${KERNEL_LIBRARY}
     Threads::Threads
 )
index 11e32d2..a4a31d9 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
+
+        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=211868
+
+        Reviewed by Alex Christensen.
+
+        Enable TestWebKitAPI
+
+        * PlatformPlayStation.cmake:
+        Add WebKitRequirements library to WebCore_CopySharedLibs.
+
 2020-05-21  Chris Dumez  <cdumez@apple.com>
 
         ASSERTION FAILED: m_wrapper on fast/events/scoped/editing-commands.html
index 40577fd..45b6c49 100644 (file)
@@ -96,5 +96,6 @@ PLAYSTATION_COPY_SHARED_LIBRARIES(WebCore_CopySharedLibs
         ${JPEG_LIBRARIES}
         ${OPENSSL_LIBRARIES}
         ${PNG_LIBRARIES}
+        ${WebKitRequirements_LIBRARY}
         ${WebP_LIBRARIES}
 )
index ec763f5..6a7638f 100644 (file)
@@ -1,3 +1,143 @@
+2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
+
+        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=211868
+
+        Reviewed by Alex Christensen.
+
+        Enable TestWebKitAPI
+
+        * Platform/IPC/Connection.h:
+        * Platform/IPC/unix/ConnectionUnix.cpp:
+        (IPC::Connection::platformInvalidate):
+        (IPC::Connection::open):
+        Add SocketMonitor to monitor received messages.
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID.
+
+        * UIProcess/Launcher/ProcessLauncher.h:
+        Add PlayStation specific members: Process path and user ID.
+
+        * NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
+        (loadLibraryOrExit):
+        (main):
+        * PlatformPlayStation.cmake:
+        * Shared/API/c/playstation/WKEventPlayStation.cpp: Added.
+        (WKKeyboardEventMake):
+        (WKMouseEventMake):
+        (WKWheelEventMake):
+        * Shared/API/c/playstation/WKEventPlayStation.h: Added.
+        * UIProcess/API/C/playstation/WKAPICastPlayStation.h:
+        (WebKit::toAPI<>):
+        (WebKit::toImpl<>):
+        * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp.
+        (WKContextConfigurationSetWebProcessPath):
+        (WKContextConfigurationCopyWebProcessPath):
+        (WKContextConfigurationSetNetworkProcessPath):
+        (WKContextConfigurationCopyNetworkProcessPath):
+        (WKContextConfigurationSetUserId):
+        (WKContextConfigurationGetUserId):
+        * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
+        * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added.
+        (WKPageHandleKeyboardEvent):
+        (WKPageHandleMouseEvent):
+        (WKPageHandleWheelEvent):
+        * UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
+        * UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
+        (WKViewCreate):
+        (WKViewGetPage):
+        * UIProcess/API/C/playstation/WKView.h:
+        * UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp:
+        (WebKit::defaultProcessPath):
+        (WebKit::ProcessLauncher::launchProcess):
+        (WebKit::ProcessLauncher::terminateProcess):
+        (WebKit::ProcessLauncher::platformInvalidate):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::getLaunchOptions):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::getLaunchOptions):
+        * UIProcess/playstation/PageClientImpl.cpp: Added.
+        (WebKit::PageClientImpl::PageClientImpl):
+        (WebKit::PageClientImpl::createDrawingAreaProxy):
+        (WebKit::PageClientImpl::setViewNeedsDisplay):
+        (WebKit::PageClientImpl::requestScroll):
+        (WebKit::PageClientImpl::viewScrollPosition):
+        (WebKit::PageClientImpl::viewSize):
+        (WebKit::PageClientImpl::isViewWindowActive):
+        (WebKit::PageClientImpl::isViewFocused):
+        (WebKit::PageClientImpl::isViewVisible):
+        (WebKit::PageClientImpl::isViewInWindow):
+        (WebKit::PageClientImpl::processDidExit):
+        (WebKit::PageClientImpl::didRelaunchProcess):
+        (WebKit::PageClientImpl::pageClosed):
+        (WebKit::PageClientImpl::preferencesDidChange):
+        (WebKit::PageClientImpl::toolTipChanged):
+        (WebKit::PageClientImpl::didCommitLoadForMainFrame):
+        (WebKit::PageClientImpl::handleDownloadRequest):
+        (WebKit::PageClientImpl::didChangeContentSize):
+        (WebKit::PageClientImpl::setCursor):
+        (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
+        (WebKit::PageClientImpl::didChangeViewportProperties):
+        (WebKit::PageClientImpl::registerEditCommand):
+        (WebKit::PageClientImpl::clearAllEditCommands):
+        (WebKit::PageClientImpl::canUndoRedo):
+        (WebKit::PageClientImpl::executeUndoRedo):
+        (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
+        (WebKit::PageClientImpl::convertToDeviceSpace):
+        (WebKit::PageClientImpl::convertToUserSpace):
+        (WebKit::PageClientImpl::screenToRootView):
+        (WebKit::PageClientImpl::rootViewToScreen):
+        (WebKit::PageClientImpl::accessibilityScreenToRootView):
+        (WebKit::PageClientImpl::rootViewToAccessibilityScreen):
+        (WebKit::PageClientImpl::doneWithKeyEvent):
+        (WebKit::PageClientImpl::createPopupMenuProxy):
+        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::fullScreenManagerProxyClient):
+        (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
+        (WebKit::PageClientImpl::navigationGestureDidBegin):
+        (WebKit::PageClientImpl::navigationGestureWillEnd):
+        (WebKit::PageClientImpl::navigationGestureDidEnd):
+        (WebKit::PageClientImpl::willRecordNavigationSnapshot):
+        (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
+        (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
+        (WebKit::PageClientImpl::didFinishLoadForMainFrame):
+        (WebKit::PageClientImpl::didFailLoadForMainFrame):
+        (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+        (WebKit::PageClientImpl::didChangeBackgroundColor):
+        (WebKit::PageClientImpl::isPlayingAudioWillChange):
+        (WebKit::PageClientImpl::isPlayingAudioDidChange):
+        (WebKit::PageClientImpl::refView):
+        (WebKit::PageClientImpl::derefView):
+        (WebKit::PageClientImpl::didRestoreScrollPosition):
+        (WebKit::PageClientImpl::userInterfaceLayoutDirection):
+        (WebKit::PageClientImpl::requestDOMPasteAccess):
+        * UIProcess/playstation/PageClientImpl.h: Added.
+        * UIProcess/playstation/WebProcessPoolPlayStation.cpp:
+        (WebKit::WebProcessPool::platformInitialize):
+        * UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp.
+        (WebKit::PlayStationWebView::create):
+        (WebKit::PlayStationWebView::PlayStationWebView):
+        (WebKit::PlayStationWebView::~PlayStationWebView):
+        (WebKit::PlayStationWebView::isActive const):
+        (WebKit::PlayStationWebView::isFocused const):
+        (WebKit::PlayStationWebView::isVisible const):
+        * UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
+        (WebKit::PlayStationWebView::page):
+        * WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
+        (loadLibraryOrExit):
+        (main):
+        * WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp:
+        (WebKit::InjectedBundle::initialize):
+        (WebKit::InjectedBundle::setBundleParameter):
+        * WebProcess/WebPage/AcceleratedSurface.cpp:
+        (WebKit::AcceleratedSurface::create):
+
 2020-05-21  Chris Dumez  <cdumez@apple.com>
 
         Address post review comments from Mitz after r262004.
diff --git a/Source/WebKit/NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp b/Source/WebKit/NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp
new file mode 100644 (file)
index 0000000..e8b88fe
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcessMain.h"
+
+#include <dlfcn.h>
+#include <process-initialization/nk-networkprocess.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void loadLibraryOrExit(const char* name)
+{
+    if (!dlopen(name, RTLD_NOW)) {
+        fprintf(stderr, "Failed to load %s.\n", name);
+        exit(EXIT_FAILURE);
+    }
+}
+
+int main(int argc, char** argv)
+{
+    if (argc < 2) {
+        fprintf(stderr, "Unexpected argument count %d\n", argc);
+        exit(EXIT_FAILURE);
+    }
+
+    if (!((dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW))) {
+        fprintf(stderr, "Failed to load SSL library.\n");
+        exit(EXIT_FAILURE);
+    }
+    loadLibraryOrExit("libcurl");
+    loadLibraryOrExit("libicu");
+    loadLibraryOrExit("libSceNKWebKitRequirements");
+    loadLibraryOrExit("libJavaScriptCore");
+    loadLibraryOrExit("libWebKit");
+
+    char* coreProcessIdentifier = argv[1];
+
+    char connectionIdentifier[16];
+    snprintf(connectionIdentifier, sizeof(connectionIdentifier), "%d", PlayStation::getConnectionIdentifier());
+
+    char program[] = "dummy";
+    char* internalArgv[] = {
+        program,
+        coreProcessIdentifier,
+        connectionIdentifier,
+        0
+    };
+    return WebKit::NetworkProcessMain(sizeof(internalArgv) / sizeof(char*), internalArgv);
+}
index 793f9b4..4e86aba 100644 (file)
@@ -410,6 +410,9 @@ private:
     GSocketMonitor m_readSocketMonitor;
     GSocketMonitor m_writeSocketMonitor;
 #endif
+#if PLATFORM(PLAYSTATION)
+    RefPtr<WTF::Thread> m_socketMonitor;
+#endif
 #elif OS(DARWIN)
     // Called on the connection queue.
     void receiveSourceEventHandler();
index 8849549..f3dc5ef 100644 (file)
@@ -120,6 +120,13 @@ void Connection::platformInvalidate()
     m_writeSocketMonitor.stop();
 #endif
 
+#if PLATFORM(PLAYSTATION)
+    if (m_socketMonitor) {
+        m_socketMonitor->detach();
+        m_socketMonitor = nullptr;
+    }
+#endif
+
     m_socketDescriptor = -1;
     m_isConnected = false;
 }
@@ -361,6 +368,27 @@ bool Connection::open()
     });
 #endif
 
+#if PLATFORM(PLAYSTATION)
+    m_socketMonitor = Thread::create("SocketMonitor", [protectedThis] {
+        {
+            int fd;
+            while ((fd = protectedThis->m_socketDescriptor) != -1) {
+                int maxFd = fd;
+                fd_set fdSet;
+                FD_ZERO(&fdSet);
+                FD_SET(fd, &fdSet);
+
+                if (-1 != select(maxFd + 1, &fdSet, 0, 0, 0)) {
+                    if (FD_ISSET(fd, &fdSet))
+                        protectedThis->readyReadHandler();
+                }
+            }
+
+        }
+    });
+    return true;
+#endif
+
     // Schedule a call to readyReadHandler. Data may have arrived before installation of the signal handler.
     m_connectionQueue->dispatch([protectedThis] {
         protectedThis->readyReadHandler();
index 3a4f156..9c4d9bd 100644 (file)
@@ -1,9 +1,3 @@
-set(WebKit_OUTPUT_NAME SceWebKit)
-set(WebProcess_OUTPUT_NAME WebKitWebProcess)
-set(NetworkProcess_OUTPUT_NAME WebKitNetworkProcess)
-set(GPUProcess_OUTPUT_NAME WebKitGPUProcess)
-set(PluginProcess_OUTPUT_NAME WebKitPluginProcess)
-
 include(Headers.cmake)
 
 add_definitions(-DBUILDING_WEBKIT)
@@ -11,11 +5,11 @@ add_definitions(-DBUILDING_WEBKIT)
 set(WebKit_USE_PREFIX_HEADER ON)
 
 list(APPEND WebProcess_SOURCES
-    WebProcess/EntryPoint/unix/WebProcessMain.cpp
+    WebProcess/EntryPoint/playstation/WebProcessMain.cpp
 )
 
 list(APPEND NetworkProcess_SOURCES
-    NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
+    NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp
 )
 
 list(APPEND GPUProcess_SOURCES
@@ -57,6 +51,8 @@ list(APPEND WebKit_SOURCES
 
     Shared/API/c/curl/WKCertificateInfoCurl.cpp
 
+    Shared/API/c/playstation/WKEventPlayStation.cpp
+
     Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
     Shared/CoordinatedGraphics/SimpleViewportController.cpp
 
@@ -90,6 +86,10 @@ list(APPEND WebKit_SOURCES
     UIProcess/API/C/curl/WKProtectionSpaceCurl.cpp
     UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.cpp
 
+    UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp
+    UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp
+    UIProcess/API/C/playstation/WKView.cpp
+
     UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp
 
     UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
@@ -104,6 +104,8 @@ list(APPEND WebKit_SOURCES
 
     UIProcess/libwpe/WebPasteboardProxyLibWPE.cpp
 
+    UIProcess/playstation/PageClientImpl.cpp
+    UIProcess/playstation/PlayStationWebView.cpp
     UIProcess/playstation/WebPageProxyPlayStation.cpp
     UIProcess/playstation/WebProcessPoolPlayStation.cpp
 
@@ -138,6 +140,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${WEBKIT_DIR}/UIProcess/API/C/curl"
     "${WEBKIT_DIR}/UIProcess/API/C/playstation"
     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
+    "${WEBKIT_DIR}/UIProcess/playstation"
     "${WEBKIT_DIR}/WebProcess/WebCoreSupport/curl"
     "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
     "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
@@ -150,10 +153,13 @@ list(APPEND WebKit_PUBLIC_FRAMEWORK_HEADERS
     Shared/API/c/curl/WKCertificateInfoCurl.h
 
     Shared/API/c/playstation/WKBasePlayStation.h
+    Shared/API/c/playstation/WKEventPlayStation.h
 
     UIProcess/API/C/curl/WKProtectionSpaceCurl.h
     UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.h
 
+    UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h
+    UIProcess/API/C/playstation/WKPagePrivatePlayStation.h
     UIProcess/API/C/playstation/WKView.h
 )
 
@@ -163,4 +169,5 @@ list(APPEND WebKit_PUBLIC_FRAMEWORK_HEADERS
 list(APPEND WebKit_PRIVATE_LIBRARIES
     $<TARGET_OBJECTS:PAL>
     $<TARGET_OBJECTS:WebCore>
+    WebKitRequirements::ProcessLauncher
 )
diff --git a/Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.cpp b/Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.cpp
new file mode 100644 (file)
index 0000000..b15c4cd
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKEventPlayStation.h"
+
+WKKeyboardEvent WKKeyboardEventMake(WKEventType type, WKInputType inputType, const char* text, uint32_t length, const char* keyIdentifier, int32_t virtualKeyCode, int32_t caretOffset, uint32_t attributes, uint32_t modifiers)
+{
+    WKKeyboardEvent keyboardEvent;
+    keyboardEvent.type = type;
+    keyboardEvent.virtualKeyCode = virtualKeyCode;
+    keyboardEvent.modifiers = modifiers;
+    keyboardEvent.caretOffset = caretOffset;
+
+    // see http://www.w3.org/TR/DOM-Level-3-Events/#keys-IME
+    if (inputType == kWKInputTypeSetComposition)
+        keyboardEvent.keyIdentifier = "Convert";
+    else if (inputType == kWKInputTypeConfirmComposition)
+        keyboardEvent.keyIdentifier = "Accept";
+    else if (inputType == kWKInputTypeCancelComposition)
+        keyboardEvent.keyIdentifier = "Cancel";
+    else
+        keyboardEvent.keyIdentifier = keyIdentifier;
+
+    if (length > 0) {
+        keyboardEvent.text = text;
+        keyboardEvent.length = length;
+    } else {
+        keyboardEvent.text = nullptr;
+        keyboardEvent.length = 0;
+    }
+
+    return keyboardEvent;
+}
+
+WKMouseEvent WKMouseEventMake(WKEventType type, WKEventMouseButton button, WKPoint position, int32_t clickCount, uint32_t modifiers)
+{
+    WKMouseEvent mouseEvent;
+    mouseEvent.type = type;
+    mouseEvent.button = button;
+    mouseEvent.position = position;
+    mouseEvent.clickCount = clickCount;
+    mouseEvent.modifiers = modifiers;
+    return mouseEvent;
+}
+
+WKWheelEvent WKWheelEventMake(WKEventType type, WKPoint position, WKSize delta, WKSize wheelTicks, uint32_t modifiers)
+{
+    WKWheelEvent wheelEvent;
+    wheelEvent.type = type;
+    wheelEvent.position = position;
+    wheelEvent.delta = delta;
+    wheelEvent.wheelTicks = wheelTicks;
+    wheelEvent.modifiers = modifiers;
+    return wheelEvent;
+}
diff --git a/Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.h b/Source/WebKit/Shared/API/c/playstation/WKEventPlayStation.h
new file mode 100644 (file)
index 0000000..9a20bb6
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKEvent.h>
+#include <WebKit/WKGeometry.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    kWKEventNoType = -1,
+
+    // WebMouseEvent
+    kWKEventMouseDown,
+    kWKEventMouseUp,
+    kWKEventMouseMove,
+    kWKEventMouseForceChanged,
+    kWKEventMouseForceDown,
+    kWKEventMouseForceUp,
+
+    // WebWheelEvent
+    kWKEventWheel,
+
+    // WebKeyboardEvent
+    kWKEventKeyDown,
+    kWKEventKeyUp
+};
+typedef int32_t WKEventType;
+
+struct WKKeyboardEvent {
+    WKEventType type;
+    const char* text;
+    int32_t length;
+    const char* keyIdentifier;
+    uint32_t modifiers;
+    int32_t virtualKeyCode;
+    int32_t caretOffset;
+};
+typedef struct WKKeyboardEvent WKKeyboardEvent;
+
+enum {
+    kWKInputTypeNormal,
+    kWKInputTypeSetComposition,
+    kWKInputTypeConfirmComposition,
+    kWKInputTypeCancelComposition,
+};
+typedef uint8_t WKInputType;
+
+struct WKMouseEvent {
+    WKEventType type;
+    WKEventMouseButton button;
+    WKPoint position;
+    int32_t clickCount;
+    uint32_t modifiers;
+};
+typedef struct WKMouseEvent WKMouseEvent;
+
+struct WKWheelEvent {
+    WKEventType type;
+    WKPoint position;
+    WKSize delta;
+    WKSize wheelTicks;
+    uint32_t modifiers;
+};
+typedef struct WKWheelEvent WKWheelEvent;
+
+WK_EXPORT WKKeyboardEvent WKKeyboardEventMake(WKEventType type, WKInputType inputType, const char* text, uint32_t length, const char* keyIdentifier, int32_t virtualKeyCode, int32_t caretOffset, uint32_t attributes, uint32_t modifiers);
+
+WK_EXPORT WKMouseEvent WKMouseEventMake(WKEventType type, WKEventMouseButton button, WKPoint position, int32_t clickCount, uint32_t modifiers);
+
+WK_EXPORT WKWheelEvent WKWheelEventMake(WKEventType type, WKPoint position, WKSize delta, WKSize wheelTicks, uint32_t modifiers);
+
+#ifdef __cplusplus
+}
+#endif
index a65f066..18585f6 100644 (file)
@@ -71,7 +71,11 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
 #if PLATFORM(GTK) && !USE(GTK4)
     copy->m_useSystemAppearanceForScrollbars = m_useSystemAppearanceForScrollbars;
 #endif
-
+#if PLATFORM(PLAYSTATION)
+    copy->m_webProcessPath = this->m_webProcessPath;
+    copy->m_networkProcessPath = this->m_networkProcessPath;
+    copy->m_userId = this->m_userId;
+#endif
     return copy;
 }
 
index ecbf245..6492490 100644 (file)
@@ -136,6 +136,17 @@ public:
     void setUseSystemAppearanceForScrollbars(bool useSystemAppearanceForScrollbars) { m_useSystemAppearanceForScrollbars = useSystemAppearanceForScrollbars; }
 #endif
 
+#if PLATFORM(PLAYSTATION)
+    const WTF::String& webProcessPath() const { return m_webProcessPath; }
+    void setWebProcessPath(const WTF::String& webProcessPath) { m_webProcessPath = webProcessPath; }
+
+    const WTF::String& networkProcessPath() const { return m_networkProcessPath; }
+    void setNetworkProcessPath(const WTF::String& networkProcessPath) { m_networkProcessPath = networkProcessPath; }
+
+    int32_t userId() const { return m_userId; }
+    void setUserId(const int32_t userId) { m_userId = userId; }
+#endif
+
 private:
     WTF::String m_injectedBundlePath;
     Vector<WTF::String> m_customClassesForParameterCoder;
@@ -165,6 +176,11 @@ private:
 #if PLATFORM(GTK) && !USE(GTK4)
     bool m_useSystemAppearanceForScrollbars { false };
 #endif
+#if PLATFORM(PLAYSTATION)
+    WTF::String m_webProcessPath;
+    WTF::String m_networkProcessPath;
+    int32_t m_userId { -1 };
+#endif
 };
 
 } // namespace API
index 22efd85..4c1c687 100644 (file)
 #error "Please #include \"WKAPICast.h\" instead of this file directly."
 #endif
 
+namespace WebKit {
+
+class PlayStationWebView;
+
+WK_ADD_API_MAPPING(WKViewRef, PlayStationWebView)
+
+template<>
+inline WKViewRef toAPI<>(PlayStationWebView* view)
+{
+    return reinterpret_cast<WKViewRef>(static_cast<void*>(view));
+}
+
+template<>
+inline PlayStationWebView* toImpl<>(WKViewRef view)
+{
+    return static_cast<PlayStationWebView*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view)));
+}
+
+}
+
 #endif /* WKAPICastPlayStation_h */
diff --git a/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp b/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp
new file mode 100644 (file)
index 0000000..686eb1b
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKContextConfigurationPlayStation.h"
+
+#include "APIProcessPoolConfiguration.h"
+#include "WKAPICast.h"
+
+void WKContextConfigurationSetWebProcessPath(WKContextConfigurationRef configuration, WKStringRef webProcessPath)
+{
+    WebKit::toImpl(configuration)->setWebProcessPath(WebKit::toImpl(webProcessPath)->string());
+}
+
+WKStringRef WKContextConfigurationCopyWebProcessPath(WKContextConfigurationRef configuration)
+{
+    return WebKit::toCopiedAPI(WebKit::toImpl(configuration)->webProcessPath());
+}
+
+void WKContextConfigurationSetNetworkProcessPath(WKContextConfigurationRef configuration, WKStringRef networkProcessPath)
+{
+    WebKit::toImpl(configuration)->setNetworkProcessPath(WebKit::toImpl(networkProcessPath)->string());
+}
+
+WKStringRef WKContextConfigurationCopyNetworkProcessPath(WKContextConfigurationRef configuration)
+{
+    return WebKit::toCopiedAPI(WebKit::toImpl(configuration)->networkProcessPath());
+}
+
+void WKContextConfigurationSetUserId(WKContextConfigurationRef configuration, int32_t userId)
+{
+    WebKit::toImpl(configuration)->setUserId(userId);
+}
+
+int32_t WKContextConfigurationGetUserId(WKContextConfigurationRef configuration)
+{
+    return WebKit::toImpl(configuration)->userId();
+}
diff --git a/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h b/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h
new file mode 100644 (file)
index 0000000..6ed08b8
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKContextConfigurationRef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT void WKContextConfigurationSetWebProcessPath(WKContextConfigurationRef configuration, WKStringRef webProcessPath);
+WK_EXPORT WKStringRef WKContextConfigurationCopyWebProcessPath(WKContextConfigurationRef configuration);
+
+WK_EXPORT void WKContextConfigurationSetNetworkProcessPath(WKContextConfigurationRef configuration, WKStringRef networkProcessPath);
+WK_EXPORT WKStringRef WKContextConfigurationCopyNetworkProcessPath(WKContextConfigurationRef configuration);
+
+WK_EXPORT void WKContextConfigurationSetUserId(WKContextConfigurationRef configuration, int32_t userId);
+WK_EXPORT int32_t WKContextConfigurationGetUserId(WKContextConfigurationRef configuration);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp b/Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp
new file mode 100644 (file)
index 0000000..f7068b6
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKPagePrivatePlayStation.h"
+
+#include "NativeWebKeyboardEvent.h"
+#include "NativeWebMouseEvent.h"
+#include "NativeWebWheelEvent.h"
+#include "WebEventFactory.h"
+#include "WebPageProxy.h"
+#include <wpe/wpe.h>
+
+void WKPageSetSize(WKPageRef pageRef, WKSize size)
+{
+    notImplemented();
+}
+
+void WKPageHandleKeyboardEvent(WKPageRef pageRef, WKKeyboardEvent event)
+{
+    using WebKit::NativeWebKeyboardEvent;
+
+    wpe_input_keyboard_event wpeEvent;
+    wpeEvent.time = 0;
+    wpeEvent.key_code = event.virtualKeyCode;
+    wpeEvent.hardware_key_code = event.virtualKeyCode;
+    wpeEvent.modifiers = 0; // TODO: Handle modifiers.
+    switch (event.type) {
+    case kWKEventKeyDown:
+        wpeEvent.pressed = true;
+        break;
+    case kWKEventKeyUp:
+        wpeEvent.pressed = false;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    NativeWebKeyboardEvent::HandledByInputMethod handledByInputMethod = NativeWebKeyboardEvent::HandledByInputMethod::No;
+    Optional<Vector<WebCore::CompositionUnderline>> preeditUnderlines;
+    Optional<WebKit::EditingRange> preeditSelectionRange;
+    WebKit::toImpl(pageRef)->handleKeyboardEvent(NativeWebKeyboardEvent(&wpeEvent, "", handledByInputMethod, WTFMove(preeditUnderlines), WTFMove(preeditSelectionRange)));
+}
+
+void WKPageHandleMouseEvent(WKPageRef pageRef, WKMouseEvent event)
+{
+    using WebKit::NativeWebMouseEvent;
+
+    wpe_input_pointer_event wpeEvent;
+
+    switch (event.type) {
+    case kWKEventMouseDown:
+    case kWKEventMouseUp:
+        wpeEvent.type = wpe_input_pointer_event_type_button;
+        break;
+    case kWKEventMouseMove:
+        wpeEvent.type = wpe_input_pointer_event_type_motion;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    switch (event.button) {
+    case kWKEventMouseButtonLeftButton:
+        wpeEvent.button = 1;
+        break;
+    case kWKEventMouseButtonMiddleButton:
+        wpeEvent.button = 3;
+        break;
+    case kWKEventMouseButtonRightButton:
+        wpeEvent.button = 2;
+        break;
+    case kWKEventMouseButtonNoButton:
+        wpeEvent.button = 0;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+    wpeEvent.time = 0;
+    wpeEvent.x = event.position.x;
+    wpeEvent.y = event.position.y;
+    wpeEvent.state = 0;
+    wpeEvent.modifiers = 0; // TODO: Handle modifiers.
+
+    const float deviceScaleFactor = 1;
+
+    WebKit::toImpl(pageRef)->handleMouseEvent(NativeWebMouseEvent(&wpeEvent, deviceScaleFactor));
+}
+
+void WKPageHandleWheelEvent(WKPageRef pageRef, WKWheelEvent event)
+{
+    using WebKit::WebWheelEvent;
+    using WebKit::NativeWebWheelEvent;
+
+    wpe_input_axis_2d_event wpeEvent;
+    wpeEvent.base.type = (wpe_input_axis_event_type)(wpe_input_axis_event_type_motion_smooth | wpe_input_axis_event_type_mask_2d);
+    wpeEvent.base.time = 0;
+    wpeEvent.base.x = event.position.x;
+    wpeEvent.base.y = event.position.y;
+    wpeEvent.base.axis = 0;
+    wpeEvent.base.value = 0;
+    wpeEvent.base.modifiers = 0; // TODO: Handle modifiers.
+    wpeEvent.x_axis = event.delta.width;
+    wpeEvent.x_axis = event.delta.height;
+
+    const float deviceScaleFactor = 1;
+
+    WebKit::toImpl(pageRef)->handleWheelEvent(NativeWebWheelEvent(&wpeEvent.base, deviceScaleFactor, WebWheelEvent::Phase::PhaseNone, WebWheelEvent::Phase::PhaseNone));
+}
diff --git a/Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.h b/Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.h
new file mode 100644 (file)
index 0000000..d9d618e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKEventPlayStation.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT void WKPageHandleKeyboardEvent(WKPageRef page, WKKeyboardEvent);
+WK_EXPORT void WKPageHandleMouseEvent(WKPageRef page, WKMouseEvent);
+WK_EXPORT void WKPageHandleWheelEvent(WKPageRef page, WKWheelEvent);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Source/WebKit/UIProcess/API/C/playstation/WKView.cpp b/Source/WebKit/UIProcess/API/C/playstation/WKView.cpp
new file mode 100644 (file)
index 0000000..1be5296
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKView.h"
+
+#include "APIPageConfiguration.h"
+#include "PlayStationWebView.h"
+#include "WKAPICast.h"
+
+WKViewRef WKViewCreate(WKPageConfigurationRef configuration)
+{
+    return WebKit::toAPI(WebKit::PlayStationWebView::create(*WebKit::toImpl(configuration)).leakRef());
+}
+
+WKPageRef WKViewGetPage(WKViewRef viewRef)
+{
+    return WebKit::toAPI(WebKit::toImpl(viewRef)->page());
+}
index 324673b..c5ee447 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WKView_h
-#define WKView_h
+#pragma once
 
 #include <WebKit/WKBase.h>
 
@@ -32,8 +31,9 @@
 extern "C" {
 #endif
 
+WK_EXPORT WKViewRef WKViewCreate(WKPageConfigurationRef configuration);
+WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
+
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* WKView_h */
index 76a904b..2251093 100644 (file)
@@ -85,6 +85,11 @@ public:
         String processCmdPrefix;
 #endif
 #endif
+
+#if PLATFORM(PLAYSTATION)
+        String processPath;
+        int32_t userId { -1 };
+#endif
     };
 
     static Ref<ProcessLauncher> create(Client* client, LaunchOptions&& launchOptions)
index 54e610d..beb0795 100644 (file)
 #include "config.h"
 #include "ProcessLauncher.h"
 
+#include <process-launcher.h>
+#include <stdint.h>
+#include <sys/socket.h>
+
 namespace WebKit {
 
+#define MAKE_PROCESS_PATH(x) "/app0/" #x "Process.self"
+static const char* defaultProcessPath(ProcessLauncher::ProcessType processType)
+{
+    switch (processType) {
+    case ProcessLauncher::ProcessType::Network:
+        return MAKE_PROCESS_PATH(Network);
+#if ENABLE(GPU_PROCESS)
+    case ProcessLauncher::ProcessType::GPU:
+        return MAKE_PROCESS_PATH(GPU);
+#endif
+    case ProcessLauncher::ProcessType::Web:
+    default:
+        return MAKE_PROCESS_PATH(Web);
+    }
+}
+
 void ProcessLauncher::launchProcess()
 {
+    IPC::Connection::Identifier serverIdentifier;
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(IPC::Connection::ConnectionOptions::SetCloexecOnServer);
+
+    int sendBufSize = 32 * 1024;
+    setsockopt(socketPair.server, SOL_SOCKET, SO_SNDBUF, &sendBufSize, 4);
+    setsockopt(socketPair.client, SOL_SOCKET, SO_SNDBUF, &sendBufSize, 4);
+
+    int recvBufSize = 32 * 1024;
+    setsockopt(socketPair.server, SOL_SOCKET, SO_RCVBUF, &recvBufSize, 4);
+    setsockopt(socketPair.client, SOL_SOCKET, SO_RCVBUF, &recvBufSize, 4);
+
+    char coreProcessIdentifierString[16];
+    snprintf(coreProcessIdentifierString, sizeof coreProcessIdentifierString, "%ld", m_launchOptions.processIdentifier.toUInt64());
+
+    char* argv[] = {
+        coreProcessIdentifierString,
+        nullptr
+    };
+
+    PlayStation::LaunchParam param { socketPair.client, m_launchOptions.userId };
+    int32_t appLocalPid = PlayStation::launchProcess(
+        !m_launchOptions.processPath.isEmpty() ? m_launchOptions.processPath.utf8().data() : defaultProcessPath(m_launchOptions.processType),
+        argv, param);
+    if (appLocalPid < 0) {
+#ifndef NDEBUG
+        fprintf(stderr, "Failed to launch process. err=0x%08x path=%s\n", appLocalPid, m_launchOptions.processPath.utf8().data());
+#endif
+        return;
+    }
+    close(socketPair.client);
+    serverIdentifier = socketPair.server;
+
+    // We've finished launching the process, message back to the main run loop.
+    RefPtr<ProcessLauncher> protectedThis(this);
+    RunLoop::main().dispatch([=] {
+        protectedThis->didFinishLaunchingProcess(appLocalPid, serverIdentifier);
+    });
 }
 
 void ProcessLauncher::terminateProcess()
 {
+    if (!m_processIdentifier)
+        return;
+
+    PlayStation::terminateProcess(m_processIdentifier);
 }
 
 void ProcessLauncher::platformInvalidate()
 {
+    m_processIdentifier = 0;
 }
 
 } // namespace WebKit
index d806b92..bedb827 100644 (file)
@@ -109,6 +109,11 @@ void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launc
         processPool().setShouldMakeNextNetworkProcessLaunchFailForTesting(false);
         launchOptions.shouldMakeProcessLaunchFailForTesting = true;
     }
+
+#if PLATFORM(PLAYSTATION)
+    launchOptions.processPath = m_processPool.networkProcessPath();
+    launchOptions.userId = m_processPool.userId();
+#endif
 }
 
 void NetworkProcessProxy::connectionWillOpen(IPC::Connection& connection)
index 9b82547..661f2e7 100644 (file)
@@ -535,6 +535,12 @@ public:
     void notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue);
 #endif
 
+#if PLATFORM(PLAYSTATION)
+    const String& webProcessPath() const { return m_resolvedPaths.webProcessPath; }
+    const String& networkProcessPath() const { return m_resolvedPaths.networkProcessPath; }
+    int32_t userId() const { return m_userId; }
+#endif
+
 private:
     void platformInitialize();
 
@@ -762,6 +768,11 @@ private:
         String containerTemporaryDirectory;
 #endif
 
+#if PLATFORM(PLAYSTATION)
+        String webProcessPath;
+        String networkProcessPath;
+#endif
+
         Vector<String> additionalWebProcessSandboxExtensionPaths;
     };
     Paths m_resolvedPaths;
@@ -799,6 +810,10 @@ private:
     };
     Optional<AudibleMediaActivity> m_audibleMediaActivity;
 
+#if PLATFORM(PLAYSTATION)
+    int32_t m_userId { -1 };
+#endif
+
 #if PLATFORM(IOS)
     // FIXME: Delayed process launch is currently disabled on iOS for performance reasons (rdar://problem/49074131).
     bool m_isDelayedWebProcessLaunchDisabled { true };
index e7a8cdc..cc4359a 100644 (file)
@@ -332,6 +332,11 @@ void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOpt
     if (isPrewarmed())
         launchOptions.extraInitializationData.add("is-prewarmed"_s, "1"_s);
 
+#if PLATFORM(PLAYSTATION)
+    launchOptions.processPath = m_processPool->webProcessPath();
+    launchOptions.userId = m_processPool->userId();
+#endif
+
     if (processPool().shouldMakeNextWebProcessLaunchFailForTesting()) {
         processPool().setShouldMakeNextWebProcessLaunchFailForTesting(false);
         launchOptions.shouldMakeProcessLaunchFailForTesting = true;
diff --git a/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp b/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp
new file mode 100644 (file)
index 0000000..c99acd2
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageClientImpl.h"
+
+#include "DrawingAreaProxyCoordinatedGraphics.h"
+#include "PlayStationWebView.h"
+#include "WebPageProxy.h"
+
+namespace WebKit {
+
+PageClientImpl::PageClientImpl(PlayStationWebView& view)
+    : m_view(view)
+{
+}
+
+// PageClient's pure virtual functions
+std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& processProxy)
+{
+    return makeUnique<DrawingAreaProxyCoordinatedGraphics>(*m_view.page(), processProxy);
+}
+
+void PageClientImpl::setViewNeedsDisplay(const WebCore::Region& region)
+{
+}
+
+void PageClientImpl::requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin)
+{
+}
+
+WebCore::FloatPoint PageClientImpl::viewScrollPosition()
+{
+    return WebCore::FloatPoint { };
+}
+
+WebCore::IntSize PageClientImpl::viewSize()
+{
+    return WebCore::IntSize { };
+}
+
+bool PageClientImpl::isViewWindowActive()
+{
+    return m_view.isActive();
+}
+
+bool PageClientImpl::isViewFocused()
+{
+    return m_view.isFocused();
+}
+
+bool PageClientImpl::isViewVisible()
+{
+    return m_view.isVisible();
+}
+
+bool PageClientImpl::isViewInWindow()
+{
+    notImplemented();
+    return true;
+}
+
+void PageClientImpl::processDidExit()
+{
+}
+
+void PageClientImpl::didRelaunchProcess()
+{
+}
+void PageClientImpl::pageClosed()
+{
+}
+
+void PageClientImpl::preferencesDidChange()
+{
+}
+
+void PageClientImpl::toolTipChanged(const String&, const String&)
+{
+}
+
+void PageClientImpl::didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider)
+{
+    notImplemented();
+}
+
+void PageClientImpl::handleDownloadRequest(DownloadProxy&)
+{
+}
+
+void PageClientImpl::didChangeContentSize(const WebCore::IntSize& size)
+{
+    notImplemented();
+}
+
+void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
+{
+    notImplemented();
+}
+
+void PageClientImpl::setCursorHiddenUntilMouseMoves(bool)
+{
+}
+
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes& attributes)
+{
+}
+
+void PageClientImpl::registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo)
+{
+}
+
+void PageClientImpl::clearAllEditCommands()
+{
+}
+
+bool PageClientImpl::canUndoRedo(UndoOrRedo)
+{
+    return false;
+}
+
+void PageClientImpl::executeUndoRedo(UndoOrRedo)
+{
+}
+
+void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&)
+{
+}
+
+WebCore::FloatRect PageClientImpl::convertToDeviceSpace(const WebCore::FloatRect& rect)
+{
+    return rect;
+}
+
+WebCore::FloatRect PageClientImpl::convertToUserSpace(const WebCore::FloatRect& rect)
+{
+    return rect;
+}
+
+WebCore::IntPoint PageClientImpl::screenToRootView(const WebCore::IntPoint& point)
+{
+    return point;
+}
+
+WebCore::IntRect PageClientImpl::rootViewToScreen(const WebCore::IntRect& rect)
+{
+    return rect;
+}
+
+WebCore::IntPoint PageClientImpl::accessibilityScreenToRootView(const WebCore::IntPoint& point)
+{
+    return screenToRootView(point);
+}
+
+WebCore::IntRect PageClientImpl::rootViewToAccessibilityScreen(const WebCore::IntRect& rect)
+{
+    return rootViewToScreen(rect);    
+}
+
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
+{
+    notImplemented();
+}
+
+RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy&  pageProxy)
+{
+    notImplemented();
+    return { };
+}
+
+void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& context)
+{
+    notImplemented();
+}
+
+void PageClientImpl::exitAcceleratedCompositingMode()
+{
+    notImplemented();
+}
+
+void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&)
+{
+    notImplemented();
+}
+
+#if ENABLE(FULLSCREEN_API)
+WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
+{
+    return *(WebFullScreenManagerProxyClient*)this;
+}
+#endif
+
+// Custom representations.
+void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&)
+{
+}
+
+void PageClientImpl::navigationGestureDidBegin()
+{
+}
+
+void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&)
+{
+}
+
+void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&)
+{
+}
+
+void PageClientImpl::navigationGestureDidEnd()
+{
+}
+
+void PageClientImpl::willRecordNavigationSnapshot(WebBackForwardListItem&)
+{
+}
+
+void PageClientImpl::didRemoveNavigationGestureSnapshot()
+{
+}
+
+void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
+{
+}
+
+void PageClientImpl::didFinishLoadForMainFrame()
+{
+}
+
+void PageClientImpl::didFailLoadForMainFrame()
+{
+}
+
+void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType)
+{
+}
+
+void PageClientImpl::didChangeBackgroundColor()
+{
+}
+
+void PageClientImpl::isPlayingAudioWillChange()
+{
+}
+
+void PageClientImpl::isPlayingAudioDidChange()
+{
+}
+
+void PageClientImpl::refView()
+{
+}
+
+void PageClientImpl::derefView()
+{
+}
+
+void PageClientImpl::didRestoreScrollPosition()
+{
+}
+
+WebCore::UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection()
+{
+    return WebCore::UserInterfaceLayoutDirection::LTR;
+}
+
+void PageClientImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
+{
+    completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/playstation/PageClientImpl.h b/Source/WebKit/UIProcess/playstation/PageClientImpl.h
new file mode 100644 (file)
index 0000000..9bfe162
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "PageClient.h"
+
+namespace WebKit {
+
+class DrawingAreaProxy;
+class PlayStationWebView;
+
+class PageClientImpl : public PageClient
+#if ENABLE(FULLSCREEN_API)
+    , public WebFullScreenManagerProxyClient
+#endif
+{
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    PageClientImpl(PlayStationWebView&);
+
+private:
+    // Create a new drawing area proxy for the given page.
+    std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) final;
+
+    // Tell the view to invalidate the given region. The region is in view coordinates.
+    void setViewNeedsDisplay(const WebCore::Region&) final;
+
+    // Tell the view to scroll to the given position, and whether this was a programmatic scroll.
+    void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) final;
+
+    // Return the current scroll position (not necessarily the same as the WebCore scroll position, because of scaling, insets etc.)
+    WebCore::FloatPoint viewScrollPosition() final;
+
+    // Return the size of the view the page is associated with.
+    WebCore::IntSize viewSize() final;
+
+    // Return whether the view's containing window is active.
+    bool isViewWindowActive() final;
+
+    // Return whether the view is focused.
+    bool isViewFocused() final;
+
+    // Return whether the view is visible.
+    bool isViewVisible() final;
+
+    // Return whether the view is in a window.
+    bool isViewInWindow() final;
+
+    void processDidExit() final;
+    void didRelaunchProcess() final;
+    void pageClosed() final;
+
+    void preferencesDidChange() final;
+
+    void toolTipChanged(const String&, const String&) final;
+
+    void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) final;
+
+    void handleDownloadRequest(DownloadProxy&) final;
+
+    void didChangeContentSize(const WebCore::IntSize&) final;
+
+    void setCursor(const WebCore::Cursor&) final;
+    void setCursorHiddenUntilMouseMoves(bool) final;
+    void didChangeViewportProperties(const WebCore::ViewportAttributes&) final;
+
+    void registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo) final;
+    void clearAllEditCommands() final;
+    bool canUndoRedo(UndoOrRedo) final;
+    void executeUndoRedo(UndoOrRedo) final;
+    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) final;
+
+    WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) final;
+    WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) final;
+    WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) final;
+    WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) final;
+    WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) final;
+    WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) final;
+
+    void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) final;
+
+    RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) final;
+
+    void enterAcceleratedCompositingMode(const LayerTreeContext&) final;
+    void exitAcceleratedCompositingMode() final;
+    void updateAcceleratedCompositingMode(const LayerTreeContext&) final;
+
+    // Auxiliary Client Creation
+#if ENABLE(FULLSCREEN_API)
+    WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() final;
+#endif
+
+    // Custom representations.
+    void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) final;
+
+    void navigationGestureDidBegin() final;
+    void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) final;
+    void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) final;
+    void navigationGestureDidEnd() final;
+    void willRecordNavigationSnapshot(WebBackForwardListItem&) final;
+    void didRemoveNavigationGestureSnapshot() final;
+
+    void didFirstVisuallyNonEmptyLayoutForMainFrame() final;
+    void didFinishLoadForMainFrame() final;
+    void didFailLoadForMainFrame() final;
+    void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) final;
+
+    void didChangeBackgroundColor() final;
+    void isPlayingAudioWillChange() final;
+    void isPlayingAudioDidChange() final;
+
+    void refView() final;
+    void derefView() final;
+
+    void didRestoreScrollPosition() final;
+
+    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() final;
+
+    void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
+
+    PlayStationWebView& m_view;
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/playstation/PlayStationWebView.cpp b/Source/WebKit/UIProcess/playstation/PlayStationWebView.cpp
new file mode 100644 (file)
index 0000000..feb1a72
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlayStationWebView.h"
+
+#include "APIPageConfiguration.h"
+#include "DrawingAreaProxyCoordinatedGraphics.h"
+#include "WebProcessPool.h"
+
+namespace WebKit {
+
+RefPtr<PlayStationWebView> PlayStationWebView::create(const API::PageConfiguration& configuration)
+{
+    return adoptRef(*new PlayStationWebView(configuration));
+}
+
+PlayStationWebView::PlayStationWebView(const API::PageConfiguration& conf)
+    : m_pageClient(makeUnique<PageClientImpl>(*this))
+{
+    auto configuration = conf.copy();
+    auto* pool = configuration->processPool();
+    m_page = pool->createWebPage(*m_pageClient, WTFMove(configuration));
+
+    m_page->initializeWebPage();
+}
+
+PlayStationWebView::~PlayStationWebView()
+{
+}
+
+bool PlayStationWebView::isActive() const
+{
+    return m_active;
+}
+
+bool PlayStationWebView::isFocused() const
+{
+    return m_focused;
+}
+
+bool PlayStationWebView::isVisible() const
+{
+    return m_visible;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/playstation/PlayStationWebView.h b/Source/WebKit/UIProcess/playstation/PlayStationWebView.h
new file mode 100644 (file)
index 0000000..1795736
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "APIObject.h"
+#include "PageClientImpl.h"
+#include "WKView.h"
+#include "WebPageProxy.h"
+
+namespace WebKit {
+
+class PlayStationWebView : public API::ObjectImpl<API::Object::Type::View> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static RefPtr<PlayStationWebView> create(const API::PageConfiguration&);
+    virtual ~PlayStationWebView();
+
+    WebPageProxy* page() { return m_page.get(); }
+
+    bool isActive() const;
+    bool isFocused() const;
+    bool isVisible() const;
+
+private:
+    PlayStationWebView(const API::PageConfiguration&);
+
+    std::unique_ptr<WebKit::PageClientImpl> m_pageClient;
+    RefPtr<WebPageProxy> m_page;
+
+    bool m_active { false };
+    bool m_focused { false };
+    bool m_visible { false };
+#if ENABLE(FULLSCREEN_API)
+    bool m_isFullScreen { false };
+#endif
+};
+
+} // namespace WebKit
index f6dfe37..ba5373e 100644 (file)
@@ -30,6 +30,7 @@ namespace WebKit {
 
 void WebProcessPool::platformInitialize()
 {
+    m_userId = m_configuration->userId();
 }
 
 void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters&)
diff --git a/Source/WebKit/WebProcess/EntryPoint/playstation/WebProcessMain.cpp b/Source/WebKit/WebProcess/EntryPoint/playstation/WebProcessMain.cpp
new file mode 100644 (file)
index 0000000..193c31f
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebProcessMain.h"
+
+#include <dlfcn.h>
+#include <process-initialization/nk-webprocess.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void loadLibraryOrExit(const char* name)
+{
+    if (!dlopen(name, RTLD_NOW)) {
+        fprintf(stderr, "Failed to load %s.\n", name);
+        exit(EXIT_FAILURE);
+    }
+}
+
+int main(int argc, char** argv)
+{
+    if (argc < 2) {
+        fprintf(stderr, "Unexpected argument count %d\n", argc);
+        exit(EXIT_FAILURE);
+    }
+
+    loadLibraryOrExit("libpng16");
+    loadLibraryOrExit("libicu");
+    loadLibraryOrExit("libfreetype");
+    loadLibraryOrExit("libfontconfig");
+    loadLibraryOrExit("libharfbuzz");
+    loadLibraryOrExit("libcairo");
+    loadLibraryOrExit("libSceNKWebKitRequirements");
+    loadLibraryOrExit("libJavaScriptCore");
+    loadLibraryOrExit("libWebKit");
+
+    char* coreProcessIdentifier = argv[1];
+
+    char connectionIdentifier[16];
+    snprintf(connectionIdentifier, sizeof(connectionIdentifier), "%d", PlayStation::getConnectionIdentifier());
+
+    char program[] = "dummy";
+    char* internalArgv[] = {
+        program,
+        coreProcessIdentifier,
+        connectionIdentifier,
+        0
+    };
+    return WebKit::WebProcessMain(sizeof(internalArgv) / sizeof(char*), internalArgv);
+}
index 4bfe02c..1ca11e6 100644 (file)
 #include "config.h"
 #include "InjectedBundle.h"
 
+#include "WKBundleAPICast.h"
+#include "WKBundleInitialize.h"
+#include "library-bundle.h"
+
 namespace WebKit {
 
-bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData)
+bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
 {
-    return false;
+    auto bundle = LibraryBundle::create(m_path.utf8().data());
+    m_platformBundle = bundle;
+    if (!m_platformBundle) {
+        printf("PlayStation::Bundle::create failed\n");
+        return false;
+    }
+    WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(bundle->resolve("WKBundleInitialize"));
+    if (!initializeFunction) {
+        printf("PlayStation::Bundle::resolve failed\n");
+        return false;
+    }
+    initializeFunction(toAPI(this), toAPI(initializationUserData));
+    return true;
 }
 
 void InjectedBundle::setBundleParameter(WTF::String const&, IPC::DataReference const&)
 {
+
 }
 
 void InjectedBundle::setBundleParameters(const IPC::DataReference&)
index 1330671..a84eea4 100644 (file)
@@ -58,7 +58,7 @@ std::unique_ptr<AcceleratedSurface> AcceleratedSurface::create(WebPage& webPage,
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
         return AcceleratedSurfaceX11::create(webPage, client);
 #endif
-#if USE(LIBWPE)
+#if USE(WPE_RENDERER)
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::WPE)
         return AcceleratedSurfaceLibWPE::create(webPage, client);
 #endif
index 9ea680e..6ac8055 100644 (file)
@@ -59,6 +59,10 @@ WEBKIT_OPTION_DEFINE(ENABLE_TLS_DEBUG "Enable TLS key log support" PRIVATE OFF)
 # Reenable after updating fontconfig
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE OFF)
 
+# Enable in the future
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTEXT_MENUS PRIVATE OFF)
+
 # No support planned
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
@@ -103,6 +107,16 @@ list(APPEND CMAKE_PREFIX_PATH ${WEBKIT_LIBRARIES_DIR})
 
 find_library(C_STD_LIBRARY c)
 find_library(KERNEL_LIBRARY kernel)
+find_package(WebKitRequirements REQUIRED
+    COMPONENTS
+        JPEG
+        LibPSL
+        LibXml2
+        ProcessLauncher
+        SQLite3
+        ZLIB
+        libwpe
+)
 
 find_package(Cairo REQUIRED)
 find_package(CURL REQUIRED)
@@ -111,16 +125,17 @@ find_package(Fontconfig REQUIRED)
 find_package(Freetype REQUIRED)
 find_package(HarfBuzz REQUIRED COMPONENTS ICU)
 find_package(ICU 60.2 REQUIRED COMPONENTS data i18n uc)
-find_package(JPEG REQUIRED)
-find_package(LibPSL REQUIRED)
-find_package(LibXml2 REQUIRED)
 find_package(OpenSSL REQUIRED)
 find_package(PNG REQUIRED)
-find_package(SQLite3 REQUIRED)
 find_package(Threads REQUIRED)
 find_package(WebP REQUIRED COMPONENTS demux)
-find_package(WPE REQUIRED)
-find_package(ZLIB REQUIRED)
+
+set(CMAKE_C_STANDARD_LIBRARIES
+    "${CMAKE_C_STANDARD_LIBRARIES} ${C_STD_LIBRARY}"
+  )
+set(CMAKE_CXX_STANDARD_LIBRARIES
+    "${CMAKE_CXX_STANDARD_LIBRARIES} ${C_STD_LIBRARY}"
+  )
 
 # TODO: Add a check for HAVE_RSA_PSS for support of CryptoAlgorithmRSA_PSS
 # https://bugs.webkit.org/show_bug.cgi?id=206635
@@ -133,7 +148,7 @@ SET_AND_EXPOSE_TO_BUILD(USE_FREETYPE ON)
 SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
 SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
-SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
+SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER OFF)
 
 SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
 SET_AND_EXPOSE_TO_BUILD(USE_UNIX_DOMAIN_SOCKETS ON)
index d40ef3b..fc8626e 100644 (file)
@@ -1,3 +1,36 @@
+2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
+
+        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=211868
+
+        Reviewed by Alex Christensen.
+
+        Enable TestWebKitAPI
+
+        * TestWebKitAPI/PlatformPlayStation.cmake:
+        * TestWebKitAPI/PlatformWebView.h:
+        * TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp:
+        (TestWebKitAPI::Util::createInjectedBundlePath):
+        (TestWebKitAPI::Util::createURLForResource):
+        * TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp:
+        (TestWebKitAPI::PlatformWebView::PlatformWebView):
+        (TestWebKitAPI::PlatformWebView::~PlatformWebView):
+        (TestWebKitAPI::PlatformWebView::initialize):
+        (TestWebKitAPI::PlatformWebView::resizeTo):
+        (TestWebKitAPI::PlatformWebView::page const):
+        (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
+        (TestWebKitAPI::PlatformWebView::simulateMouseMove):
+        (TestWebKitAPI::PlatformWebView::simulateRightClick):
+        (TestWebKitAPI::PlatformWebView::simulateButtonClick):
+        * TestWebKitAPI/playstation/main.cpp:
+        (loadLibraryOrExit):
+        (main):
+        Add PlayStation Platform support.
+
+        * TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
+        (TestWebKitAPI::TEST):
+        Use the same expected default font preferences as GTK's.
+
 2020-05-21  Alex Christensen  <achristensen@webkit.org>
 
         [macOS] TestWebKitAPI.WebKit.HTTPReferer is a flaky failure
index 8984267..a4df197 100644 (file)
@@ -48,6 +48,12 @@ if (ENABLE_WEBKIT)
         playstation/PlatformUtilitiesPlayStation.cpp
         playstation/PlatformWebViewPlayStation.cpp
     )
+
+    # Exclude tests which don't finish.
+    list(REMOVE_ITEM TestWebKit_SOURCES
+        Tests/WebKit/ForceRepaint.cpp
+        Tests/WebKit/Geolocation.cpp
+    )
 endif ()
 
 
@@ -55,3 +61,7 @@ endif ()
 if (${CMAKE_GENERATOR} MATCHES "Visual Studio")
     set_target_properties(TestWTF TestWebCore TestWebKit PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
 endif ()
+
+add_definitions(
+    -DTEST_WEBKIT_RESOURCES_DIR=\"${TOOLS_DIR}/TestWebKitAPI/Tests/WebKit\"
+)
index 77cf186..d8265d2 100644 (file)
@@ -60,7 +60,7 @@ typedef WPEToolingBackends::HeadlessViewBackend *PlatformWindow;
 typedef WKViewRef PlatformWKView;
 typedef HWND PlatformWindow;
 #elif PLATFORM(PLAYSTATION)
-typedef void* PlatformWKView;
+typedef WKViewRef PlatformWKView;
 typedef void* PlatformWindow;
 #endif
 typedef uint32_t WKEventModifiers;
@@ -87,7 +87,7 @@ public:
     void simulateAltKeyPress();
     void simulateRightClick(unsigned x, unsigned y);
     void simulateMouseMove(unsigned x, unsigned y, WKEventModifiers = 0);
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(PLAYSTATION)
     void simulateButtonClick(WKEventMouseButton, unsigned x, unsigned y, WKEventModifiers);
 #endif
 
index 28e3230..c56504b 100644 (file)
@@ -44,7 +44,7 @@ TEST(WebKit, WKPreferencesBasic)
 
 TEST(WebKit, WKPreferencesDefaults)
 {
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(PLAYSTATION)
     static const char* expectedStandardFontFamily = "Times";
     static const char* expectedFixedFontFamily = "Courier New";
     static const char* expectedSerifFontFamily = "Times";
index d7b276c..c3e6e20 100644 (file)
@@ -34,14 +34,14 @@ namespace Util {
 
 WKStringRef createInjectedBundlePath()
 {
-    return WKStringCreateWithUTF8CString("injectedbundle");
+    return WKStringCreateWithUTF8CString("/app0/libTestWebKitAPIInjectedBundle.sprx");
 }
 
 WKURLRef createURLForResource(const char* resource, const char* extension)
 {
-    String filename = makeString(resource, '.', extension);
-    auto url = URL::fileURLWithFileSystemPath(filename);
-    return WKURLCreateWithUTF8CString(url.string().utf8().data());
+    char url[512]; // Sufficient buffer size for the prefix and the actual path.
+    snprintf(url, sizeof(url), "file:///host/%s/%s.%s", TEST_WEBKIT_RESOURCES_DIR, resource, extension);
+    return WKURLCreateWithUTF8CString(url);
 }
 
 WKURLRef URLForNonExistentResource()
index 72a1240..e43a463 100644 (file)
 #include "config.h"
 #include "PlatformWebView.h"
 
-namespace TestWebKitAPI {
+#include <KeyboardEvents.h>
+#include <WebKit/WKContextConfigurationPlayStation.h>
+#include <WebKit/WKPageConfigurationRef.h>
+#include <WebKit/WKPagePrivatePlayStation.h>
+#include <WebKit/WKRetainPtr.h>
+#include <WebKit/WebKit2_C.h>
 
-PlatformWebView::PlatformWebView(WKContextRef, WKPageGroupRef)
+namespace TestWebKitAPI {
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
 {
-}
+    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
+    WKPageConfigurationSetContext(configuration.get(), contextRef);
+    WKPageConfigurationSetPageGroup(configuration.get(), pageGroupRef);
 
-PlatformWebView::PlatformWebView(WKPageConfigurationRef)
-{
+    initialize(configuration.get());
 }
 
-PlatformWebView::PlatformWebView(WKPageRef)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration)
 {
+    initialize(configuration);
 }
 
-PlatformWebView::~PlatformWebView()
+PlatformWebView::PlatformWebView(WKPageRef relatedPage)
 {
+    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
+    WKPageConfigurationSetContext(configuration.get(), WKPageGetContext(relatedPage));
+    WKPageConfigurationSetPageGroup(configuration.get(), WKPageGetPageGroup(relatedPage));
+    WKPageConfigurationSetRelatedPage(configuration.get(), relatedPage);
+
+    initialize(configuration.get());
 }
 
-void PlatformWebView::initialize(WKPageConfigurationRef)
+PlatformWebView::~PlatformWebView()
 {
+    WKPageClose(page());
+    WKRelease(m_view);
 }
 
-WKPageRef PlatformWebView::page() const
+void PlatformWebView::initialize(WKPageConfigurationRef configuration)
 {
-    return nullptr;
+    m_view = WKViewCreate(configuration);
+    resizeTo(800, 600);
 }
 
-void PlatformWebView::resizeTo(unsigned, unsigned)
+void PlatformWebView::resizeTo(unsigned width, unsigned height)
 {
+    // Not implemented.
 }
 
-void PlatformWebView::focus()
+WKPageRef PlatformWebView::page() const
 {
+    return WKViewGetPage(m_view);
 }
 
 void PlatformWebView::simulateSpacebarKeyPress()
 {
+    WKPageHandleKeyboardEvent(page(), WKKeyboardEventMake(kWKEventKeyDown, kWKInputTypeNormal, " ", 1, keyIdentifierForKeyCode(0x20), 0x20, -1, 0, 0));
+    WKPageHandleKeyboardEvent(page(), WKKeyboardEventMake(kWKEventKeyUp, kWKInputTypeNormal, " ", 1, keyIdentifierForKeyCode(0x20), 0x20, -1, 0, 0));
 }
 
-void PlatformWebView::simulateAltKeyPress()
+void PlatformWebView::simulateMouseMove(unsigned x, unsigned y, WKEventModifiers modifiers)
 {
+    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseMove, kWKEventMouseButtonNoButton, WKPointMake(x, y), 0, modifiers));
 }
 
-void PlatformWebView::simulateMouseMove(unsigned, unsigned, WKEventModifiers)
+void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
 {
+    simulateButtonClick(kWKEventMouseButtonRightButton, x, y, 0);
 }
 
-void PlatformWebView::simulateRightClick(unsigned, unsigned)
+void PlatformWebView::simulateButtonClick(WKEventMouseButton button, unsigned x, unsigned y, WKEventModifiers modifiers)
 {
+    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseDown, button, WKPointMake(x, y), 0, modifiers));
+    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseUp, button, WKPointMake(x, y), 0, modifiers));
 }
 
 } // namespace TestWebKitAPI
index 21fb3c4..da2d9d0 100644 (file)
 #include "process-initialization/nk-testwebkitapi.h"
 #include <dlfcn.h>
 
+static void loadLibraryOrExit(const char* name)
+{
+    if (!dlopen(name, RTLD_NOW)) {
+        fprintf(stderr, "Failed to load %s.\n", name);
+        exit(EXIT_FAILURE);
+    }
+}
+
 int main(int argc, char** argv)
 {
-    dlopen("libicu", RTLD_NOW);
+    loadLibraryOrExit("libicu");
 #if defined(BUILDING_TestWebCore) || defined(BUILDING_TestWebKit)
-    dlopen("libpng16", RTLD_NOW);
-    dlopen("libfontconfig", RTLD_NOW);
-    dlopen("libfreetype", RTLD_NOW);
-    dlopen("libharfbuzz", RTLD_NOW);
-    dlopen("libcairo", RTLD_NOW);
-    dlopen("libSceNKWebKitRequirements", RTLD_NOW);
-    dlopen("libJavaScriptCore", RTLD_NOW);
+    loadLibraryOrExit("libpng16");
+    loadLibraryOrExit("libfontconfig");
+    loadLibraryOrExit("libfreetype");
+    loadLibraryOrExit("libharfbuzz");
+    loadLibraryOrExit("libcairo");
+    loadLibraryOrExit("libSceNKWebKitRequirements");
+    loadLibraryOrExit("libJavaScriptCore");
 #endif
 #if defined(BUILDING_TestWebKit)
-    (dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW);
-    dlopen("libcurl", RTLD_NOW);
-    dlopen("libWebKit", RTLD_NOW);
+    if (!((dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW))) {
+        fprintf(stderr, "Failed to load SSL library.\n");
+        exit(EXIT_FAILURE);
+    }
+    loadLibraryOrExit("libcurl");
+    loadLibraryOrExit("libWebKit");
 #endif
     return TestWebKitAPI::TestsController::singleton().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
 }