Upstream the WPE port
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 May 2017 11:07:57 +0000 (11:07 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 May 2017 11:07:57 +0000 (11:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171110

Reviewed by Alex Christensen.

.:

webkit-dev thread:
https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html

* CMakeLists.txt: Add the WPE port identifier.
* Source/cmake/FindLibGBM.cmake: Added.
* Source/cmake/FindWPEBackend-mesa.cmake: Added.
* Source/cmake/FindWPEBackend.cmake: Added.
* Source/cmake/OptionsWPE.cmake: Added.

Source/JavaScriptCore:

* PlatformWPE.cmake: Added.
* shell/PlatformWPE.cmake: Added.

Source/ThirdParty/ANGLE:

* include/EGL/eglplatform.h:
Allow building WPE on platforms that don't provide X11 libraries.

Source/WebCore:

webkit-dev thread:
https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html

Existing files mostly changed to properly use PLATFORM(WPE) build guards.
In-file changes removed from this ChangeLog entry for brevity.

* CMakeLists.txt:
* PlatformWPE.cmake: Added.
* accessibility/AccessibilityObject.h:
* accessibility/wpe/AXObjectCacheWPE.cpp: Added.
* accessibility/wpe/AccessibilityObjectWPE.cpp: Copied from Source/WebCore/platform/audio/glib/AudioBusGLib.cpp.
* config.h:
* crypto/keys/CryptoKeyEC.h:
* crypto/keys/CryptoKeyRSA.h:
* editing/Editor.cpp:
* editing/Editor.h:
* editing/wpe/EditorWPE.cpp: Added.
* page/EventHandler.cpp:
* page/wpe/EventHandlerWPE.cpp: Added.
* platform/Cursor.h:
* platform/DragData.h:
* platform/DragImage.h:
* platform/FileSystem.h:
* platform/MainThreadSharedTimer.cpp:
* platform/MainThreadSharedTimer.h:
* platform/Pasteboard.h:
* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:
* platform/SchemeRegistry.cpp:
* platform/Widget.h:
* platform/audio/glib/AudioBusGLib.cpp:
* platform/glib/FileSystemGlib.cpp:
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/GLContext.cpp:
* platform/graphics/GLContext.h:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/OpenGLESShims.h:
* platform/graphics/PlatformDisplay.cpp:
* platform/graphics/PlatformDisplay.h:
* platform/graphics/egl/GLContextEGL.cpp:
* platform/graphics/egl/GLContextEGL.h:
* platform/graphics/egl/GLContextEGLWPE.cpp: Copied from Source/WebCore/platform/audio/glib/AudioBusGLib.cpp.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
* platform/graphics/wpe/IconWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/graphics/wpe/ImageWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/graphics/wpe/PlatformDisplayWPE.cpp: Added.
* platform/graphics/wpe/PlatformDisplayWPE.h: Added.
* platform/wpe/CursorWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/LocalizedStringsWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/PasteboardWPE.cpp: Added.
* platform/wpe/PlatformKeyboardEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/PlatformPasteboardWPE.cpp: Added.
* platform/wpe/PlatformScreenWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/RenderThemeWPE.cpp: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
* platform/wpe/RenderThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/ScrollbarThemeWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/ScrollbarThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/SoundWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/ThemeWPE.cpp: Added.
* platform/wpe/ThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* platform/wpe/WidgetWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.

Source/WebCore/PAL:

* pal/PlatformWPE.cmake: Added.

Source/WebKit2:

webkit-dev thread:
https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html

Existing files changed to properly use PLATFORM(WPE) build guards or other
WPE-specific additions (e.g. pasteboard support).
In-file changes removed from this ChangeLog entry for brevity.

* Platform/IPC/glib/GSocketMonitor.cpp:
* PlatformWPE.cmake: Added.
* Scripts/generate-forwarding-headers.pl:
* Shared/API/c/WKBase.h:
* Shared/API/c/wpe/WKBaseWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* Shared/API/c/wpe/WebKit.h: Added.
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* Shared/DrawingAreaInfo.h:
* Shared/NativeWebKeyboardEvent.h:
* Shared/NativeWebMouseEvent.h:
* Shared/NativeWebTouchEvent.h:
* Shared/NativeWebWheelEvent.h:
* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPreferencesDefinitions.h:
* Shared/wpe/NativeWebKeyboardEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* Shared/wpe/NativeWebMouseEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* Shared/wpe/NativeWebTouchEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* Shared/wpe/NativeWebWheelEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* Shared/wpe/ProcessExecutablePathWPE.cpp: Added.
* Shared/wpe/WebEventFactory.cpp: Added.
* Shared/wpe/WebEventFactory.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/wpe/WKAPICastWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/C/wpe/WKView.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/C/wpe/WKView.h: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
* UIProcess/API/wpe/CompositingManagerProxy.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/wpe/CompositingManagerProxy.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/wpe/CompositingManagerProxy.messages.in: Added.
* UIProcess/API/wpe/DrawingAreaProxyWPE.cpp: Added.
* UIProcess/API/wpe/DrawingAreaProxyWPE.h: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
* UIProcess/API/wpe/PageClientImpl.cpp: Added.
* UIProcess/API/wpe/PageClientImpl.h: Added.
* UIProcess/API/wpe/ScrollGestureController.cpp: Added.
* UIProcess/API/wpe/ScrollGestureController.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/wpe/WPEView.cpp: Added.
* UIProcess/API/wpe/WPEView.h: Added.
* UIProcess/API/wpe/WPEViewClient.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/wpe/WPEViewClient.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Added.
* UIProcess/ChildProcessProxy.cpp:
* UIProcess/Launcher/ProcessLauncher.h:
* UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp: Added.
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
* UIProcess/wpe/TextCheckerWPE.cpp: Added.
* UIProcess/wpe/WebInspectorProxyWPE.cpp: Added.
* UIProcess/wpe/WebPageProxyWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/wpe/WebPasteboardProxyWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* UIProcess/wpe/WebPreferencesWPE.cpp: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
* UIProcess/wpe/WebProcessPoolWPE.cpp: Added.
* WebKit2.xcodeproj/project.pbxproj:
* WebKit2Prefix.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: Added.
* WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
* WebProcess/WebPage/DrawingArea.cpp:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/wpe/CompositingManager.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebPage/wpe/CompositingManager.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebPage/wpe/DrawingAreaWPE.cpp: Added.
* WebProcess/WebPage/wpe/DrawingAreaWPE.h: Added.
* WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebPage/wpe/WebInspectorWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebProcess/WebPage/wpe/WebPageWPE.cpp: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
* WebProcess/wpe/WebProcessMainWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* wpe/wpe-webkit.pc.in: Added.

Source/WTF:

* wtf/Platform.h:
* wtf/PlatformWPE.cmake: Added.
* wtf/glib/RunLoopSourcePriority.h:

Tools:

webkit-dev thread:
https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html

Add WPE support to various tooling scripts, TestWebKitAPI and WebKitTestRunner.
In-file changes removed from this ChangeLog entry for brevity.

* BuildSlaveSupport/built-product-archive:
* BuildSlaveSupport/test-result-archive:
* CMakeLists.txt:
* ImageDiff/PlatformWPE.cmake: Added.
* Scripts/build-dumprendertree:
* Scripts/build-webkit:
* Scripts/build-webkittestrunner:
* Scripts/update-webkit-libs-jhbuild:
* Scripts/update-webkitwpe-libs: Added.
* Scripts/webkitdirs.pm:
* Scripts/webkitperl/FeatureList.pm:
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
* Scripts/webkitpy/port/factory.py:
* Scripts/webkitpy/port/wpe.py: Added.
* TestWebKitAPI/PlatformWPE.cmake: Added.
* TestWebKitAPI/wpe/InjectedBundleControllerWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* TestWebKitAPI/wpe/PlatformUtilitiesWPE.cpp: Added.
* TestWebKitAPI/wpe/main.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/InjectedBundle/wpe/AccessibilityControllerWPE.cpp: Added.
* WebKitTestRunner/InjectedBundle/wpe/AccessibilityUIElementWPE.cpp: Added.
* WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp: Added.
* WebKitTestRunner/InjectedBundle/wpe/InjectedBundleWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebKitTestRunner/InjectedBundle/wpe/TestRunnerWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* WebKitTestRunner/PlatformWPE.cmake: Added.
* WebKitTestRunner/PlatformWebView.h:
* WebKitTestRunner/TestController.cpp:
* WebKitTestRunner/wpe/EventSenderProxyWPE.cpp: Added.
* WebKitTestRunner/wpe/HeadlessViewBackend.cpp: Added.
* WebKitTestRunner/wpe/HeadlessViewBackend.h: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp: Added.
* WebKitTestRunner/wpe/TestControllerWPE.cpp: Added.
* WebKitTestRunner/wpe/main.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
* jhbuild/jhbuild-wrapper:
* wpe/generate-inspector-gresource-manifest.py: Added.
* wpe/jhbuild.modules: Added.
* wpe/jhbuildrc: Added.
* wpe/patches/cairo-egl-device-create-for-egl-surface.patch: Added.
* wpe/patches/fontconfig-C-11-requires-a-space-between-literal-and-identifier.patch: Added.
* wpe/patches/freetype6-2.4.11-truetype-font-height-fix.patch: Added.
* wpe/patches/gdate-suppress-string-format-literal-warning.patch: Added.
* wpe/patches/glib-warning-fix.patch: Added.
* wpe/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch: Added.
* wpe/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch: Added.
* wpe/patches/gst-plugins-good-Revert-qtdemux-expose-streams-with-first-moof-for-fr.patch: Added.
* wpe/patches/gst-plugins-good-use-the-tfdt-decode-time.patch: Added.
* wpe/patches/gstreamer-typefind-Only-push-a-CAPS-event-downstream-if-the-.patch: Added.

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

205 files changed:
CMakeLists.txt
ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/PlatformWPE.cmake [new file with mode: 0644]
Source/JavaScriptCore/shell/PlatformWPE.cmake [new file with mode: 0644]
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/include/EGL/eglplatform.h
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WTF/wtf/PlatformWPE.cmake [new file with mode: 0644]
Source/WTF/wtf/glib/RunLoopSourcePriority.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/PlatformWPE.cmake [new file with mode: 0644]
Source/WebCore/PlatformWPE.cmake [new file with mode: 0644]
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/wpe/AXObjectCacheWPE.cpp [new file with mode: 0644]
Source/WebCore/accessibility/wpe/AccessibilityObjectWPE.cpp [new file with mode: 0644]
Source/WebCore/config.h
Source/WebCore/crypto/keys/CryptoKeyEC.h
Source/WebCore/crypto/keys/CryptoKeyRSA.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/wpe/EditorWPE.cpp [new file with mode: 0644]
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/wpe/EventHandlerWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/Cursor.h
Source/WebCore/platform/DragData.h
Source/WebCore/platform/DragImage.h
Source/WebCore/platform/FileSystem.h
Source/WebCore/platform/MainThreadSharedTimer.cpp
Source/WebCore/platform/MainThreadSharedTimer.h
Source/WebCore/platform/Pasteboard.h
Source/WebCore/platform/PasteboardStrategy.h
Source/WebCore/platform/PlatformPasteboard.h
Source/WebCore/platform/SchemeRegistry.cpp
Source/WebCore/platform/Widget.h
Source/WebCore/platform/audio/glib/AudioBusGLib.cpp
Source/WebCore/platform/glib/FileSystemGlib.cpp
Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
Source/WebCore/platform/graphics/GLContext.cpp
Source/WebCore/platform/graphics/GLContext.h
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/OpenGLESShims.h
Source/WebCore/platform/graphics/PlatformDisplay.cpp
Source/WebCore/platform/graphics/PlatformDisplay.h
Source/WebCore/platform/graphics/egl/GLContextEGL.cpp
Source/WebCore/platform/graphics/egl/GLContextEGL.h
Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
Source/WebCore/platform/graphics/wpe/IconWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/wpe/ImageWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.h [new file with mode: 0644]
Source/WebCore/platform/wpe/CursorWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/LocalizedStringsWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/PasteboardWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/PlatformKeyboardEventWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/PlatformScreenWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/RenderThemeWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/RenderThemeWPE.h [new file with mode: 0644]
Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/ScrollbarThemeWPE.h [new file with mode: 0644]
Source/WebCore/platform/wpe/SoundWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/ThemeWPE.cpp [new file with mode: 0644]
Source/WebCore/platform/wpe/ThemeWPE.h [new file with mode: 0644]
Source/WebCore/platform/wpe/WidgetWPE.cpp [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/IPC/glib/GSocketMonitor.cpp
Source/WebKit2/PlatformWPE.cmake [new file with mode: 0644]
Source/WebKit2/Scripts/generate-forwarding-headers.pl
Source/WebKit2/Shared/API/c/WKBase.h
Source/WebKit2/Shared/API/c/wpe/WKBaseWPE.h [new file with mode: 0644]
Source/WebKit2/Shared/API/c/wpe/WebKit.h [new file with mode: 0644]
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
Source/WebKit2/Shared/DrawingAreaInfo.h
Source/WebKit2/Shared/NativeWebKeyboardEvent.h
Source/WebKit2/Shared/NativeWebMouseEvent.h
Source/WebKit2/Shared/NativeWebTouchEvent.h
Source/WebKit2/Shared/NativeWebWheelEvent.h
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/Shared/wpe/NativeWebKeyboardEventWPE.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/NativeWebMouseEventWPE.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/NativeWebTouchEventWPE.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/NativeWebWheelEventWPE.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/ProcessExecutablePathWPE.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/WebEventFactory.cpp [new file with mode: 0644]
Source/WebKit2/Shared/wpe/WebEventFactory.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/wpe/WKAPICastWPE.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/wpe/WKView.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.messages.in [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/PageClientImpl.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/WPEView.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/WPEView.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml [new file with mode: 0644]
Source/WebKit2/UIProcess/ChildProcessProxy.cpp
Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
Source/WebKit2/UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/WebInspectorProxy.h
Source/WebKit2/UIProcess/WebPasteboardProxy.h
Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/wpe/TextCheckerWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/wpe/WebInspectorProxyWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/wpe/WebPageProxyWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/wpe/WebPasteboardProxyWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/wpe/WebPreferencesWPE.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebKit2Prefix.h
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/wpe/CompositingManager.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/CompositingManager.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/DrawingAreaWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/DrawingAreaWPE.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/WebInspectorWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/wpe/WebPageWPE.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/wpe/WebProcessMainWPE.cpp [new file with mode: 0644]
Source/WebKit2/wpe/wpe-webkit.pc.in [new file with mode: 0644]
Source/cmake/FindLibGBM.cmake [new file with mode: 0644]
Source/cmake/FindWPEBackend-mesa.cmake [new file with mode: 0644]
Source/cmake/FindWPEBackend.cmake [new file with mode: 0644]
Source/cmake/OptionsWPE.cmake [new file with mode: 0644]
Tools/BuildSlaveSupport/built-product-archive
Tools/BuildSlaveSupport/test-result-archive
Tools/CMakeLists.txt
Tools/ChangeLog
Tools/ImageDiff/PlatformWPE.cmake [new file with mode: 0644]
Tools/Scripts/build-dumprendertree
Tools/Scripts/build-webkit
Tools/Scripts/build-webkittestrunner
Tools/Scripts/update-webkit-libs-jhbuild
Tools/Scripts/update-webkitwpe-libs [new file with mode: 0755]
Tools/Scripts/webkitdirs.pm
Tools/Scripts/webkitperl/FeatureList.pm
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/port/factory.py
Tools/Scripts/webkitpy/port/wpe.py [new file with mode: 0644]
Tools/TestWebKitAPI/PlatformWPE.cmake [new file with mode: 0644]
Tools/TestWebKitAPI/wpe/InjectedBundleControllerWPE.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/wpe/PlatformUtilitiesWPE.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/wpe/main.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/InjectedBundle/wpe/AccessibilityControllerWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/wpe/AccessibilityUIElementWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/wpe/InjectedBundleWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/wpe/TestRunnerWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/PlatformWPE.cmake [new file with mode: 0644]
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/wpe/EventSenderProxyWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/wpe/HeadlessViewBackend.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/wpe/HeadlessViewBackend.h [new file with mode: 0644]
Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/wpe/main.cpp [new file with mode: 0644]
Tools/jhbuild/jhbuild-wrapper
Tools/wpe/generate-inspector-gresource-manifest.py [new file with mode: 0755]
Tools/wpe/jhbuild.modules [new file with mode: 0644]
Tools/wpe/jhbuildrc [new file with mode: 0644]
Tools/wpe/patches/cairo-egl-device-create-for-egl-surface.patch [new file with mode: 0644]
Tools/wpe/patches/fontconfig-C-11-requires-a-space-between-literal-and-identifier.patch [new file with mode: 0644]
Tools/wpe/patches/freetype6-2.4.11-truetype-font-height-fix.patch [new file with mode: 0644]
Tools/wpe/patches/gdate-suppress-string-format-literal-warning.patch [new file with mode: 0644]
Tools/wpe/patches/glib-warning-fix.patch [new file with mode: 0644]
Tools/wpe/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch [new file with mode: 0644]
Tools/wpe/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch [new file with mode: 0644]
Tools/wpe/patches/gst-plugins-good-Revert-qtdemux-expose-streams-with-first-moof-for-fr.patch [new file with mode: 0644]
Tools/wpe/patches/gst-plugins-good-use-the-tfdt-decode-time.patch [new file with mode: 0644]
Tools/wpe/patches/gstreamer-typefind-Only-push-a-CAPS-event-downstream-if-the-.patch [new file with mode: 0644]

index bb3318c..398f55f 100644 (file)
@@ -27,6 +27,7 @@ set(ALL_PORTS
     GTK
     JSCOnly
     Mac
+    WPE
     WinCairo
 )
 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
index 412ef69..da0882c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        webkit-dev thread:
+        https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html
+
+        * CMakeLists.txt: Add the WPE port identifier.
+        * Source/cmake/FindLibGBM.cmake: Added.
+        * Source/cmake/FindWPEBackend-mesa.cmake: Added.
+        * Source/cmake/FindWPEBackend.cmake: Added.
+        * Source/cmake/OptionsWPE.cmake: Added.
+
 2017-05-04  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r216206.
index 974a4db..d30e5f6 100644 (file)
@@ -1,3 +1,13 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        * PlatformWPE.cmake: Added.
+        * shell/PlatformWPE.cmake: Added.
+
 2017-05-09  Saam Barati  <sbarati@apple.com>
 
         CallLinkInfos belonging to Wasm->JS stubs need to be informed when we clearCode() from all Executables
diff --git a/Source/JavaScriptCore/PlatformWPE.cmake b/Source/JavaScriptCore/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..aa84a05
--- /dev/null
@@ -0,0 +1,23 @@
+list(APPEND JavaScriptCore_LIBRARIES
+    ${GLIB_LIBRARIES}
+)
+list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
+    ${GLIB_INCLUDE_DIRS}
+    ${WTF_DIR}
+)
+
+set(WPE_INSTALLED_JAVASCRIPTCORE_HEADERS
+    API/JSBase.h
+    API/JSContextRef.h
+    API/JSObjectRef.h
+    API/JSStringRef.h
+    API/JSTypedArray.h
+    API/JSValueRef.h
+    API/JavaScript.h
+    API/WebKitAvailability.h
+)
+
+install(FILES ${WPE_INSTALLED_JAVASCRIPTCORE_HEADERS}
+    DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-${WPE_API_VERSION}/WPE/JavaScriptCore"
+    COMPONENT "Development"
+)
diff --git a/Source/JavaScriptCore/shell/PlatformWPE.cmake b/Source/JavaScriptCore/shell/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..623183a
--- /dev/null
@@ -0,0 +1,3 @@
+list(APPEND JSC_LIBRARIES
+    ${GLIB_LIBRARIES}
+)
index 93b7be9..bed207c 100644 (file)
@@ -1,3 +1,13 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        * include/EGL/eglplatform.h:
+        Allow building WPE on platforms that don't provide X11 libraries.
+
 2017-05-04  Don Olmstead  <don.olmstead@am.sony.com>
 
         [Win] Remove redundant macros that are set in the CMake config
index 999f6e2..9bb7591 100644 (file)
@@ -99,7 +99,7 @@ typedef struct ANativeWindow*           EGLNativeWindowType;
 typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
 typedef void*                           EGLNativeDisplayType;
 
-#elif defined(USE_OZONE)
+#elif defined(USE_OZONE) || defined(USE_WPE)
 
 typedef intptr_t EGLNativeDisplayType;
 typedef intptr_t EGLNativeWindowType;
index 607ceab..1d0c14c 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        * wtf/Platform.h:
+        * wtf/PlatformWPE.cmake: Added.
+        * wtf/glib/RunLoopSourcePriority.h:
+
 2017-05-08  Mark Lam  <mark.lam@apple.com>
 
         Speculative Windows build fix after r216428.
index e3c7cbd..6854a81 100644 (file)
 /* PLATFORM(WIN) */
 #if defined(BUILDING_GTK__)
 #define WTF_PLATFORM_GTK 1
+#elif defined(BUILDING_WPE__)
+#define WTF_PLATFORM_WPE 1
 #elif defined(BUILDING_JSCONLY__)
 /* JSCOnly does not provide PLATFORM() macro */
 #elif OS(MAC_OS_X)
 #define USE_CA 1
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 #define USE_CAIRO 1
 #define USE_GLIB 1
 #define USE_FREETYPE 1
 #endif
 
 #if !defined(HAVE_ACCESSIBILITY)
-#if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(WPE)
 #define HAVE_ACCESSIBILITY 1
 #endif
 #endif /* !defined(HAVE_ACCESSIBILITY) */
 #define ENABLE_DFG_JIT 1
 #endif
 /* Enable the DFG JIT on ARMv7.  Only tested on iOS and Qt/GTK+ Linux. */
-#if (CPU(ARM_THUMB2) || CPU(ARM64)) && (PLATFORM(IOS) || PLATFORM(GTK))
+#if (CPU(ARM_THUMB2) || CPU(ARM64)) && (PLATFORM(IOS) || PLATFORM(GTK) || PLATFORM(WPE))
 #define ENABLE_DFG_JIT 1
 #endif
 /* Enable the DFG JIT on ARM and MIPS. */
 
 /* CSS Selector JIT Compiler */
 #if !defined(ENABLE_CSS_SELECTOR_JIT)
-#if (CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && PLATFORM(IOS))) && ENABLE(JIT) && (OS(DARWIN) || PLATFORM(GTK))
+#if (CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && PLATFORM(IOS))) && ENABLE(JIT) && (OS(DARWIN) || PLATFORM(GTK) || PLATFORM(WPE))
 #define ENABLE_CSS_SELECTOR_JIT 1
 #else
 #define ENABLE_CSS_SELECTOR_JIT 0
 #define USE_EXPORT_MACROS_FOR_TESTING 1
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 #define USE_UNIX_DOMAIN_SOCKETS 1
 #endif
 
 #define USE_VIDEOTOOLBOX 1
 #endif
 
-#if PLATFORM(COCOA) || PLATFORM(GTK) || (PLATFORM(WIN) && !USE(WINGDI))
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE) || (PLATFORM(WIN) && !USE(WINGDI))
 #define USE_REQUEST_ANIMATION_FRAME_TIMER 1
 #endif
 
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
 #define USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1
 #endif
 
 #define ENABLE_RESOURCE_USAGE 1
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 #undef ENABLE_OPENTYPE_VERTICAL
 #define ENABLE_OPENTYPE_VERTICAL 1
 #define ENABLE_CSS3_TEXT_DECORATION_SKIP_INK 1
diff --git a/Source/WTF/wtf/PlatformWPE.cmake b/Source/WTF/wtf/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..2b06411
--- /dev/null
@@ -0,0 +1,30 @@
+list(APPEND WTF_SOURCES
+    PlatformUserPreferredLanguagesUnix.cpp
+    UniStdExtras.cpp
+
+    generic/MainThreadGeneric.cpp
+    generic/WorkQueueGeneric.cpp
+
+    glib/GLibUtilities.cpp
+    glib/GRefPtr.cpp
+    glib/RunLoopGLib.cpp
+
+    linux/CurrentProcessMemoryStatus.cpp
+    linux/MemoryPressureHandlerLinux.cpp
+
+    text/unix/TextBreakIteratorInternalICUUnix.cpp
+
+    unix/CPUTimeUnix.cpp
+)
+
+list(APPEND WTF_LIBRARIES
+    ${GLIB_GIO_LIBRARIES}
+    ${GLIB_GOBJECT_LIBRARIES}
+    ${GLIB_LIBRARIES}
+    pthread
+    ${ZLIB_LIBRARIES}
+)
+
+list(APPEND WTF_INCLUDE_DIRECTORIES
+    ${GLIB_INCLUDE_DIRS}
+)
index 8d247c3..c9a4567 100644 (file)
@@ -23,6 +23,8 @@
 
 namespace WTF {
 
+#if PLATFORM(GTK)
+
 // This is a global enum to define priorities used by GLib run loop sources.
 // In GLib, priorities are represented by an integer where lower values mean
 // higher priority. The following macros are defined in GLib:
@@ -80,6 +82,33 @@ enum RunLoopSourcePriority {
     DiskCacheWrite = 200,
 };
 
+#elif PLATFORM(WPE)
+
+enum RunLoopSourcePriority {
+    RunLoopDispatcher = -70,
+    RunLoopTimer = -70,
+
+    MainThreadDispatcherTimer = -60,
+
+    MemoryPressureHandlerTimer = -80,
+
+    JavascriptTimer = -60,
+    MainThreadSharedTimer = -60,
+
+    LayerFlushTimer = -70,
+    DisplayRefreshMonitorTimer = -70,
+
+    CompositingThreadUpdateTimer = -70,
+
+    ReleaseUnusedResourcesTimer = -70,
+
+    AsyncIONetwork = -70,
+    DiskCacheRead = -70,
+    DiskCacheWrite = -60
+};
+
+#endif
+
 } // namespace WTF
 
 using WTF::RunLoopSourcePriority;
index e9c3a47..459df7c 100644 (file)
@@ -4003,7 +4003,8 @@ if (ENABLE_GRAPHICS_CONTEXT_3D AND NOT WIN32)
     set_property(TARGET ANGLESupport
         PROPERTY COMPILE_DEFINITIONS
         ANGLE_ENABLE_ESSL
-        ANGLE_ENABLE_GLSL)
+        ANGLE_ENABLE_GLSL
+        ${ANGLE_PLATFORM_DEFINITIONS})
 
     target_include_directories(ANGLESupport PRIVATE
         "${THIRDPARTY_DIR}/ANGLE"
index e100f3a..177b37d 100644 (file)
@@ -1,3 +1,73 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        webkit-dev thread:
+        https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html
+
+        Existing files mostly changed to properly use PLATFORM(WPE) build guards.
+        In-file changes removed from this ChangeLog entry for brevity.
+
+        * CMakeLists.txt:
+        * PlatformWPE.cmake: Added.
+        * accessibility/AccessibilityObject.h:
+        * accessibility/wpe/AXObjectCacheWPE.cpp: Added.
+        * accessibility/wpe/AccessibilityObjectWPE.cpp: Copied from Source/WebCore/platform/audio/glib/AudioBusGLib.cpp.
+        * config.h:
+        * crypto/keys/CryptoKeyEC.h:
+        * crypto/keys/CryptoKeyRSA.h:
+        * editing/Editor.cpp:
+        * editing/Editor.h:
+        * editing/wpe/EditorWPE.cpp: Added.
+        * page/EventHandler.cpp:
+        * page/wpe/EventHandlerWPE.cpp: Added.
+        * platform/Cursor.h:
+        * platform/DragData.h:
+        * platform/DragImage.h:
+        * platform/FileSystem.h:
+        * platform/MainThreadSharedTimer.cpp:
+        * platform/MainThreadSharedTimer.h:
+        * platform/Pasteboard.h:
+        * platform/PasteboardStrategy.h:
+        * platform/PlatformPasteboard.h:
+        * platform/SchemeRegistry.cpp:
+        * platform/Widget.h:
+        * platform/audio/glib/AudioBusGLib.cpp:
+        * platform/glib/FileSystemGlib.cpp:
+        * platform/graphics/ANGLEWebKitBridge.h:
+        * platform/graphics/GLContext.cpp:
+        * platform/graphics/GLContext.h:
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/OpenGLESShims.h:
+        * platform/graphics/PlatformDisplay.cpp:
+        * platform/graphics/PlatformDisplay.h:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        * platform/graphics/egl/GLContextEGL.h:
+        * platform/graphics/egl/GLContextEGLWPE.cpp: Copied from Source/WebCore/platform/audio/glib/AudioBusGLib.cpp.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        * platform/graphics/wpe/IconWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/graphics/wpe/ImageWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/graphics/wpe/PlatformDisplayWPE.cpp: Added.
+        * platform/graphics/wpe/PlatformDisplayWPE.h: Added.
+        * platform/wpe/CursorWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/LocalizedStringsWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/PasteboardWPE.cpp: Added.
+        * platform/wpe/PlatformKeyboardEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/PlatformPasteboardWPE.cpp: Added.
+        * platform/wpe/PlatformScreenWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/RenderThemeWPE.cpp: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
+        * platform/wpe/RenderThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/ScrollbarThemeWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/ScrollbarThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/SoundWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/ThemeWPE.cpp: Added.
+        * platform/wpe/ThemeWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * platform/wpe/WidgetWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+
 2017-05-09  Frederic Wang  <fwang@igalia.com>
 
         Fix property names in ScrollingTreeScrollingNode::dumpProperties
index f66577a..e72b91e 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        * pal/PlatformWPE.cmake: Added.
+
 2017-05-04  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r216206.
diff --git a/Source/WebCore/PAL/pal/PlatformWPE.cmake b/Source/WebCore/PAL/pal/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..775c189
--- /dev/null
@@ -0,0 +1,3 @@
+list(APPEND PAL_SOURCES
+    crypto/gcrypt/CryptoDigestGCrypt.cpp
+)
diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..93b3ef6
--- /dev/null
@@ -0,0 +1,302 @@
+include(platform/GStreamer.cmake)
+include(platform/ImageDecoders.cmake)
+include(platform/Linux.cmake)
+include(platform/TextureMapper.cmake)
+
+# Allow building ANGLE on platforms that don't provide X11 headers.
+list(APPEND ANGLE_PLATFORM_DEFINITIONS "USE_WPE")
+
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector"
+    ${JAVASCRIPTCORE_DIR}
+    "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
+    "${JAVASCRIPTCORE_DIR}/API"
+    "${JAVASCRIPTCORE_DIR}/assembler"
+    "${JAVASCRIPTCORE_DIR}/bytecode"
+    "${JAVASCRIPTCORE_DIR}/bytecompiler"
+    "${JAVASCRIPTCORE_DIR}/dfg"
+    "${JAVASCRIPTCORE_DIR}/disassembler"
+    "${JAVASCRIPTCORE_DIR}/domjit"
+    "${JAVASCRIPTCORE_DIR}/heap"
+    "${JAVASCRIPTCORE_DIR}/debugger"
+    "${JAVASCRIPTCORE_DIR}/interpreter"
+    "${JAVASCRIPTCORE_DIR}/jit"
+    "${JAVASCRIPTCORE_DIR}/llint"
+    "${JAVASCRIPTCORE_DIR}/parser"
+    "${JAVASCRIPTCORE_DIR}/profiler"
+    "${JAVASCRIPTCORE_DIR}/runtime"
+    "${JAVASCRIPTCORE_DIR}/yarr"
+    "${THIRDPARTY_DIR}/ANGLE/"
+    "${THIRDPARTY_DIR}/ANGLE/include/KHR"
+    "${WEBCORE_DIR}/platform/cairo"
+    "${WEBCORE_DIR}/platform/graphics/cairo"
+    "${WEBCORE_DIR}/platform/graphics/egl"
+    "${WEBCORE_DIR}/platform/graphics/glx"
+    "${WEBCORE_DIR}/platform/graphics/freetype"
+    "${WEBCORE_DIR}/platform/graphics/gstreamer"
+    "${WEBCORE_DIR}/platform/graphics/harfbuzz/"
+    "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
+    "${WEBCORE_DIR}/platform/graphics/opengl"
+    "${WEBCORE_DIR}/platform/graphics/opentype"
+    "${WEBCORE_DIR}/platform/graphics/wpe"
+    "${WEBCORE_DIR}/platform/graphics/wayland"
+    "${WEBCORE_DIR}/platform/mock/mediasource"
+    "${WEBCORE_DIR}/platform/network/soup"
+    "${WEBCORE_DIR}/platform/text/icu"
+    ${WTF_DIR}
+)
+
+list(APPEND WebCore_SOURCES
+    accessibility/wpe/AXObjectCacheWPE.cpp
+    accessibility/wpe/AccessibilityObjectWPE.cpp
+
+    loader/soup/CachedRawResourceSoup.cpp
+    loader/soup/SubresourceLoaderSoup.cpp
+
+    page/scrolling/ScrollingStateStickyNode.cpp
+    page/scrolling/ScrollingThread.cpp
+    page/scrolling/ScrollingTreeNode.cpp
+    page/scrolling/ScrollingTreeScrollingNode.cpp
+
+    page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp
+    page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp
+
+    platform/Cursor.cpp
+    platform/KillRingNone.cpp
+    platform/PlatformStrategies.cpp
+    platform/Theme.cpp
+
+    platform/audio/glib/AudioBusGLib.cpp
+
+    platform/glib/EventLoopGlib.cpp
+    platform/glib/FileSystemGlib.cpp
+    platform/glib/KeyedDecoderGlib.cpp
+    platform/glib/KeyedEncoderGlib.cpp
+    platform/glib/MainThreadSharedTimerGLib.cpp
+    platform/glib/SSLKeyGeneratorGLib.cpp
+    platform/glib/SharedBufferGlib.cpp
+
+    platform/graphics/GLContext.cpp
+    platform/graphics/GraphicsContext3DPrivate.cpp
+    platform/graphics/ImageSource.cpp
+    platform/graphics/PlatformDisplay.cpp
+    platform/graphics/WOFFFileFormat.cpp
+
+    platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp
+    platform/graphics/cairo/CairoUtilities.cpp
+    platform/graphics/cairo/FloatRectCairo.cpp
+    platform/graphics/cairo/FontCairo.cpp
+    platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
+    platform/graphics/cairo/GradientCairo.cpp
+    platform/graphics/cairo/GraphicsContext3DCairo.cpp
+    platform/graphics/cairo/GraphicsContextCairo.cpp
+    platform/graphics/cairo/ImageBufferCairo.cpp
+    platform/graphics/cairo/ImageCairo.cpp
+    platform/graphics/cairo/IntRectCairo.cpp
+    platform/graphics/cairo/NativeImageCairo.cpp
+    platform/graphics/cairo/PathCairo.cpp
+    platform/graphics/cairo/PatternCairo.cpp
+    platform/graphics/cairo/PlatformContextCairo.cpp
+    platform/graphics/cairo/PlatformPathCairo.cpp
+    platform/graphics/cairo/RefPtrCairo.cpp
+    platform/graphics/cairo/TransformationMatrixCairo.cpp
+
+    platform/graphics/egl/GLContextEGL.cpp
+
+    platform/graphics/freetype/FontCacheFreeType.cpp
+    platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
+    platform/graphics/freetype/FontPlatformDataFreeType.cpp
+    platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
+    platform/graphics/freetype/SimpleFontDataFreeType.cpp
+
+    platform/graphics/gstreamer/ImageGStreamerCairo.cpp
+
+    platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
+    platform/graphics/harfbuzz/HarfBuzzFace.cpp
+    platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
+    platform/graphics/harfbuzz/HarfBuzzShaper.cpp
+
+    platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+    platform/graphics/opengl/Extensions3DOpenGLES.cpp
+    platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
+    platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
+    platform/graphics/opengl/TemporaryOpenGLSetting.cpp
+
+    platform/graphics/opentype/OpenTypeVerticalData.cpp
+
+    platform/graphics/wpe/PlatformDisplayWPE.cpp
+
+    platform/image-decoders/cairo/ImageBackingStoreCairo.cpp
+
+    platform/network/soup/AuthenticationChallengeSoup.cpp
+    platform/network/soup/CertificateInfo.cpp
+    platform/network/soup/CookieJarSoup.cpp
+    platform/network/soup/CookieStorageSoup.cpp
+    platform/network/soup/CredentialStorageSoup.cpp
+    platform/network/soup/DNSSoup.cpp
+    platform/network/soup/GRefPtrSoup.cpp
+    platform/network/soup/NetworkStorageSessionSoup.cpp
+    platform/network/soup/ProxyServerSoup.cpp
+    platform/network/soup/ResourceErrorSoup.cpp
+    platform/network/soup/ResourceHandleSoup.cpp
+    platform/network/soup/ResourceRequestSoup.cpp
+    platform/network/soup/ResourceResponseSoup.cpp
+    platform/network/soup/SocketStreamHandleImplSoup.cpp
+    platform/network/soup/SoupNetworkSession.cpp
+    platform/network/soup/SynchronousLoaderClientSoup.cpp
+    platform/network/soup/WebKitSoupRequestGeneric.cpp
+
+    platform/soup/SharedBufferSoup.cpp
+    platform/soup/URLSoup.cpp
+
+    platform/text/Hyphenation.cpp
+    platform/text/LocaleICU.cpp
+    platform/text/TextCodecICU.cpp
+    platform/text/TextEncodingDetectorICU.cpp
+
+    platform/unix/LoggingUnix.cpp
+
+    platform/xdg/MIMETypeRegistryXdg.cpp
+)
+
+list(APPEND WebCorePlatformWPE_SOURCES
+    editing/wpe/EditorWPE.cpp
+
+    page/wpe/EventHandlerWPE.cpp
+
+    platform/graphics/egl/GLContextEGLWPE.cpp
+
+    platform/graphics/wpe/IconWPE.cpp
+    platform/graphics/wpe/ImageWPE.cpp
+
+    platform/wpe/CursorWPE.cpp
+    platform/wpe/LocalizedStringsWPE.cpp
+    platform/wpe/PasteboardWPE.cpp
+    platform/wpe/PlatformKeyboardEventWPE.cpp
+    platform/wpe/PlatformPasteboardWPE.cpp
+    platform/wpe/PlatformScreenWPE.cpp
+    platform/wpe/RenderThemeWPE.cpp
+    platform/wpe/ScrollbarThemeWPE.cpp
+    platform/wpe/SoundWPE.cpp
+    platform/wpe/ThemeWPE.cpp
+    platform/wpe/WidgetWPE.cpp
+)
+
+list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
+    ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsBase.css
+)
+
+set(WebCore_USER_AGENT_SCRIPTS
+    ${WEBCORE_DIR}/English.lproj/mediaControlsLocalizedStrings.js
+    ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsBase.js
+)
+
+set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/wpe/RenderThemeWPE.cpp)
+
+list(APPEND WebCore_LIBRARIES
+    ${CAIRO_LIBRARIES}
+    ${EGL_LIBRARIES}
+    ${FONTCONFIG_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
+    ${GLIB_GIO_LIBRARIES}
+    ${GLIB_GMODULE_LIBRARIES}
+    ${GLIB_GOBJECT_LIBRARIES}
+    ${GLIB_LIBRARIES}
+    ${GNUTLS_LIBRARIES}
+    ${HARFBUZZ_LIBRARIES}
+    ${ICU_LIBRARIES}
+    ${LIBGCRYPT_LIBRARIES}
+    ${LIBSOUP_LIBRARIES}
+    ${LIBXML2_LIBRARIES}
+    ${LIBXSLT_LIBRARIES}
+    ${SQLITE_LIBRARIES}
+    ${WPE_LIBRARIES}
+)
+
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    ${CAIRO_INCLUDE_DIRS}
+    ${EGL_INCLUDE_DIRS}
+    ${FONTCONFIG_INCLUDE_DIRS}
+    ${FREETYPE2_INCLUDE_DIRS}
+    ${GLIB_INCLUDE_DIRS}
+    ${GNUTLS_INCLUDE_DIRS}
+    ${HARFBUZZ_INCLUDE_DIRS}
+    ${ICU_INCLUDE_DIRS}
+    ${LIBGCRYPT_INCLUDE_DIRS}
+    ${LIBSOUP_INCLUDE_DIRS}
+    ${LIBXML2_INCLUDE_DIR}
+    ${LIBXSLT_INCLUDE_DIR}
+    ${SQLITE_INCLUDE_DIR}
+    ${WPE_INCLUDE_DIRS}
+)
+
+add_library(WebCorePlatformWPE ${WebCore_LIBRARY_TYPE} ${WebCorePlatformWPE_SOURCES})
+add_dependencies(WebCorePlatformWPE WebCore)
+WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformWPE)
+target_include_directories(WebCorePlatformWPE PRIVATE
+    ${WebCore_INCLUDE_DIRECTORIES}
+)
+target_include_directories(WebCorePlatformWPE SYSTEM PRIVATE
+    ${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
+)
+target_link_libraries(WebCorePlatformWPE
+    ${WebCore_LIBRARIES}
+)
+
+if (ENABLE_SUBTLE_CRYPTO)
+    list(APPEND WebCore_SOURCES
+        crypto/CryptoAlgorithm.cpp
+        crypto/CryptoAlgorithmRegistry.cpp
+        crypto/CryptoKey.cpp
+        crypto/SubtleCrypto.cpp
+        crypto/WebKitSubtleCrypto.cpp
+
+        crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
+        crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
+        crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
+        crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
+        crypto/algorithms/CryptoAlgorithmAES_KW.cpp
+        crypto/algorithms/CryptoAlgorithmECDH.cpp
+        crypto/algorithms/CryptoAlgorithmECDSA.cpp
+        crypto/algorithms/CryptoAlgorithmHKDF.cpp
+        crypto/algorithms/CryptoAlgorithmHMAC.cpp
+        crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
+        crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
+        crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
+        crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
+        crypto/algorithms/CryptoAlgorithmSHA1.cpp
+        crypto/algorithms/CryptoAlgorithmSHA224.cpp
+        crypto/algorithms/CryptoAlgorithmSHA256.cpp
+        crypto/algorithms/CryptoAlgorithmSHA384.cpp
+        crypto/algorithms/CryptoAlgorithmSHA512.cpp
+
+        crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp
+        crypto/gcrypt/CryptoKeyECGCrypt.cpp
+        crypto/gcrypt/CryptoKeyRSAGCrypt.cpp
+        crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp
+
+        crypto/keys/CryptoKeyAES.cpp
+        crypto/keys/CryptoKeyDataOctetSequence.cpp
+        crypto/keys/CryptoKeyDataRSAComponents.cpp
+        crypto/keys/CryptoKeyEC.cpp
+        crypto/keys/CryptoKeyHMAC.cpp
+        crypto/keys/CryptoKeyRSA.cpp
+        crypto/keys/CryptoKeyRaw.cpp
+        crypto/keys/CryptoKeySerializationRaw.cpp
+    )
+endif ()
+
index b0fafff..1c39a0a 100644 (file)
@@ -66,6 +66,8 @@ typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
 #elif PLATFORM(GTK)
 typedef struct _AtkObject AtkObject;
 typedef struct _AtkObject AccessibilityObjectWrapper;
+#elif PLATFORM(WPE)
+class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { };
 #else
 class AccessibilityObjectWrapper;
 #endif
@@ -1152,6 +1154,8 @@ protected:
     COMPtr<AccessibilityObjectWrapper> m_wrapper;
 #elif PLATFORM(GTK)
     AtkObject* m_wrapper;
+#elif PLATFORM(WPE)
+    RefPtr<AccessibilityObjectWrapper> m_wrapper;
 #endif
 };
 
diff --git a/Source/WebCore/accessibility/wpe/AXObjectCacheWPE.cpp b/Source/WebCore/accessibility/wpe/AXObjectCacheWPE.cpp
new file mode 100644 (file)
index 0000000..1541594
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 Igalia, S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "AXObjectCache.h"
+
+#if HAVE(ACCESSIBILITY)
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void AXObjectCache::detachWrapper(AccessibilityObject*, AccessibilityDetachmentType)
+{
+    notImplemented();
+}
+
+void AXObjectCache::attachWrapper(AccessibilityObject*)
+{
+    notImplemented();
+}
+
+void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification)
+{
+    notImplemented();
+}
+
+void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&)
+{
+    notImplemented();
+}
+
+void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
+{
+    notImplemented();
+}
+
+void AXObjectCache::platformHandleFocusedUIElementChanged(Node*, Node*)
+{
+    notImplemented();
+}
+
+void AXObjectCache::handleScrolledToAnchor(const Node*)
+{
+    notImplemented();
+}
+
+} // namespace WebCore
+
+#endif // HAVE(ACCESSIBILITY)
diff --git a/Source/WebCore/accessibility/wpe/AccessibilityObjectWPE.cpp b/Source/WebCore/accessibility/wpe/AccessibilityObjectWPE.cpp
new file mode 100644 (file)
index 0000000..0e94c59
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 Igalia, S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "AXObjectCache.h"
+
+#if HAVE(ACCESSIBILITY)
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+bool AccessibilityObject::accessibilityIgnoreAttachment() const
+{
+    notImplemented();
+    return false;
+}
+
+AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const
+{
+    notImplemented();
+    return DefaultBehavior;
+}
+
+} // namespace WebCore
+
+#endif // HAVE(ACCESSIBILITY)
index e30f412..7d9e460 100644 (file)
@@ -96,7 +96,7 @@
 #endif
 #endif
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(WPE)
 #define USE_NEW_THEME 1
 #endif
 
index 443a682..4c7d029 100644 (file)
@@ -36,7 +36,7 @@ typedef struct _CCECCryptor *CCECCryptorRef;
 typedef CCECCryptorRef PlatformECKey;
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 // gcry_sexp* equates gcry_sexp_t.
 struct gcry_sexp;
 typedef gcry_sexp* PlatformECKey;
index 305bd4c..41bce85 100644 (file)
@@ -36,7 +36,7 @@ typedef struct _CCRSACryptor *CCRSACryptorRef;
 typedef CCRSACryptorRef PlatformRSAKey;
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 // gcry_sexp* equates gcry_sexp_t.
 struct gcry_sexp;
 typedef gcry_sexp* PlatformRSAKey;
index 5259d33..652eee4 100644 (file)
@@ -1245,13 +1245,13 @@ void Editor::performCutOrCopy(EditorActionSpecifier action)
             imageElement = imageElementFromImageDocument(document());
 
         if (imageElement) {
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
             writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *imageElement, document().url(), document().title());
 #else
             Pasteboard::createForCopyAndPaste()->writeImage(*imageElement, document().url(), document().title());
 #endif
         } else {
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
             writeSelectionToPasteboard(*Pasteboard::createForCopyAndPaste());
 #else
             // FIXME: Convert all other platforms to match Mac and delete this.
@@ -1376,7 +1376,7 @@ void Editor::copyImage(const HitTestResult& result)
     if (url.isEmpty())
         url = result.absoluteImageURL();
 
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
     writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *element, url, result.altDisplayString());
 #else
     Pasteboard::createForCopyAndPaste()->writeImage(*element, url, result.altDisplayString());
index 9d994f3..42af9aa 100644 (file)
@@ -457,7 +457,7 @@ public:
     WEBCORE_EXPORT void replaceSelectionWithAttributedString(NSAttributedString *, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
 #endif
 
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
     WEBCORE_EXPORT void writeSelectionToPasteboard(Pasteboard&);
     WEBCORE_EXPORT void writeImageToPasteboard(Pasteboard&, Element& imageElement, const URL&, const String& title);
     void writeSelection(PasteboardWriterData&);
diff --git a/Source/WebCore/editing/wpe/EditorWPE.cpp b/Source/WebCore/editing/wpe/EditorWPE.cpp
new file mode 100644 (file)
index 0000000..1ca9af1
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "Editor.h"
+
+#include "DocumentFragment.h"
+#include "Frame.h"
+#include "NotImplemented.h"
+#include "Pasteboard.h"
+#include "markup.h"
+
+namespace WebCore {
+
+static RefPtr<DocumentFragment> createFragmentFromPasteboardData(Pasteboard& pasteboard, Frame& frame, Range& range, bool allowPlainText, bool& chosePlainText)
+{
+    chosePlainText = false;
+
+    Vector<String> types = pasteboard.types();
+    if (types.isEmpty())
+        return nullptr;
+
+    if (types.contains("text/html;charset=utf-8") && frame.document()) {
+        String markup = pasteboard.readString("text/html;charset=utf-8");
+        if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(*frame.document(), markup, emptyString(), DisallowScriptingAndPluginContent))
+            return fragment;
+    }
+
+    if (!allowPlainText)
+        return nullptr;
+
+    if (types.contains("text/plain;charset=utf-8")) {
+        chosePlainText = true;
+        if (RefPtr<DocumentFragment> fragment = createFragmentFromText(range, pasteboard.readString("text/plain;charset=utf-8")))
+            return fragment;
+    }
+
+    return nullptr;
+}
+
+void Editor::writeSelectionToPasteboard(Pasteboard& pasteboard)
+{
+    PasteboardWebContent pasteboardContent;
+    pasteboardContent.text = selectedTextForDataTransfer();
+    pasteboardContent.markup = createMarkup(*selectedRange(), nullptr, AnnotateForInterchange, false, ResolveNonLocalURLs);
+    pasteboard.write(pasteboardContent);
+}
+
+void Editor::writeImageToPasteboard(Pasteboard&, Element&, const URL&, const String&)
+{
+    notImplemented();
+}
+
+void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, MailBlockquoteHandling mailBlockquoteHandling)
+{
+    RefPtr<Range> range = selectedRange();
+    if (!range)
+        return;
+
+    bool chosePlainText;
+    RefPtr<DocumentFragment> fragment = createFragmentFromPasteboardData(*pasteboard, m_frame, *range, allowPlainText, chosePlainText);
+    if (fragment && shouldInsertFragment(*fragment, range.get(), EditorInsertAction::Pasted))
+        pasteAsFragment(*fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);
+}
+
+} // namespace WebCore
index b89c365..8c26829 100644 (file)
@@ -2612,7 +2612,7 @@ bool EventHandler::isInsideScrollbar(const IntPoint& windowPoint) const
     return false;
 }
 
-#if !PLATFORM(GTK)
+#if !PLATFORM(GTK) && !PLATFORM(WPE)
 
 bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const
 {
diff --git a/Source/WebCore/page/wpe/EventHandlerWPE.cpp b/Source/WebCore/page/wpe/EventHandlerWPE.cpp
new file mode 100644 (file)
index 0000000..e14e0fe
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "EventHandler.h"
+
+#include "FocusController.h"
+#include "Frame.h"
+#include "NotImplemented.h"
+#include "Page.h"
+
+namespace WebCore {
+
+bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const
+{
+    notImplemented();
+    return false;
+}
+
+void EventHandler::focusDocumentView()
+{
+    if (Page* page = m_frame.page())
+        page->focusController().setFocusedFrame(&m_frame);
+}
+
+bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget*)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passMouseDownEventToWidget(Widget*)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent&, Widget&)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame*)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame*, HitTestResult*)
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame*)
+{
+    notImplemented();
+    return false;
+}
+
+OptionSet<PlatformEvent::Modifier> EventHandler::accessKeyModifiers()
+{
+    notImplemented();
+    return PlatformEvent::Modifier::AltKey;
+}
+
+bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const
+{
+    notImplemented();
+    return false;
+}
+
+}
index cdcf265..5e911d7 100644 (file)
@@ -74,6 +74,8 @@ using PlatformCursor = RefPtr<SharedCursor>;
 using PlatformCursor = NSCursor *;
 #elif PLATFORM(GTK)
 using PlatformCursor = GRefPtr<GdkCursor>;
+#elif PLATFORM(WPE)
+using PlatformCursor = void*;
 #endif
 
 class Cursor {
index 689197f..50ceb86 100644 (file)
@@ -53,7 +53,7 @@ namespace WebCore {
 class SelectionData;
 }
 typedef WebCore::SelectionData* DragDataRef;
-#elif PLATFORM(IOS)
+#elif PLATFORM(IOS) || PLATFORM(WPE)
 typedef void* DragDataRef;
 #endif
 
index e7d53f9..fd55dc8 100644 (file)
@@ -41,7 +41,7 @@ typedef struct CGImage *CGImageRef;
 OBJC_CLASS NSImage;
 #elif PLATFORM(WIN)
 typedef struct HBITMAP__* HBITMAP;
-#elif PLATFORM(GTK)
+#elif USE(CAIRO)
 #include "RefPtrCairo.h"
 #endif
 
@@ -64,7 +64,7 @@ typedef RetainPtr<CGImageRef> DragImageRef;
 typedef RetainPtr<NSImage> DragImageRef;
 #elif PLATFORM(WIN)
 typedef HBITMAP DragImageRef;
-#elif PLATFORM(GTK)
+#elif PLATFORM(GTK) || PLATFORM(WPE)
 typedef RefPtr<cairo_surface_t> DragImageRef;
 #endif
 
index 195b676..1d80b4c 100644 (file)
@@ -198,7 +198,7 @@ WEBCORE_EXPORT bool filesHaveSameVolume(const String&, const String&);
 RetainPtr<CFURLRef> pathAsURL(const String&);
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 String filenameForDisplay(const String&);
 CString applicationDirectoryPath();
 CString sharedResourcesPath();
index 778cac2..dda682e 100644 (file)
@@ -34,7 +34,7 @@ MainThreadSharedTimer& MainThreadSharedTimer::singleton()
     return instance;
 }
 
-#if !PLATFORM(GTK)
+#if !PLATFORM(GTK) && !PLATFORM(WPE)
 MainThreadSharedTimer::MainThreadSharedTimer()
 {
 }
index 590f689..490730f 100644 (file)
@@ -30,7 +30,7 @@
 #include "SharedTimer.h"
 #include <wtf/NeverDestroyed.h>
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 #include <wtf/RunLoop.h>
 #endif
 
@@ -54,7 +54,7 @@ private:
     MainThreadSharedTimer();
 
     std::function<void()> m_firedFunction;
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
     RunLoop::Timer<MainThreadSharedTimer> m_timer;
 #endif
 };
index 8c213d9..87ac7f0 100644 (file)
@@ -62,7 +62,7 @@ enum ShouldSerializeSelectedTextForDataTransfer { DefaultSelectedTextType, Inclu
 // For writing to the pasteboard. Generally sorted with the richest formats on top.
 
 struct PasteboardWebContent {
-#if !(PLATFORM(GTK) || PLATFORM(WIN))
+#if !(PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(WPE))
     WEBCORE_EXPORT PasteboardWebContent();
     WEBCORE_EXPORT ~PasteboardWebContent();
     bool canSmartCopyOrDelete;
@@ -80,6 +80,10 @@ struct PasteboardWebContent {
     String text;
     String markup;
 #endif
+#if PLATFORM(WPE)
+    String text;
+    String markup;
+#endif
 };
 
 struct PasteboardURL {
index d72f120..3c6da6c 100644 (file)
@@ -73,10 +73,19 @@ public:
     virtual long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) = 0;
     virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) = 0;
 #endif
+
 #if PLATFORM(GTK)
     virtual void writeToClipboard(const String& pasteboardName, const SelectionData&) = 0;
     virtual Ref<SelectionData> readFromClipboard(const String& pasteboardName) = 0;
 #endif // PLATFORM(GTK)
+
+#if PLATFORM(WPE)
+    virtual void getTypes(Vector<String>& types) = 0;
+    virtual String readStringFromPasteboard(int index, const String& pasteboardType) = 0;
+    virtual void writeToPasteboard(const PasteboardWebContent&) = 0;
+    virtual void writeToPasteboard(const String& pasteboardType, const String&) = 0;
+#endif
+
 protected:
     virtual ~PasteboardStrategy()
     {
index 85a8c9f..23f6f30 100644 (file)
@@ -40,6 +40,10 @@ OBJC_CLASS NSPasteboard;
 OBJC_CLASS UIPasteboard;
 #endif
 
+#if PLATFORM(WPE)
+struct wpe_pasteboard;
+#endif
+
 namespace WebCore {
 
 class Color;
@@ -53,7 +57,7 @@ struct PasteboardWebContent;
 class PlatformPasteboard {
 public:
     WEBCORE_EXPORT explicit PlatformPasteboard(const String& pasteboardName);
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || PLATFORM(WPE)
     WEBCORE_EXPORT PlatformPasteboard();
     WEBCORE_EXPORT Vector<String> filenamesForDataInteraction();
     WEBCORE_EXPORT void getTypesByFidelityForItemAtIndex(Vector<String>& types, int index);
@@ -110,6 +114,9 @@ private:
 #if PLATFORM(GTK)
     GtkClipboard* m_clipboard;
 #endif
+#if PLATFORM(WPE)
+    struct wpe_pasteboard* m_pasteboard;
+#endif
 };
 
 }
index 5bad3cd..64e3563 100644 (file)
@@ -59,7 +59,7 @@ static URLSchemesMap& secureSchemes()
         secureSchemes.get().add("about");
         secureSchemes.get().add("data");
         secureSchemes.get().add("wss");
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
         secureSchemes.get().add("resource");
 #endif
     }
index 55b49a4..5d7aa48 100644 (file)
@@ -61,6 +61,10 @@ typedef struct _GtkContainer GtkContainer;
 typedef GtkWidget* PlatformWidget;
 #endif
 
+#if PLATFORM(WPE)
+typedef void* PlatformWidget;
+#endif
+
 typedef PlatformWidget PlatformPageClient;
 
 namespace WebCore {
index 791bfa3..81975b6 100644 (file)
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/GUniquePtr.h>
 
+#if PLATFORM(GTK)
+#define AUDIO_GRESOURCE_PATH "/org/webkitgtk/resources/audio"
+#elif PLATFORM(WPE)
+#define AUDIO_GRESOURCE_PATH "/org/webkitwpe/resources/audio"
+#endif
+
 namespace WebCore {
 
 PassRefPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate)
 {
-    GUniquePtr<char> path(g_strdup_printf("/org/webkitgtk/resources/audio/%s", name));
+    GUniquePtr<char> path(g_strdup_printf(AUDIO_GRESOURCE_PATH "/%s", name));
     GRefPtr<GBytes> data = adoptGRef(g_resources_lookup_data(path.get(), G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr));
     ASSERT(data);
     return createBusFromInMemoryAudioFile(g_bytes_get_data(data.get(), nullptr), g_bytes_get_size(data.get()), false, sampleRate);
index 3cd547b..2651047 100644 (file)
@@ -213,6 +213,9 @@ CString sharedResourcesPath()
     if (!cachedPath.isNull())
         return cachedPath;
 
+#if PLATFORM(WPE)
+    GUniquePtr<gchar> dataPath(g_build_filename(DATA_DIR, "wpe", nullptr));
+#elif PLATFORM(GTK)
 #if OS(WINDOWS)
     HMODULE hmodule = 0;
     GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<char*>(sharedResourcesPath), &hmodule);
@@ -222,6 +225,7 @@ CString sharedResourcesPath()
 #else
     GUniquePtr<gchar> dataPath(g_build_filename(DATA_DIR, "webkitgtk-" WEBKITGTK_API_VERSION_STRING, NULL));
 #endif
+#endif
 
     cachedPath = dataPath.get();
     return cachedPath;
index 9114e76..2accfad 100644 (file)
@@ -36,7 +36,7 @@
 #include <OpenGL/gl.h>
 #elif PLATFORM(WIN)
 #include "OpenGLESShims.h"
-#elif PLATFORM(GTK)
+#elif PLATFORM(GTK) || PLATFORM(WPE)
 #if USE(OPENGL_ES_2)
 #include <GLES2/gl2.h>
 #else
index 70f5873..c15bec5 100644 (file)
@@ -120,7 +120,7 @@ std::unique_ptr<GLContext> GLContext::createSharingContext(PlatformDisplay& disp
     }
 #endif
 
-#if USE(EGL) || PLATFORM(WAYLAND)
+#if USE(EGL) || PLATFORM(WAYLAND) || PLATFORM(WPE)
     if (auto eglContext = GLContextEGL::createSharingContext(display))
         return WTFMove(eglContext);
 #endif
index 2c0ea27..9d6db17 100644 (file)
 #include <wtf/Noncopyable.h>
 
 #if USE(EGL) && !PLATFORM(GTK)
+#if PLATFORM(WPE)
+// FIXME: For now default to the GBM EGL platform, but this should really be
+// somehow deducible from the build configuration.
+#define __GBM__ 1
+#include <EGL/eglplatform.h>
+#else
 #include "eglplatform.h"
+#endif
 typedef EGLNativeWindowType GLNativeWindowType;
 #else
 typedef uint64_t GLNativeWindowType;
index 7d80d5b..b2b7952 100644 (file)
@@ -60,7 +60,7 @@
 #include <wtf/RetainPtr.h>
 OBJC_CLASS CALayer;
 OBJC_CLASS WebGLLayer;
-#elif PLATFORM(GTK) || PLATFORM(WIN_CAIRO)
+#elif PLATFORM(GTK) || PLATFORM(WIN_CAIRO) || PLATFORM(WPE)
 typedef unsigned int GLuint;
 #endif
 
@@ -1373,7 +1373,7 @@ private:
 
     std::unique_ptr<ShaderNameHash> nameHashMapForShaders;
 
-#if ((PLATFORM(GTK) || PLATFORM(WIN)) && USE(OPENGL_ES_2))
+#if ((PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(WPE)) && USE(OPENGL_ES_2))
     friend class Extensions3DOpenGLES;
     std::unique_ptr<Extensions3DOpenGLES> m_extensions;
 #else
index b4e9515..ab7c6b8 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef OpenGLESShims_h
 #define OpenGLESShims_h
 
-#if PLATFORM(GTK) || PLATFORM(WIN)
+#if PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(WPE)
 #define glBindFramebufferEXT glBindFramebuffer
 #define glFramebufferTexture2DEXT glFramebufferTexture2D
 #define glBindRenderbufferEXT glBindRenderbuffer
@@ -45,6 +45,7 @@
 #define glIsFramebufferEXT glIsFramebuffer
 #define glGenerateMipmapEXT glGenerateMipmap
 #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT
+#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
 #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
 #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER
 #define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8_OES
index 67efbce..1b71954 100644 (file)
 #include "PlatformDisplayWin.h"
 #endif
 
+#if PLATFORM(WPE)
+#include "PlatformDisplayWPE.h"
+#endif
+
 #if PLATFORM(GTK)
 #include <gdk/gdk.h>
 #endif
@@ -100,6 +104,10 @@ std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
     return std::make_unique<PlatformDisplayX11>(nullptr);
 #endif
 
+#if PLATFORM(WPE)
+    return std::make_unique<PlatformDisplayWPE>();
+#endif
+
     ASSERT_NOT_REACHED();
     return nullptr;
 }
index f764c2d..cb5fa1e 100644 (file)
@@ -54,6 +54,9 @@ public:
 #if PLATFORM(WIN)
         Windows,
 #endif
+#if PLATFORM(WPE)
+        WPE,
+#endif
     };
 
     virtual Type type() const = 0;
index 1c1cec2..9fe755f 100644 (file)
@@ -204,6 +204,13 @@ std::unique_ptr<GLContextEGL> GLContextEGL::createSharingContext(PlatformDisplay
     if (eglBindAPI(gEGLAPIVersion) == EGL_FALSE)
         return nullptr;
 
+#if PLATFORM(WPE)
+    if (platformDisplay.type() == PlatformDisplay::Type::WPE) {
+        if (auto context = createWPEContext(platformDisplay))
+            return context;
+    }
+#endif
+
     auto context = createSurfacelessContext(platformDisplay);
     if (!context) {
 #if PLATFORM(X11)
@@ -251,6 +258,9 @@ GLContextEGL::~GLContextEGL()
 #if PLATFORM(WAYLAND)
     destroyWaylandWindow();
 #endif
+#if PLATFORM(WPE)
+    destroyWPETarget();
+#endif
 }
 
 bool GLContextEGL::canRenderToDefaultFramebuffer()
index e5a3359..9a033fe 100644 (file)
 struct wl_egl_window;
 #endif
 
+#if PLATFORM(WPE)
+#include "PlatformDisplayWPE.h"
+#endif
+
 typedef void *EGLConfig;
 typedef void *EGLContext;
 typedef void *EGLDisplay;
@@ -73,6 +77,9 @@ private:
     GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, WlUniquePtr<struct wl_surface>&&, struct wl_egl_window*);
     void destroyWaylandWindow();
 #endif
+#if PLATFORM(WPE)
+    void destroyWPETarget();
+#endif
 
     static std::unique_ptr<GLContextEGL> createWindowContext(GLNativeWindowType, PlatformDisplay&, EGLContext sharingContext = nullptr);
     static std::unique_ptr<GLContextEGL> createPbufferContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
@@ -85,6 +92,9 @@ private:
     static std::unique_ptr<GLContextEGL> createWaylandContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
     static EGLSurface createWindowSurfaceWayland(EGLDisplay, EGLConfig, GLNativeWindowType);
 #endif
+#if PLATFORM(WPE)
+    static std::unique_ptr<GLContextEGL> createWPEContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
+#endif
 
     static bool getEGLConfig(EGLDisplay, EGLConfig*, EGLSurfaceType);
 
@@ -98,6 +108,9 @@ private:
     WlUniquePtr<struct wl_surface> m_wlSurface;
     struct wl_egl_window* m_wlWindow { nullptr };
 #endif
+#if PLATFORM(WPE)
+    std::unique_ptr<PlatformDisplayWPE::EGLOffscreenTarget> m_wpeTarget;
+#endif
 #if USE(CAIRO)
     cairo_device_t* m_cairoDevice { nullptr };
 #endif
diff --git a/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp b/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp
new file mode 100644 (file)
index 0000000..9f3f42d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Igalia, S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "GLContextEGL.h"
+
+#if USE(EGL) && PLATFORM(WPE)
+
+#include "PlatformDisplayWPE.h"
+
+namespace WebCore {
+
+std::unique_ptr<GLContextEGL> GLContextEGL::createWPEContext(PlatformDisplay& platformDisplay, EGLContext sharingContext)
+{
+    auto offscreenTarget = downcast<PlatformDisplayWPE>(platformDisplay).createEGLOffscreenTarget();
+    auto context = createWindowContext(offscreenTarget->nativeWindow(), platformDisplay, sharingContext);
+    if (context)
+        context->m_wpeTarget = WTFMove(offscreenTarget);
+    return context;
+}
+
+void GLContextEGL::destroyWPETarget()
+{
+    m_wpeTarget = nullptr;
+}
+
+} // namespace WebCore
+
+#endif // USE(EGL) && PLATFORM(WPE)
index cda0534..ca4f090 100644 (file)
@@ -59,7 +59,9 @@
 #endif
 
 #if USE(EGL)
+#if !PLATFORM(WPE)
 #include "GLContextEGL.h"
+#endif
 #include <gst/gl/egl/gstgldisplay_egl.h>
 #endif
 
@@ -69,6 +71,8 @@
 
 #if PLATFORM(WAYLAND)
 #include "PlatformDisplayWayland.h"
+#elif PLATFORM(WPE)
+#include "PlatformDisplayWPE.h"
 #endif
 
 // gstglapi.h may include eglplatform.h and it includes X.h, which
@@ -438,6 +442,11 @@ bool MediaPlayerPrivateGStreamerBase::ensureGstGLContext()
             m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayWayland>(sharedDisplay).eglDisplay()));
 #endif
 
+#if PLATFORM(WPE)
+        ASSERT(is<PlatformDisplayWPE>(sharedDisplay));
+        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayWPE>(sharedDisplay).eglDisplay()));
+#endif
+
         ASSERT(m_glDisplay);
     }
 
index c7a0ec7..aade175 100644 (file)
@@ -398,7 +398,7 @@ bool GraphicsContext3D::checkVaryingsPacking(Platform3DObject vertexShader, Plat
         variables.push_back(varyingSymbol);
 
     GC3Dint maxVaryingVectors = 0;
-#if !PLATFORM(IOS) && !((PLATFORM(WIN) || PLATFORM(GTK)) && USE(OPENGL_ES_2))
+#if !PLATFORM(IOS) && !((PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(WPE)) && USE(OPENGL_ES_2))
     GC3Dint maxVaryingFloats = 0;
     ::glGetIntegerv(GL_MAX_VARYING_FLOATS, &maxVaryingFloats);
     maxVaryingVectors = maxVaryingFloats / 4;
diff --git a/Source/WebCore/platform/graphics/wpe/IconWPE.cpp b/Source/WebCore/platform/graphics/wpe/IconWPE.cpp
new file mode 100644 (file)
index 0000000..d3c37bd
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "Icon.h"
+
+namespace WebCore {
+
+Icon::~Icon()
+{
+}
+
+void Icon::paint(GraphicsContext&, const FloatRect&)
+{
+}
+
+RefPtr<Icon> Icon::createIconForFiles(const Vector<String>&)
+{
+    return nullptr;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/wpe/ImageWPE.cpp b/Source/WebCore/platform/graphics/wpe/ImageWPE.cpp
new file mode 100644 (file)
index 0000000..4843868
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "BitmapImage.h"
+
+#include <cstdio>
+
+namespace WebCore {
+
+void BitmapImage::invalidatePlatformData()
+{
+}
+
+PassRefPtr<Image> Image::loadPlatformResource(const char* resource)
+{
+    WTFLogAlways("WARNING: trying to load platform resource '%s'", resource);
+    return BitmapImage::create();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp b/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp
new file mode 100644 (file)
index 0000000..fda8bbc
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "PlatformDisplayWPE.h"
+
+#if PLATFORM(WPE)
+
+#include "GLContextEGL.h"
+#include "IntSize.h"
+#include <EGL/egl.h>
+#include <wpe/renderer-backend-egl.h>
+
+namespace WebCore {
+
+PlatformDisplayWPE::PlatformDisplayWPE() = default;
+
+PlatformDisplayWPE::~PlatformDisplayWPE()
+{
+    wpe_renderer_backend_egl_destroy(m_backend);
+}
+
+void PlatformDisplayWPE::initialize(int hostFd)
+{
+    m_backend = wpe_renderer_backend_egl_create(hostFd);
+
+    m_eglDisplay = eglGetDisplay(wpe_renderer_backend_egl_get_native_display(m_backend));
+    if (m_eglDisplay == EGL_NO_DISPLAY) {
+        WTFLogAlways("PlatformDisplayWPE: could not create the EGL display.");
+        return;
+    }
+
+    PlatformDisplay::initializeEGLDisplay();
+}
+
+std::unique_ptr<PlatformDisplayWPE::EGLTarget> PlatformDisplayWPE::createEGLTarget(EGLTarget::Client& client, int hostFd)
+{
+    return std::make_unique<EGLTarget>(*this, client, hostFd);
+}
+
+std::unique_ptr<PlatformDisplayWPE::EGLOffscreenTarget> PlatformDisplayWPE::createEGLOffscreenTarget()
+{
+    return std::make_unique<EGLOffscreenTarget>(*this);
+}
+
+PlatformDisplayWPE::EGLTarget::EGLTarget(const PlatformDisplayWPE& display, PlatformDisplayWPE::EGLTarget::Client& client, int hostFd)
+    : m_display(display)
+    , m_client(client)
+{
+    m_backend = wpe_renderer_backend_egl_target_create(hostFd);
+
+    static struct wpe_renderer_backend_egl_target_client s_client = {
+        // frame_complete
+        [](void* data)
+        {
+            auto& surface = *reinterpret_cast<EGLTarget*>(data);
+            surface.m_client.frameComplete();
+        },
+    };
+    wpe_renderer_backend_egl_target_set_client(m_backend, &s_client, this);
+}
+
+PlatformDisplayWPE::EGLTarget::~EGLTarget()
+{
+    wpe_renderer_backend_egl_target_destroy(m_backend);
+}
+
+void PlatformDisplayWPE::EGLTarget::initialize(const IntSize& size)
+{
+    wpe_renderer_backend_egl_target_initialize(m_backend, m_display.m_backend,
+        std::max(0, size.width()), std::max(0, size.height()));
+}
+
+EGLNativeWindowType PlatformDisplayWPE::EGLTarget::nativeWindow() const
+{
+    return wpe_renderer_backend_egl_target_get_native_window(m_backend);
+}
+
+void PlatformDisplayWPE::EGLTarget::resize(const IntSize& size)
+{
+    wpe_renderer_backend_egl_target_resize(m_backend, std::max(0, size.width()), std::max(0, size.height()));
+}
+
+void PlatformDisplayWPE::EGLTarget::frameWillRender()
+{
+    wpe_renderer_backend_egl_target_frame_will_render(m_backend);
+}
+
+void PlatformDisplayWPE::EGLTarget::frameRendered()
+{
+    wpe_renderer_backend_egl_target_frame_rendered(m_backend);
+}
+
+PlatformDisplayWPE::EGLOffscreenTarget::EGLOffscreenTarget(const PlatformDisplayWPE& display)
+{
+    m_target = wpe_renderer_backend_egl_offscreen_target_create();
+    wpe_renderer_backend_egl_offscreen_target_initialize(m_target, display.m_backend);
+}
+
+PlatformDisplayWPE::EGLOffscreenTarget::~EGLOffscreenTarget()
+{
+    wpe_renderer_backend_egl_offscreen_target_destroy(m_target);
+}
+
+EGLNativeWindowType PlatformDisplayWPE::EGLOffscreenTarget::nativeWindow() const
+{
+    return wpe_renderer_backend_egl_offscreen_target_get_native_window(m_target);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(WPE)
diff --git a/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.h b/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.h
new file mode 100644 (file)
index 0000000..59b152e
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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
+
+#if PLATFORM(WPE)
+
+#include "PlatformDisplay.h"
+
+// FIXME: For now default to the GBM EGL platform, but this should really be
+// somehow deducible from the build configuration.
+#define __GBM__ 1
+#include <EGL/eglplatform.h>
+
+struct wpe_renderer_backend_egl;
+struct wpe_renderer_backend_egl_target;
+struct wpe_renderer_backend_egl_offscreen_target;
+
+namespace WebCore {
+
+class GLContext;
+class IntSize;
+
+class PlatformDisplayWPE final : public PlatformDisplay {
+public:
+    PlatformDisplayWPE();
+    virtual ~PlatformDisplayWPE();
+
+    void initialize(int);
+
+    class EGLTarget {
+    public:
+        class Client {
+        public:
+            virtual void frameComplete() = 0;
+        };
+
+        EGLTarget(const PlatformDisplayWPE&, Client&, int);
+        ~EGLTarget();
+
+        void initialize(const IntSize&);
+        EGLNativeWindowType nativeWindow() const;
+
+        void resize(const IntSize&);
+
+        void frameWillRender();
+        void frameRendered();
+
+    private:
+        const PlatformDisplayWPE& m_display;
+        Client& m_client;
+        struct wpe_renderer_backend_egl_target* m_backend;
+    };
+
+    class EGLOffscreenTarget {
+    public:
+        EGLOffscreenTarget(const PlatformDisplayWPE&);
+        ~EGLOffscreenTarget();
+
+        EGLNativeWindowType nativeWindow() const;
+
+    private:
+        struct wpe_renderer_backend_egl_offscreen_target* m_target;
+    };
+
+    std::unique_ptr<EGLTarget> createEGLTarget(EGLTarget::Client&, int);
+    std::unique_ptr<EGLOffscreenTarget> createEGLOffscreenTarget();
+
+private:
+    Type type() const override { return PlatformDisplay::Type::WPE; }
+
+    struct wpe_renderer_backend_egl* m_backend;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_PLATFORM_DISPLAY(PlatformDisplayWPE, WPE)
+
+#endif // PLATFORM(WPE)
diff --git a/Source/WebCore/platform/wpe/CursorWPE.cpp b/Source/WebCore/platform/wpe/CursorWPE.cpp
new file mode 100644 (file)
index 0000000..d4dc955
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "Cursor.h"
+
+namespace WebCore {
+
+void Cursor::ensurePlatformCursor() const
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/LocalizedStringsWPE.cpp b/Source/WebCore/platform/wpe/LocalizedStringsWPE.cpp
new file mode 100644 (file)
index 0000000..a760196
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "LocalizedStrings.h"
+
+#include "NotImplemented.h"
+#include <wtf/glib/GUniquePtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+String contextMenuItemTagSearchWeb()
+{
+    return String::fromUTF8("_Search the Web");
+}
+
+String unacceptableTLSCertificate()
+{
+    return String::fromUTF8("Unacceptable TLS certificate");
+}
+
+String localizedString(const char* key)
+{
+    return String::fromUTF8(key, strlen(key));
+}
+
+
+}
diff --git a/Source/WebCore/platform/wpe/PasteboardWPE.cpp b/Source/WebCore/platform/wpe/PasteboardWPE.cpp
new file mode 100644 (file)
index 0000000..2c78008
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2014-2015 Igalia S.L.
+ *
+ * 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 "Pasteboard.h"
+
+#include "NotImplemented.h"
+#include "PasteboardStrategy.h"
+#include "PlatformStrategies.h"
+
+namespace WebCore {
+
+std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
+{
+    return std::make_unique<Pasteboard>();
+}
+
+std::unique_ptr<Pasteboard> Pasteboard::createPrivate()
+{
+    return std::make_unique<Pasteboard>();
+}
+
+Pasteboard::Pasteboard()
+{
+}
+
+bool Pasteboard::hasData()
+{
+    // FIXME: Getting the list of types for this is wasteful. Do this in the UI process.
+    Vector<String> types;
+    platformStrategies()->pasteboardStrategy()->getTypes(types);
+    return !types.isEmpty();
+}
+
+Vector<String> Pasteboard::types()
+{
+    Vector<String> types;
+    platformStrategies()->pasteboardStrategy()->getTypes(types);
+    return types;
+}
+
+String Pasteboard::readString(const String& type)
+{
+    return platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, type);
+}
+
+void Pasteboard::writeString(const String& type, const String& text)
+{
+    platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, text);
+}
+
+void Pasteboard::clear()
+{
+}
+
+void Pasteboard::clear(const String&)
+{
+}
+
+void Pasteboard::read(PasteboardPlainText& text)
+{
+    text.text = platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, "text/plain;charset=utf-8");
+}
+
+void Pasteboard::read(PasteboardWebContentReader&)
+{
+    notImplemented();
+}
+
+void Pasteboard::write(const PasteboardURL& url)
+{
+    platformStrategies()->pasteboardStrategy()->writeToPasteboard("text/plain;charset=utf-8", url.url.string());
+}
+
+void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL&)
+{
+    notImplemented();
+}
+
+void Pasteboard::write(const PasteboardImage&)
+{
+}
+
+void Pasteboard::write(const PasteboardWebContent& content)
+{
+    platformStrategies()->pasteboardStrategy()->writeToPasteboard(content);
+}
+
+Vector<String> Pasteboard::readFilenames()
+{
+    return Vector<String>();
+}
+
+bool Pasteboard::canSmartReplace()
+{
+    return false;
+}
+
+void Pasteboard::writeMarkup(const String&)
+{
+}
+
+void Pasteboard::writePlainText(const String& text, SmartReplaceOption)
+{
+    writeString("text/plain;charset=utf-8", text);
+}
+
+void Pasteboard::writePasteboard(const Pasteboard&)
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/PlatformKeyboardEventWPE.cpp b/Source/WebCore/platform/wpe/PlatformKeyboardEventWPE.cpp
new file mode 100644 (file)
index 0000000..fa4f38e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "PlatformKeyboardEvent.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardsCompatibility)
+{
+    ASSERT(m_type == KeyDown);
+    m_type = type;
+    if (backwardsCompatibility)
+        return;
+
+    if (type == PlatformEvent::RawKeyDown) {
+        m_text = String();
+        m_unmodifiedText = String();
+    } else {
+        m_keyIdentifier = String();
+        m_windowsVirtualKeyCode = 0;
+    }
+}
+
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+    return false;
+}
+
+void PlatformKeyboardEvent::getCurrentModifierState(bool&, bool&, bool&, bool&)
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp b/Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp
new file mode 100644 (file)
index 0000000..e456eee
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "PlatformPasteboard.h"
+
+#include "Pasteboard.h"
+#include <map>
+#include <wpe/pasteboard.h>
+#include <wtf/Assertions.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+PlatformPasteboard::PlatformPasteboard(const String&)
+    : m_pasteboard(wpe_pasteboard_get_singleton())
+{
+    ASSERT(m_pasteboard);
+}
+
+PlatformPasteboard::PlatformPasteboard()
+    : m_pasteboard(wpe_pasteboard_get_singleton())
+{
+    ASSERT(m_pasteboard);
+}
+
+void PlatformPasteboard::getTypes(Vector<String>& types)
+{
+    struct wpe_pasteboard_string_vector pasteboardTypes = { nullptr, 0 };
+    wpe_pasteboard_get_types(m_pasteboard, &pasteboardTypes);
+
+    for (unsigned i = 0; i < pasteboardTypes.length; ++i) {
+        auto& typeString = pasteboardTypes.strings[i];
+        types.append(String(typeString.data, typeString.length));
+    }
+
+    wpe_pasteboard_string_vector_free(&pasteboardTypes);
+}
+
+String PlatformPasteboard::readString(int, const String& type)
+{
+    struct wpe_pasteboard_string string;
+    wpe_pasteboard_get_string(m_pasteboard, type.utf8().data(), &string);
+
+    String returnValue(string.data, string.length);
+
+    wpe_pasteboard_string_free(&string);
+    return returnValue;
+}
+
+void PlatformPasteboard::write(const PasteboardWebContent& content)
+{
+    static const char plainText[] = "text/plain;charset=utf-8";
+    static const char htmlText[] = "text/html;charset=utf-8";
+
+    CString textString = content.text.utf8();
+    CString markupString = content.markup.utf8();
+
+    struct wpe_pasteboard_string_pair pairs[] = {
+        { { nullptr, 0 }, { nullptr, 0 } },
+        { { nullptr, 0 }, { nullptr, 0 } },
+    };
+    wpe_pasteboard_string_initialize(&pairs[0].type, plainText, strlen(plainText));
+    wpe_pasteboard_string_initialize(&pairs[0].string, textString.data(), textString.length());
+    wpe_pasteboard_string_initialize(&pairs[1].type, htmlText, strlen(htmlText));
+    wpe_pasteboard_string_initialize(&pairs[1].string, markupString.data(), markupString.length());
+    struct wpe_pasteboard_string_map map = { pairs, 2 };
+
+    wpe_pasteboard_write(m_pasteboard, &map);
+
+    wpe_pasteboard_string_free(&pairs[0].type);
+    wpe_pasteboard_string_free(&pairs[0].string);
+    wpe_pasteboard_string_free(&pairs[1].type);
+    wpe_pasteboard_string_free(&pairs[1].string);
+}
+
+void PlatformPasteboard::write(const String& type, const String& string)
+{
+    struct wpe_pasteboard_string_pair pairs[] = {
+        { { nullptr, 0 }, { nullptr, 0 } },
+    };
+    wpe_pasteboard_string_initialize(&pairs[0].type, type.utf8().data(), type.utf8().length());
+    wpe_pasteboard_string_initialize(&pairs[0].string, string.utf8().data(), string.utf8().length());
+    struct wpe_pasteboard_string_map map = { pairs, 1 };
+
+    wpe_pasteboard_write(m_pasteboard, &map);
+
+    wpe_pasteboard_string_free(&pairs[0].type);
+    wpe_pasteboard_string_free(&pairs[0].string);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp b/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp
new file mode 100644 (file)
index 0000000..e08eb7d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "PlatformScreen.h"
+
+#include "FloatRect.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+int screenDepth(Widget*)
+{
+    notImplemented();
+    return 24;
+}
+
+int screenDepthPerComponent(Widget*)
+{
+    notImplemented();
+    return 8;
+}
+
+bool screenIsMonochrome(Widget*)
+{
+    notImplemented();
+    return false;
+}
+
+bool screenHasInvertedColors()
+{
+    return false;
+}
+
+FloatRect screenRect(Widget*)
+{
+    notImplemented();
+    return FloatRect(0, 0, 1024, 640);
+}
+
+FloatRect screenAvailableRect(Widget*)
+{
+    notImplemented();
+    return FloatRect(0, 0, 1024, 640);
+}
+
+bool screenSupportsExtendedColor(Widget*)
+{
+    return false;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/RenderThemeWPE.cpp b/Source/WebCore/platform/wpe/RenderThemeWPE.cpp
new file mode 100644 (file)
index 0000000..b59e33b
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "RenderThemeWPE.h"
+
+#include "NotImplemented.h"
+#include "UserAgentScripts.h"
+#include "UserAgentStyleSheets.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+Ref<RenderTheme> RenderTheme::themeForPage(Page*)
+{
+    static RenderTheme& theme = RenderThemeWPE::create().leakRef();
+    return theme;
+}
+
+void RenderThemeWPE::updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const
+{
+    notImplemented();
+}
+
+String RenderThemeWPE::extraDefaultStyleSheet()
+{
+    return String();
+}
+
+#if ENABLE(VIDEO)
+String RenderThemeWPE::mediaControlsStyleSheet()
+{
+    return ASCIILiteral(mediaControlsBaseUserAgentStyleSheet);
+}
+
+String RenderThemeWPE::mediaControlsScript()
+{
+    StringBuilder scriptBuilder;
+    scriptBuilder.append(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript));
+    scriptBuilder.append(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript));
+    return scriptBuilder.toString();
+}
+#endif
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/RenderThemeWPE.h b/Source/WebCore/platform/wpe/RenderThemeWPE.h
new file mode 100644 (file)
index 0000000..efb2fe8
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "RenderTheme.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class RenderThemeWPE final : public RenderTheme {
+public:
+    static Ref<RenderTheme> create()
+    {
+        return adoptRef(*new RenderThemeWPE);
+    }
+
+    String extraDefaultStyleSheet() override;
+#if ENABLE(VIDEO)
+    String mediaControlsStyleSheet() override;
+    String mediaControlsScript() override;
+#endif
+
+private:
+    RenderThemeWPE() = default;
+    virtual ~RenderThemeWPE() = default;
+
+    void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp b/Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp
new file mode 100644 (file)
index 0000000..0f9fe5d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "ScrollbarThemeWPE.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+bool ScrollbarThemeWPE::hasButtons(Scrollbar&)
+{
+    notImplemented();
+    return true;
+}
+
+bool ScrollbarThemeWPE::hasThumb(Scrollbar&)
+{
+    notImplemented();
+    return true;
+}
+
+IntRect ScrollbarThemeWPE::backButtonRect(Scrollbar&, ScrollbarPart, bool)
+{
+    notImplemented();
+    return IntRect();
+}
+
+IntRect ScrollbarThemeWPE::forwardButtonRect(Scrollbar&, ScrollbarPart, bool)
+{
+    notImplemented();
+    return IntRect();
+}
+
+IntRect ScrollbarThemeWPE::trackRect(Scrollbar&, bool)
+{
+    notImplemented();
+    return IntRect();
+}
+
+ScrollbarTheme& ScrollbarTheme::nativeTheme()
+{
+    static ScrollbarThemeWPE theme;
+    return theme;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.h b/Source/WebCore/platform/wpe/ScrollbarThemeWPE.h
new file mode 100644 (file)
index 0000000..67185ad
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "ScrollbarThemeComposite.h"
+
+namespace WebCore {
+
+class ScrollbarThemeWPE final : public ScrollbarThemeComposite {
+public:
+    ScrollbarThemeWPE() = default;
+    virtual ~ScrollbarThemeWPE() = default;
+
+    bool hasButtons(Scrollbar&) override;
+    bool hasThumb(Scrollbar&) override;
+
+    IntRect backButtonRect(Scrollbar&, ScrollbarPart, bool painting = false) override;
+    IntRect forwardButtonRect(Scrollbar&, ScrollbarPart, bool painting = false) override;
+    IntRect trackRect(Scrollbar&, bool painting = false) override;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/SoundWPE.cpp b/Source/WebCore/platform/wpe/SoundWPE.cpp
new file mode 100644 (file)
index 0000000..e91477a
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "Sound.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void systemBeep()
+{
+    notImplemented();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/ThemeWPE.cpp b/Source/WebCore/platform/wpe/ThemeWPE.cpp
new file mode 100644 (file)
index 0000000..d5ad977
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "ThemeWPE.h"
+
+#include "Color.h"
+#include "FloatRoundedRect.h"
+#include "GraphicsContext.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+Theme* platformTheme()
+{
+    static NeverDestroyed<ThemeWPE> theme;
+    return &theme.get();
+}
+
+LengthSize ThemeWPE::controlSize(ControlPart part, const FontCascade& fontCascade, const LengthSize& zoomedSize, float zoomFactor) const
+{
+    if (!zoomedSize.width.isIntrinsicOrAuto() && !zoomedSize.height.isIntrinsicOrAuto())
+        return Theme::controlSize(part, fontCascade, zoomedSize, zoomFactor);
+
+    switch (part) {
+    case CheckboxPart:
+    case RadioPart:
+        return LengthSize { Length(12, Fixed), Length(12, Fixed) };
+    default:
+        break;
+    }
+
+    return Theme::controlSize(part, fontCascade, zoomedSize, zoomFactor);
+}
+
+void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float)
+{
+    switch (part) {
+    case CheckboxPart:
+        paintCheckbox(states, context, zoomedRect, zoomFactor);
+        break;
+    case RadioPart:
+        paintRadio(states, context, zoomedRect, zoomFactor);
+        break;
+    case PushButtonPart:
+        paintButton(states, context, zoomedRect, zoomFactor);
+        break;
+    default:
+        break;
+    }
+}
+
+void ThemeWPE::paintCheckbox(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float)
+{
+    GraphicsContextStateSaver stateSaver(context);
+
+    FloatSize corner(2, 2);
+    FloatRoundedRect roundedRect(zoomedRect, corner, corner, corner, corner);
+    Path path;
+    path.addRoundedRect(roundedRect);
+
+    context.setFillColor(makeRGB(224, 224, 224));
+    context.fillPath(path);
+
+    context.setStrokeThickness(1);
+    context.setStrokeColor(makeRGB(94, 94, 94));
+    context.strokePath(path);
+
+    if (states.states() & ControlStates::CheckedState) {
+        auto& rect = roundedRect.rect();
+
+        Path checkerPath;
+        checkerPath.moveTo(FloatPoint(rect.x() + 3, rect.maxY() - 3));
+        checkerPath.addLineTo(FloatPoint(rect.maxX() - 3, rect.y() + 3));
+
+        context.setStrokeThickness(2);
+        context.setStrokeColor(makeRGB(84, 84, 84));
+        context.strokePath(checkerPath);
+    }
+}
+
+void ThemeWPE::paintRadio(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float)
+{
+    GraphicsContextStateSaver stateSaver(context);
+
+    Path path;
+    path.addEllipse(zoomedRect);
+
+    context.setFillColor(makeRGB(224, 224, 224));
+    context.fillPath(path);
+
+    context.setStrokeThickness(1);
+    context.setStrokeColor(makeRGB(94, 94, 94));
+    context.strokePath(path);
+
+    if (states.states() & ControlStates::CheckedState) {
+        FloatRect checkerRect = zoomedRect;
+        checkerRect.inflate(-3);
+
+        Path checkerPath;
+        checkerPath.addEllipse(checkerRect);
+
+        context.setFillColor(makeRGB(84, 84, 84));
+        context.fillPath(checkerPath);
+    }
+}
+
+void ThemeWPE::paintButton(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float)
+{
+    GraphicsContextStateSaver stateSaver(context);
+
+    FloatSize corner(2, 2);
+    FloatRoundedRect roundedRect(zoomedRect, corner, corner, corner, corner);
+    Path path;
+    path.addRoundedRect(roundedRect);
+
+    Color fillColor = states.states() & ControlStates::PressedState ? makeRGB(244, 244, 244) : makeRGB(224, 224, 224);
+    context.setFillColor(fillColor);
+    context.fillPath(path);
+
+    context.setStrokeThickness(1);
+    context.setStrokeColor(makeRGB(94, 94, 94));
+    context.strokePath(path);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/ThemeWPE.h b/Source/WebCore/platform/wpe/ThemeWPE.h
new file mode 100644 (file)
index 0000000..739f5c1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "Theme.h"
+
+namespace WebCore {
+
+class ThemeWPE : public Theme {
+public:
+    ThemeWPE() { }
+    virtual ~ThemeWPE() { }
+
+    LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const override;
+
+    void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float) override;
+
+private:
+    void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, float);
+    void paintRadio(ControlStates&, GraphicsContext&, const FloatRect&, float);
+    void paintButton(ControlStates&, GraphicsContext&, const FloatRect&, float);
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wpe/WidgetWPE.cpp b/Source/WebCore/platform/wpe/WidgetWPE.cpp
new file mode 100644 (file)
index 0000000..62df0cc
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "Widget.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+Widget::Widget(PlatformWidget widget)
+{
+    init(widget);
+}
+
+Widget::~Widget()
+{
+    ASSERT(!parent());
+    notImplemented();
+}
+
+void Widget::setFrameRect(const IntRect& rect)
+{
+    m_frame = rect;
+    notImplemented();
+}
+
+IntRect Widget::frameRect() const
+{
+    return m_frame;
+}
+
+void Widget::paint(GraphicsContext&, const IntRect&)
+{
+    notImplemented();
+}
+
+void Widget::setFocus(bool)
+{
+    notImplemented();
+}
+
+void Widget::setCursor(const Cursor&)
+{
+    notImplemented();
+}
+
+void Widget::show()
+{
+    notImplemented();
+}
+
+void Widget::hide()
+{
+    notImplemented();
+}
+
+void Widget::setIsSelected(bool)
+{
+    notImplemented();
+}
+
+} // namespace WebCore
index 2952496..0fb1245 100644 (file)
@@ -1,3 +1,95 @@
+2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
+
+        Upstream the WPE port
+        https://bugs.webkit.org/show_bug.cgi?id=171110
+
+        Reviewed by Alex Christensen.
+
+        webkit-dev thread:
+        https://lists.webkit.org/pipermail/webkit-dev/2017-April/028923.html
+
+        Existing files changed to properly use PLATFORM(WPE) build guards or other
+        WPE-specific additions (e.g. pasteboard support).
+        In-file changes removed from this ChangeLog entry for brevity.
+
+        * Platform/IPC/glib/GSocketMonitor.cpp:
+        * PlatformWPE.cmake: Added.
+        * Scripts/generate-forwarding-headers.pl:
+        * Shared/API/c/WKBase.h:
+        * Shared/API/c/wpe/WKBaseWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * Shared/API/c/wpe/WebKit.h: Added.
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * Shared/DrawingAreaInfo.h:
+        * Shared/NativeWebKeyboardEvent.h:
+        * Shared/NativeWebMouseEvent.h:
+        * Shared/NativeWebTouchEvent.h:
+        * Shared/NativeWebWheelEvent.h:
+        * Shared/WebCoreArgumentCoders.cpp:
+        * Shared/WebCoreArgumentCoders.h:
+        * Shared/WebPreferencesDefinitions.h:
+        * Shared/wpe/NativeWebKeyboardEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * Shared/wpe/NativeWebMouseEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * Shared/wpe/NativeWebTouchEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * Shared/wpe/NativeWebWheelEventWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * Shared/wpe/ProcessExecutablePathWPE.cpp: Added.
+        * Shared/wpe/WebEventFactory.cpp: Added.
+        * Shared/wpe/WebEventFactory.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/wpe/WKAPICastWPE.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/C/wpe/WKView.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/C/wpe/WKView.h: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
+        * UIProcess/API/wpe/CompositingManagerProxy.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/wpe/CompositingManagerProxy.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/wpe/CompositingManagerProxy.messages.in: Added.
+        * UIProcess/API/wpe/DrawingAreaProxyWPE.cpp: Added.
+        * UIProcess/API/wpe/DrawingAreaProxyWPE.h: Copied from Source/WebKit2/Shared/NativeWebWheelEvent.h.
+        * UIProcess/API/wpe/PageClientImpl.cpp: Added.
+        * UIProcess/API/wpe/PageClientImpl.h: Added.
+        * UIProcess/API/wpe/ScrollGestureController.cpp: Added.
+        * UIProcess/API/wpe/ScrollGestureController.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/wpe/WPEView.cpp: Added.
+        * UIProcess/API/wpe/WPEView.h: Added.
+        * UIProcess/API/wpe/WPEViewClient.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/wpe/WPEViewClient.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Added.
+        * UIProcess/ChildProcessProxy.cpp:
+        * UIProcess/Launcher/ProcessLauncher.h:
+        * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp: Added.
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/WebPasteboardProxy.h:
+        * UIProcess/WebPasteboardProxy.messages.in:
+        * UIProcess/WebProcessPool.cpp:
+        * UIProcess/wpe/TextCheckerWPE.cpp: Added.
+        * UIProcess/wpe/WebInspectorProxyWPE.cpp: Added.
+        * UIProcess/wpe/WebPageProxyWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/wpe/WebPasteboardProxyWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * UIProcess/wpe/WebPreferencesWPE.cpp: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
+        * UIProcess/wpe/WebProcessPoolWPE.cpp: Added.
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebKit2Prefix.h:
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+        * WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: Added.
+        * WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        * WebProcess/WebPage/DrawingArea.cpp:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/wpe/CompositingManager.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebPage/wpe/CompositingManager.h: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebPage/wpe/DrawingAreaWPE.cpp: Added.
+        * WebProcess/WebPage/wpe/DrawingAreaWPE.h: Added.
+        * WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebPage/wpe/WebInspectorWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * WebProcess/WebPage/wpe/WebPageWPE.cpp: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
+        * WebProcess/wpe/WebProcessMainWPE.cpp: Copied from Source/WebKit2/Shared/DrawingAreaInfo.h.
+        * wpe/wpe-webkit.pc.in: Added.
+
 2017-05-09  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Building Webkit2Gtk without OpenGL fails.
index 14329b9..8d101cf 100644 (file)
@@ -51,6 +51,9 @@ void GSocketMonitor::start(GSocket* socket, GIOCondition condition, RunLoop& run
     g_source_set_name(m_source.get(), "[WebKit] Socket monitor");
     m_callback = WTFMove(callback);
     g_source_set_callback(m_source.get(), reinterpret_cast<GSourceFunc>(socketSourceCallback), this, nullptr);
+#if PLATFORM(WPE)
+    g_source_set_priority(m_source.get(), G_PRIORITY_HIGH + 30);
+#endif
     g_source_attach(m_source.get(), runLoop.mainContext());
 }
 
diff --git a/Source/WebKit2/PlatformWPE.cmake b/Source/WebKit2/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..4974329
--- /dev/null
@@ -0,0 +1,471 @@
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKIT2_DIR})
+
+configure_file(wpe/wpe-webkit.pc.in ${CMAKE_BINARY_DIR}/wpe-webkit.pc @ONLY)
+
+add_definitions(-DWEBKIT2_COMPILATION)
+
+add_definitions(-DLIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
+
+set(WebKit2_USE_PREFIX_HEADER ON)
+
+add_custom_target(webkit2wpe-forwarding-headers
+    COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl --include-path ${WEBKIT2_DIR} --output ${FORWARDING_HEADERS_DIR} --platform wpe --platform soup
+)
+
+set(WEBKIT2_EXTRA_DEPENDENCIES
+    webkit2wpe-forwarding-headers
+)
+
+list(APPEND WebProcess_SOURCES
+    WebProcess/EntryPoint/unix/WebProcessMain.cpp
+)
+
+list(APPEND NetworkProcess_SOURCES
+    NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
+)
+
+list(APPEND DatabaseProcess_SOURCES
+    DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp
+)
+
+list(APPEND WebKit2_SOURCES
+    NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
+
+    NetworkProcess/cache/NetworkCacheCodersSoup.cpp
+    NetworkProcess/cache/NetworkCacheDataSoup.cpp
+    NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
+
+    NetworkProcess/soup/NetworkDataTaskSoup.cpp
+    NetworkProcess/soup/NetworkProcessMainSoup.cpp
+    NetworkProcess/soup/NetworkProcessSoup.cpp
+    NetworkProcess/soup/NetworkSessionSoup.cpp
+    NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
+
+    Platform/IPC/glib/GSocketMonitor.cpp
+
+    Platform/IPC/unix/AttachmentUnix.cpp
+    Platform/IPC/unix/ConnectionUnix.cpp
+
+    Platform/classifier/ResourceLoadStatisticsClassifier.cpp
+
+    Platform/glib/ModuleGlib.cpp
+
+    Platform/unix/LoggingUnix.cpp
+    Platform/unix/SharedMemoryUnix.cpp
+
+    PluginProcess/unix/PluginControllerProxyUnix.cpp
+    PluginProcess/unix/PluginProcessMainUnix.cpp
+    PluginProcess/unix/PluginProcessUnix.cpp
+
+    Shared/API/c/cairo/WKImageCairo.cpp
+
+    Shared/Authentication/soup/AuthenticationManagerSoup.cpp
+
+    Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp
+    Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
+    Shared/CoordinatedGraphics/SimpleViewportController.cpp
+
+    Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
+    Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp
+    Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
+    Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp
+
+    Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+
+    Shared/cairo/ShareableBitmapCairo.cpp
+
+    Shared/glib/WebErrorsGlib.cpp
+
+    Shared/linux/WebMemorySamplerLinux.cpp
+
+    Shared/soup/WebCoreArgumentCodersSoup.cpp
+    Shared/soup/WebErrorsSoup.cpp
+
+    Shared/unix/ChildProcessMain.cpp
+
+    Shared/wpe/NativeWebKeyboardEventWPE.cpp
+    Shared/wpe/NativeWebMouseEventWPE.cpp
+    Shared/wpe/NativeWebTouchEventWPE.cpp
+    Shared/wpe/NativeWebWheelEventWPE.cpp
+    Shared/wpe/ProcessExecutablePathWPE.cpp
+    Shared/wpe/WebEventFactory.cpp
+
+    UIProcess/BackingStore.cpp
+    UIProcess/DefaultUndoController.cpp
+    UIProcess/LegacySessionStateCodingNone.cpp
+    UIProcess/WebResourceLoadStatisticsManager.cpp
+    UIProcess/WebResourceLoadStatisticsStore.cpp
+
+    UIProcess/API/C/WKResourceLoadStatisticsManager.cpp
+
+    UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp
+
+    UIProcess/API/C/soup/WKCookieManagerSoup.cpp
+
+    UIProcess/API/C/wpe/WKView.cpp
+
+    UIProcess/API/wpe/CompositingManagerProxy.cpp
+    UIProcess/API/wpe/DrawingAreaProxyWPE.cpp
+    UIProcess/API/wpe/PageClientImpl.cpp
+    UIProcess/API/wpe/ScrollGestureController.cpp
+    UIProcess/API/wpe/WPEView.cpp
+    UIProcess/API/wpe/WPEViewClient.cpp
+
+    UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp
+
+    UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp
+
+    UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
+    UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
+
+    UIProcess/Storage/StorageManager.cpp
+
+    UIProcess/WebsiteData/unix/WebsiteDataStoreUnix.cpp
+
+    UIProcess/cairo/BackingStoreCairo.cpp
+
+    UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp
+    UIProcess/gstreamer/WebPageProxyGStreamer.cpp
+
+    UIProcess/linux/MemoryPressureMonitor.cpp
+
+    UIProcess/soup/WebCookieManagerProxySoup.cpp
+    UIProcess/soup/WebProcessPoolSoup.cpp
+
+    UIProcess/wpe/TextCheckerWPE.cpp
+    UIProcess/wpe/WebInspectorProxyWPE.cpp
+    UIProcess/wpe/WebPageProxyWPE.cpp
+    UIProcess/wpe/WebPasteboardProxyWPE.cpp
+    UIProcess/wpe/WebPreferencesWPE.cpp
+    UIProcess/wpe/WebProcessPoolWPE.cpp
+
+    WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
+    WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
+
+    WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp
+
+    WebProcess/MediaCache/WebMediaKeyStorageManager.cpp
+
+    WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
+
+    WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp
+    WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp
+    WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp
+
+    WebProcess/WebPage/AcceleratedSurface.cpp
+
+    WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp
+    WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
+    WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
+    WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
+    WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
+
+    WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp
+
+    WebProcess/WebPage/wpe/CompositingManager.cpp
+    WebProcess/WebPage/wpe/DrawingAreaWPE.cpp
+    WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp
+    WebProcess/WebPage/wpe/WebPageWPE.cpp
+
+    WebProcess/soup/WebKitSoupRequestInputStream.cpp
+    WebProcess/soup/WebProcessSoup.cpp
+
+    WebProcess/wpe/WebProcessMainWPE.cpp
+
+    # FIXME-GWSHARE:
+    DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp
+)
+
+list(APPEND WebKit2_MESSAGES_IN_FILES
+    UIProcess/API/wpe/CompositingManagerProxy.messages.in
+)
+
+list(APPEND WebKit2_DERIVED_SOURCES
+    ${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.c
+)
+
+set(WebKit2Resources
+)
+
+if (ENABLE_WEB_AUDIO)
+    list(APPEND WebKit2Resources
+        "        <file alias=\"audio/Composite\">Composite.wav</file>\n"
+    )
+endif ()
+
+file(WRITE ${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.xml
+    "<?xml version=1.0 encoding=UTF-8?>\n"
+    "<gresources>\n"
+    "    <gresource prefix=\"/org/webkitwpe/resources\">\n"
+    ${WebKit2Resources}
+    "    </gresource>\n"
+    "</gresources>\n"
+)
+
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.c
+    DEPENDS ${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.xml
+    COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebCore/Resources --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebCore/platform/audio/resources --target=${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.c ${DERIVED_SOURCES_WEBKIT2_DIR}/WebKit2ResourcesGResourceBundle.xml
+    VERBATIM
+)
+
+list(APPEND WebKit2_INCLUDE_DIRECTORIES
+    "${FORWARDING_HEADERS_DIR}"
+    "${DERIVED_SOURCES_DIR}"
+    "${WEBCORE_DIR}/platform/graphics/cairo"
+    "${WEBCORE_DIR}/platform/graphics/freetype"
+    "${WEBCORE_DIR}/platform/graphics/opentype"
+    "${WEBCORE_DIR}/platform/graphics/texmap/coordinated"
+    "${WEBCORE_DIR}/platform/network/soup"
+    "${WEBKIT2_DIR}/DatabaseProcess/unix"
+    "${WEBKIT2_DIR}/NetworkProcess/CustomProtocols/soup"
+    "${WEBKIT2_DIR}/NetworkProcess/Downloads/soup"
+    "${WEBKIT2_DIR}/NetworkProcess/soup"
+    "${WEBKIT2_DIR}/NetworkProcess/unix"
+    "${WEBKIT2_DIR}/Platform/IPC/glib"
+    "${WEBKIT2_DIR}/Platform/IPC/unix"
+    "${WEBKIT2_DIR}/Platform/classifier"
+    "${WEBKIT2_DIR}/Shared/API/c/wpe"
+    "${WEBKIT2_DIR}/Shared/CoordinatedGraphics"
+    "${WEBKIT2_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
+    "${WEBKIT2_DIR}/Shared/soup"
+    "${WEBKIT2_DIR}/Shared/unix"
+    "${WEBKIT2_DIR}/Shared/wpe"
+    "${WEBKIT2_DIR}/UIProcess/API/C/cairo"
+    "${WEBKIT2_DIR}/UIProcess/API/C/soup"
+    "${WEBKIT2_DIR}/UIProcess/API/C/wpe"
+    "${WEBKIT2_DIR}/UIProcess/API/wpe"
+    "${WEBKIT2_DIR}/UIProcess/Network/CustomProtocols/soup"
+    "${WEBKIT2_DIR}/UIProcess/linux"
+    "${WEBKIT2_DIR}/UIProcess/soup"
+    "${WEBKIT2_DIR}/WebProcess/soup"
+    "${WEBKIT2_DIR}/WebProcess/unix"
+    "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/soup"
+    "${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics"
+    "${WEBKIT2_DIR}/WebProcess/WebPage/wpe"
+    "${WTF_DIR}/wtf/gtk/"
+    "${WTF_DIR}/wtf/gobject"
+    "${WTF_DIR}"
+    ${CAIRO_INCLUDE_DIRS}
+    ${EGL_INCLUDE_DIRS}
+    ${FREETYPE2_INCLUDE_DIRS}
+    ${GLIB_INCLUDE_DIRS}
+    ${GSTREAMER_INCLUDE_DIRS}
+    ${HARFBUZZ_INCLUDE_DIRS}
+    ${LIBSOUP_INCLUDE_DIRS}
+    ${WPE_INCLUDE_DIRS}
+)
+
+list(APPEND WebKit2_LIBRARIES
+    WebCorePlatformWPE
+    ${CAIRO_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
+    ${GLIB_LIBRARIES}
+    ${GSTREAMER_LIBRARIES}
+    ${HARFBUZZ_LIBRARIES}
+    ${LIBSOUP_LIBRARIES}
+    ${WPE_LIBRARIES}
+)
+
+set(InspectorFiles
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/*.html
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Base/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.css
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.css
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/ESLint/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/Esprima/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.png
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.svg
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Proxies/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Test/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/Formatter/*.js
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/*.js
+)
+
+file(GLOB InspectorFilesDependencies
+    ${InspectorFiles}
+)
+
+# DerivedSources/JavaScriptCore/inspector/InspectorBackendCommands.js is
+# expected in DerivedSources/WebInspectorUI/UserInterface/Protocol/.
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+    DEPENDS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
+    COMMAND cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+)
+
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
+    DEPENDS ${InspectorFilesDependencies}
+            ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+            ${TOOLS_DIR}/wpe/generate-inspector-gresource-manifest.py
+    COMMAND ${TOOLS_DIR}/wpe/generate-inspector-gresource-manifest.py --output=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml ${InspectorFiles} ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+    VERBATIM
+)
+
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
+    DEPENDS ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
+    COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI --sourcedir=${DERIVED_SOURCES_WEBINSPECTORUI_DIR} --target=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
+    VERBATIM
+)
+
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/WebKit2InspectorGResourceBundle.c
+    DEPENDS ${WEBKIT2_DIR}/UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml
+            ${WEBKIT2_DIR}/UIProcess/InspectorServer/front-end/inspectorPageIndex.html
+    COMMAND glib-compile-resources --generate --sourcedir=${WEBKIT2_DIR}/UIProcess/InspectorServer/front-end --target=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/WebKit2InspectorGResourceBundle.c ${WEBKIT2_DIR}/UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml
+    VERBATIM
+)
+
+list(APPEND WPEWebInspectorResources_DERIVED_SOURCES
+    ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
+    ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/WebKit2InspectorGResourceBundle.c
+)
+
+list(APPEND WPEWebInspectorResources_LIBRARIES
+    ${GLIB_GIO_LIBRARIES}
+)
+
+list(APPEND WPEWebInspectorResources_INCLUDE_DIRECTORIES
+    ${GLIB_INCLUDE_DIRS}
+)
+
+add_library(WPEWebInspectorResources SHARED ${WPEWebInspectorResources_DERIVED_SOURCES})
+add_dependencies(WPEWebInspectorResources WebKit2)
+target_link_libraries(WPEWebInspectorResources ${WPEWebInspectorResources_LIBRARIES})
+target_include_directories(WPEWebInspectorResources PUBLIC ${WPEWebInspectorResources_INCLUDE_DIRECTORIES})
+install(TARGETS WPEWebInspectorResources DESTINATION "${LIB_INSTALL_DIR}")
+
+if (EXPORT_DEPRECATED_WEBKIT2_C_API)
+    set(WPE_INSTALLED_WEBKIT_HEADERS
+        ${WEBKIT2_DIR}/Shared/API/c/WKArray.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKBase.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKData.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKDeclarationSpecifiers.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKDiagnosticLoggingResultType.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKDictionary.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKErrorRef.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKEvent.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKFindOptions.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKGeometry.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKImage.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKMutableArray.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKMutableDictionary.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKNumber.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKPageLoadTypes.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKPageVisibilityTypes.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKSecurityOriginRef.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKSerializedScriptValue.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKString.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKType.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKURL.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKURLRequest.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKURLResponse.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKUserContentInjectedFrames.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKUserContentURLPattern.h
+        ${WEBKIT2_DIR}/Shared/API/c/WKUserScriptInjectionTime.h
+
+        ${WEBKIT2_DIR}/Shared/API/c/wpe/WKBaseWPE.h
+
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundle.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleInspector.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageFullScreenClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePagePolicyClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageResourceLoadClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h
+
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKBackForwardListItemRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKBackForwardListRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContextConfigurationRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContextConnectionClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContextDownloadClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContextHistoryClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContextInjectedBundleClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKContext.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKCookieManager.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKCredential.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKCredentialTypes.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKFrame.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKFrameInfoRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKFramePolicyListener.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKHitTestResult.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKNativeEvent.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKNavigationActionRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKNavigationDataRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKNavigationRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKNavigationResponseRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPage.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageConfigurationRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageContextMenuClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageDiagnosticLoggingClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageFindClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageFindMatchesClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageFormClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageGroup.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageInjectedBundleClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageLoaderClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageNavigationClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPagePolicyClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageRenderingProgressEvents.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPageUIClient.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPluginLoadPolicy.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKPreferencesRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKSessionStateRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKUserContentControllerRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKUserScriptRef.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKViewportAttributes.h
+        ${WEBKIT2_DIR}/UIProcess/API/C/WKWindowFeaturesRef.h
+
+        ${WEBKIT2_DIR}/UIProcess/API/C/wpe/WKView.h
+
+        ${WEBKIT2_DIR}/UIProcess/API/C/soup/WKCookieManagerSoup.h
+    )
+
+    install(FILES ${WPE_INSTALLED_WEBKIT_HEADERS}
+        DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-${WPE_API_VERSION}/WPE/WebKit"
+        COMPONENT "Development"
+    )
+
+    set(WPE_INSTALLED_HEADERS
+        ${WEBKIT2_DIR}/Shared/API/c/wpe/WebKit.h
+    )
+
+    install(FILES ${WPE_INSTALLED_HEADERS}
+        DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-${WPE_API_VERSION}/WPE"
+        COMPONENT "Development"
+    )
+
+    install(FILES ${CMAKE_BINARY_DIR}/wpe-webkit.pc
+        DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+        COMPONENT "Development"
+    )
+endif ()
index b61db78..a7d3a0b 100755 (executable)
@@ -35,7 +35,7 @@ use File::Spec::Functions;
 use Getopt::Long;
 
 my $srcRoot = realpath(File::Spec->catfile(dirname(abs_path($0)), "../.."));
-my @platformPrefixes = ("ca", "cf", "cocoa", "Cocoa", "CoordinatedGraphics", "curl", "efl", "gtk", "ios", "mac", "soup", "win");
+my @platformPrefixes = ("ca", "cf", "cocoa", "Cocoa", "CoordinatedGraphics", "curl", "efl", "gtk", "ios", "mac", "soup", "win", "wpe");
 my @frameworks = ("JavaScriptCore", "WebCore", "WebKit");
 my @skippedPrefixes;
 my @frameworkHeaders;
index 2e8fbfb..33a0698 100644 (file)
 #include <WebKit/WKBaseMac.h>
 #endif
 
+#if defined(BUILDING_WPE__)
+#include <WebKit/WKBaseWPE.h>
+#endif
+
 /* WebKit2 shared types */
 
 typedef uint32_t WKTypeID;
diff --git a/Source/WebKit2/Shared/API/c/wpe/WKBaseWPE.h b/Source/WebKit2/Shared/API/c/wpe/WKBaseWPE.h
new file mode 100644 (file)
index 0000000..b5ef062
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WKBaseWPE_h
+#define WKBaseWPE_h
+
+#ifndef WKBase_h
+#error "Please #include \"WKBase.h\" instead of this file directly."
+#endif
+
+typedef const struct OpaqueWKView* WKViewRef;
+
+#endif /* WKBaseWPE_h */
diff --git a/Source/WebKit2/Shared/API/c/wpe/WebKit.h b/Source/WebKit2/Shared/API/c/wpe/WebKit.h
new file mode 100644 (file)
index 0000000..50ed1ac
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WPE_WebKit_h
+#define WPE_WebKit_h
+
+#define BUILDING_WPE__
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKType.h>
+
+// From Source/WebKit2/Shared/API/c/
+#include <WebKit/WKArray.h>
+#include <WebKit/WKData.h>
+#include <WebKit/WKDeclarationSpecifiers.h>
+#include <WebKit/WKDictionary.h>
+#include <WebKit/WKErrorRef.h>
+#include <WebKit/WKGeometry.h>
+#include <WebKit/WKMutableArray.h>
+#include <WebKit/WKMutableDictionary.h>
+#include <WebKit/WKNumber.h>
+#include <WebKit/WKSecurityOriginRef.h>
+#include <WebKit/WKString.h>
+#include <WebKit/WKURL.h>
+#include <WebKit/WKURLRequest.h>
+#include <WebKit/WKURLResponse.h>
+#include <WebKit/WKUserContentInjectedFrames.h>
+#include <WebKit/WKUserScriptInjectionTime.h>
+
+// From Source/WebKit2/WebProcess/InjectedBundle/API/c/
+#include <WebKit/WKBundle.h>
+#include <WebKit/WKBundleBackForwardList.h>
+#include <WebKit/WKBundleBackForwardListItem.h>
+#include <WebKit/WKBundleFileHandleRef.h>
+#include <WebKit/WKBundleFrame.h>
+#include <WebKit/WKBundleHitTestResult.h>
+#include <WebKit/WKBundleInitialize.h>
+#include <WebKit/WKBundleInspector.h>
+#include <WebKit/WKBundleNavigationAction.h>
+#include <WebKit/WKBundleNodeHandle.h>
+#include <WebKit/WKBundlePage.h>
+#include <WebKit/WKBundlePageBanner.h>
+#include <WebKit/WKBundlePageContextMenuClient.h>
+#include <WebKit/WKBundlePageEditorClient.h>
+#include <WebKit/WKBundlePageFormClient.h>
+#include <WebKit/WKBundlePageFullScreenClient.h>
+#include <WebKit/WKBundlePageGroup.h>
+#include <WebKit/WKBundlePageLoaderClient.h>
+#include <WebKit/WKBundlePageOverlay.h>
+#include <WebKit/WKBundlePagePolicyClient.h>
+#include <WebKit/WKBundlePageResourceLoadClient.h>
+#include <WebKit/WKBundlePageUIClient.h>
+#include <WebKit/WKBundleRangeHandle.h>
+#include <WebKit/WKBundleScriptWorld.h>
+
+// From Source/WebKit2/UIProcess/API/C
+#include <WebKit/WKBackForwardListItemRef.h>
+#include <WebKit/WKBackForwardListRef.h>
+#include <WebKit/WKContext.h>
+#include <WebKit/WKContextConfigurationRef.h>
+#include <WebKit/WKCredential.h>
+#include <WebKit/WKCredentialTypes.h>
+#include <WebKit/WKFrame.h>
+#include <WebKit/WKFrameInfoRef.h>
+#include <WebKit/WKFramePolicyListener.h>
+#include <WebKit/WKHitTestResult.h>
+#include <WebKit/WKNavigationActionRef.h>
+#include <WebKit/WKNavigationDataRef.h>
+#include <WebKit/WKNavigationRef.h>
+#include <WebKit/WKNavigationResponseRef.h>
+#include <WebKit/WKPage.h>
+#include <WebKit/WKPageConfigurationRef.h>
+#include <WebKit/WKPageGroup.h>
+#include <WebKit/WKPreferencesRef.h>
+#include <WebKit/WKSessionStateRef.h>
+#include <WebKit/WKUserContentControllerRef.h>
+#include <WebKit/WKUserScriptRef.h>
+#include <WebKit/WKView.h>
+#include <WebKit/WKViewportAttributes.h>
+#include <WebKit/WKWindowFeaturesRef.h>
+
+#endif // WPE_WebKit_h
index 8acf506..153b645 100644 (file)
@@ -75,11 +75,8 @@ public:
 private:
     WorkQueuePool()
     {
-#if PLATFORM(GTK)
+        // FIXME: This is a sane default limit, but it should be configurable somehow.
         m_threadCountLimit = 1;
-#else
-        m_threadCountLimit = std::numeric_limits<unsigned>::max();
-#endif
     }
 
     WorkQueue& getOrCreateWorkQueueForContext(void* context)
index b820844..4ab57ab 100644 (file)
@@ -44,12 +44,12 @@ using namespace WebCore;
 
 namespace WebKit {
 
-Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
+Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, WebPage& webPage, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
 {
-    return adoptRef(*new ThreadedCompositor(client, viewportSize, scaleFactor, nativeSurfaceHandle, doFrameSync, paintFlags));
+    return adoptRef(*new ThreadedCompositor(client, webPage, viewportSize, scaleFactor, nativeSurfaceHandle, doFrameSync, paintFlags));
 }
 
-ThreadedCompositor::ThreadedCompositor(Client& client, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
+ThreadedCompositor::ThreadedCompositor(Client& client, WebPage& webPage, const IntSize& viewportSize, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
     : m_client(client)
     , m_viewportSize(viewportSize)
     , m_scaleFactor(scaleFactor)
@@ -65,13 +65,21 @@ ThreadedCompositor::ThreadedCompositor(Client& client, const IntSize& viewportSi
     m_clientRendersNextFrame.store(false);
     m_coordinateUpdateCompletionWithClient.store(false);
 
+#if PLATFORM(WPE)
+    m_compositingManager.establishConnection(webPage);
+#endif
+
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         m_scene = adoptRef(new CoordinatedGraphicsScene(this));
+#if PLATFORM(GTK)
         if (m_nativeSurfaceHandle) {
             createGLContext();
             m_scene->setActive(true);
         } else
             m_scene->setActive(false);
+#elif PLATFORM(WPE)
+        m_scene->setActive(true);
+#endif
     });
 }
 
@@ -82,6 +90,8 @@ ThreadedCompositor::~ThreadedCompositor()
 void ThreadedCompositor::createGLContext()
 {
     ASSERT(!isMainThread());
+
+#if PLATFORM(GTK)
     ASSERT(m_nativeSurfaceHandle);
 
     m_context = GLContext::createContextForWindow(reinterpret_cast<GLNativeWindowType>(m_nativeSurfaceHandle), &PlatformDisplay::sharedDisplayForCompositing());
@@ -92,6 +102,22 @@ void ThreadedCompositor::createGLContext()
         if (m_context->makeContextCurrent())
             m_context->swapInterval(0);
     }
+#endif
+
+#if PLATFORM(WPE)
+    auto& platformDisplay = PlatformDisplay::sharedDisplay();
+    RELEASE_ASSERT(is<PlatformDisplayWPE>(platformDisplay));
+    m_target = downcast<PlatformDisplayWPE>(platformDisplay).createEGLTarget(*this, m_compositingManager.releaseConnectionFd());
+    ASSERT(m_target);
+    m_target->initialize(m_viewportSize);
+
+    m_context = GLContext::createContextForWindow(m_target->nativeWindow(), &platformDisplay);
+    if (!m_context)
+        return;
+
+    if (!m_context->makeContextCurrent())
+        return;
+#endif
 }
 
 void ThreadedCompositor::invalidate()
@@ -101,16 +127,23 @@ void ThreadedCompositor::invalidate()
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         m_scene->purgeGLResources();
         m_context = nullptr;
+#if PLATFORM(WPE)
+        m_target = nullptr;
+#endif
         m_scene = nullptr;
     });
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     m_displayRefreshMonitor->invalidate();
 #endif
     m_compositingRunLoop = nullptr;
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+    m_displayRefreshMonitor->invalidate();
+#endif
 }
 
 void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
+#if PLATFORM(GTK)
     m_compositingRunLoop->stopUpdates();
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this), handle] {
         // A new native handle can't be set without destroying the previous one first if any.
@@ -124,6 +157,7 @@ void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
             m_context = nullptr;
         }
     });
+#endif
 }
 
 void ThreadedCompositor::setScaleFactor(float scale)
@@ -147,6 +181,10 @@ void ThreadedCompositor::setViewportSize(const IntSize& viewportSize, float scal
 {
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this), viewportSize, scale] {
         m_viewportSize = viewportSize;
+#if PLATFORM(WPE)
+        if (m_target)
+            m_target->resize(viewportSize);
+#endif
         m_scaleFactor = scale;
         m_needsResize = true;
         m_compositingRunLoop->scheduleUpdate();
@@ -191,9 +229,18 @@ void ThreadedCompositor::renderLayerTree()
     if (!m_scene || !m_scene->isActive())
         return;
 
+#if PLATFORM(WPE)
+    if (!m_context)
+        createGLContext();
+#endif
+
     if (!m_context || !m_context->makeContextCurrent())
         return;
 
+#if PLATFORM(WPE)
+    m_target->frameWillRender();
+#endif
+
     if (m_needsResize) {
         glViewport(0, 0, m_viewportSize.width(), m_viewportSize.height());
         m_needsResize = false;
@@ -213,7 +260,13 @@ void ThreadedCompositor::renderLayerTree()
 
     m_context->swapBuffers();
 
+#if PLATFORM(WPE)
+    m_target->frameRendered();
+#endif
+
+#if PLATFORM(GTK)
     sceneUpdateFinished();
+#endif
 }
 
 void ThreadedCompositor::sceneUpdateFinished()
@@ -280,5 +333,13 @@ void ThreadedCompositor::coordinateUpdateCompletionWithClient()
 }
 #endif
 
+#if PLATFORM(WPE)
+void ThreadedCompositor::frameComplete()
+{
+    ASSERT(m_compositingRunLoop->isCurrent());
+    sceneUpdateFinished();
+}
+#endif
+
 }
 #endif // USE(COORDINATED_GRAPHICS_THREADED)
index c892acb..9a217c6 100644 (file)
 #include <WebCore/DisplayRefreshMonitor.h>
 #endif
 
+#if PLATFORM(WPE)
+#include "CompositingManager.h"
+#include <WebCore/PlatformDisplayWPE.h>
+#endif
+
 namespace WebCore {
 struct CoordinatedGraphicsState;
 }
@@ -51,8 +56,13 @@ namespace WebKit {
 class CoordinatedGraphicsScene;
 class CoordinatedGraphicsSceneClient;
 class ThreadedDisplayRefreshMonitor;
+class WebPage;
 
-class ThreadedCompositor : public CoordinatedGraphicsSceneClient, public ThreadSafeRefCounted<ThreadedCompositor> {
+class ThreadedCompositor : public CoordinatedGraphicsSceneClient, public ThreadSafeRefCounted<ThreadedCompositor>
+#if PLATFORM(WPE)
+    , public WebCore::PlatformDisplayWPE::EGLTarget::Client
+#endif
+    {
     WTF_MAKE_NONCOPYABLE(ThreadedCompositor);
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -64,7 +74,7 @@ public:
 
     enum class ShouldDoFrameSync { No, Yes };
 
-    static Ref<ThreadedCompositor> create(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
+    static Ref<ThreadedCompositor> create(Client&, WebPage&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
     virtual ~ThreadedCompositor();
 
     void setNativeSurfaceHandleForCompositing(uint64_t);
@@ -88,13 +98,18 @@ public:
 #endif
 
 private:
-    ThreadedCompositor(Client&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
+    ThreadedCompositor(Client&, WebPage&, const WebCore::IntSize&, float scaleFactor, uint64_t nativeSurfaceHandle, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
 
     // CoordinatedGraphicsSceneClient
     void renderNextFrame() override;
     void updateViewport() override;
     void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset) override;
 
+#if PLATFORM(WPE)
+    // WebCore::PlatformDisplayWPE::Surface::Client
+    void frameComplete() override;
+#endif
+
     void renderLayerTree();
     void sceneUpdateFinished();
 
@@ -102,6 +117,12 @@ private:
 
     Client& m_client;
     RefPtr<CoordinatedGraphicsScene> m_scene;
+
+#if PLATFORM(WPE)
+    CompositingManager m_compositingManager;
+    std::unique_ptr<WebCore::PlatformDisplayWPE::EGLTarget> m_target;
+#endif
+
     std::unique_ptr<WebCore::GLContext> m_context;
 
     WebCore::IntSize m_viewportSize;
index 7fc4d7c..a435e19 100644 (file)
@@ -34,6 +34,8 @@ enum DrawingAreaType {
     DrawingAreaTypeTiledCoreAnimation,
 #endif
     DrawingAreaTypeRemoteLayerTree,
+#elif PLATFORM(WPE)
+    DrawingAreaTypeWPE
 #else
     DrawingAreaTypeImpl
 #endif
index cb1f118..14fdde2 100644 (file)
@@ -51,6 +51,10 @@ typedef union _GdkEvent GdkEvent;
 OBJC_CLASS WebEvent;
 #endif
 
+#if PLATFORM(WPE)
+struct wpe_input_keyboard_event;
+#endif
+
 namespace WebKit {
 
 class NativeWebKeyboardEvent : public WebKeyboardEvent {
@@ -62,6 +66,8 @@ public:
     NativeWebKeyboardEvent(GdkEvent*, const WebCore::CompositionResults&, InputMethodFilter::EventFakedForComposition, Vector<String>&& commands);
 #elif PLATFORM(IOS)
     NativeWebKeyboardEvent(::WebEvent *);
+#elif PLATFORM(WPE)
+    NativeWebKeyboardEvent(struct wpe_input_keyboard_event*);
 #endif
 
 #if USE(APPKIT)
@@ -72,6 +78,8 @@ public:
     bool isFakeEventForComposition() const { return m_fakeEventForComposition; }
 #elif PLATFORM(IOS)
     ::WebEvent* nativeEvent() const { return m_nativeEvent.get(); }
+#elif PLATFORM(WPE)
+    const void* nativeEvent() const { return nullptr; }
 #endif
 
 private:
index 88cd141..283fc33 100644 (file)
@@ -38,6 +38,10 @@ OBJC_CLASS NSView;
 typedef union _GdkEvent GdkEvent;
 #endif
 
+#if PLATFORM(WPE)
+struct wpe_input_pointer_event;
+#endif
+
 namespace WebKit {
 
 class NativeWebMouseEvent : public WebMouseEvent {
@@ -47,6 +51,8 @@ public:
 #elif PLATFORM(GTK)
     NativeWebMouseEvent(const NativeWebMouseEvent&);
     NativeWebMouseEvent(GdkEvent*, int);
+#elif PLATFORM(WPE)
+    NativeWebMouseEvent(struct wpe_input_pointer_event*, float deviceScaleFactor);
 #endif
 
 #if USE(APPKIT)
@@ -55,6 +61,8 @@ public:
     const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
 #elif PLATFORM(IOS)
     const void* nativeEvent() const { return 0; }
+#elif PLATFORM(WPE)
+    const void* nativeEvent() const { return nullptr; }
 #endif
 
 private:
index 118124c..82f3b24 100644 (file)
@@ -34,6 +34,8 @@
 struct _UIWebTouchEvent;
 #elif PLATFORM(GTK)
 #include <WebCore/GUniquePtrGtk.h>
+#elif PLATFORM(WPE)
+#include <wpe/input.h>
 #endif
 
 namespace WebKit {
@@ -46,6 +48,9 @@ public:
     NativeWebTouchEvent(GdkEvent*, Vector<WebPlatformTouchPoint>&&);
     NativeWebTouchEvent(const NativeWebTouchEvent&);
     const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
+#elif PLATFORM(WPE)
+    NativeWebTouchEvent(struct wpe_input_touch_event*, float deviceScaleFactor);
+    const struct wpe_input_touch_event_raw* nativeFallbackTouchPoint() const { return &m_fallbackTouchPoint; }
 #endif
 
 private:
@@ -55,6 +60,8 @@ private:
 
 #if PLATFORM(GTK)
     GUniquePtr<GdkEvent> m_nativeEvent;
+#elif PLATFORM(WPE)
+    struct wpe_input_touch_event_raw m_fallbackTouchPoint;
 #endif
 };
 
index 5db0bce..15f9586 100644 (file)
@@ -38,6 +38,10 @@ OBJC_CLASS NSView;
 typedef union _GdkEvent GdkEvent;
 #endif
 
+#if PLATFORM(WPE)
+struct wpe_input_axis_event;
+#endif
+
 namespace WebKit {
 
 class NativeWebWheelEvent : public WebWheelEvent {
@@ -47,6 +51,8 @@ public:
 #elif PLATFORM(GTK)
     NativeWebWheelEvent(const NativeWebWheelEvent&);
     NativeWebWheelEvent(GdkEvent*);
+#elif PLATFORM(WPE)
+    NativeWebWheelEvent(struct wpe_input_axis_event*, float deviceScaleFactor);
 #endif
 
 #if USE(APPKIT)
@@ -55,6 +61,8 @@ public:
     GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
 #elif PLATFORM(IOS)
     const void* nativeEvent() const { return 0; }
+#elif PLATFORM(WPE)
+    const void* nativeEvent() const { return nullptr; }
 #endif
 
 private:
index 27b47ab..7af6648 100644 (file)
 #if PLATFORM(IOS)
 #include <WebCore/FloatQuad.h>
 #include <WebCore/InspectorOverlay.h>
-#include <WebCore/Pasteboard.h>
 #include <WebCore/SelectionRect.h>
 #include <WebCore/SharedBuffer.h>
 #endif // PLATFORM(IOS)
 
+#if PLATFORM(IOS) || PLATFORM(WPE)
+#include <WebCore/Pasteboard.h>
+#endif
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #include <WebCore/MediaPlaybackTargetContext.h>
 #endif
@@ -1492,6 +1495,23 @@ bool ArgumentCoder<PasteboardImage>::decode(Decoder& decoder, PasteboardImage& p
 
 #endif
 
+#if PLATFORM(WPE)
+void ArgumentCoder<PasteboardWebContent>::encode(Encoder& encoder, const PasteboardWebContent& content)
+{
+    encoder << content.text;
+    encoder << content.markup;
+}
+
+bool ArgumentCoder<PasteboardWebContent>::decode(Decoder& decoder, PasteboardWebContent& content)
+{
+    if (!decoder.decode(content.text))
+        return false;
+    if (!decoder.decode(content.markup))
+        return false;
+    return true;
+}
+#endif // PLATFORM(WPE)
+
 void ArgumentCoder<DictationAlternative>::encode(Encoder& encoder, const DictationAlternative& dictationAlternative)
 {
     encoder << dictationAlternative.rangeStart;
index 8ec61d3..f70252d 100644 (file)
@@ -135,6 +135,12 @@ struct SoupNetworkProxySettings;
 }
 #endif
 
+#if PLATFORM(WPE)
+namespace WebCore {
+struct PasteboardWebContents;
+}
+#endif
+
 #if ENABLE(CONTENT_FILTERING)
 namespace WebCore {
 class ContentFilterUnblockHandler;
@@ -417,6 +423,13 @@ template<> struct ArgumentCoder<WebCore::SoupNetworkProxySettings> {
 };
 #endif
 
+#if PLATFORM(WPE)
+template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
+    static void encode(Encoder&, const WebCore::PasteboardWebContent&);
+    static bool decode(Decoder&, WebCore::PasteboardWebContent&);
+};
+#endif
+
 template<> struct ArgumentCoder<WebCore::CompositionUnderline> {
     static void encode(Encoder&, const WebCore::CompositionUnderline&);
     static bool decode(Decoder&, WebCore::CompositionUnderline&);
index 263c852..ec0ff6e 100644 (file)
     macro(PictographFontFamily, pictographFontFamily, String, String, "Apple Color Emoji", "", "") \
     \
 
-#elif PLATFORM(GTK)
+#elif PLATFORM(GTK) || PLATFORM(WPE)
 
 #define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
     macro(StandardFontFamily, standardFontFamily, String, String, "Times", "", "") \
diff --git a/Source/WebKit2/Shared/wpe/NativeWebKeyboardEventWPE.cpp b/Source/WebKit2/Shared/wpe/NativeWebKeyboardEventWPE.cpp
new file mode 100644 (file)
index 0000000..8683b81
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "NativeWebKeyboardEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(struct wpe_input_keyboard_event* event)
+    : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event))
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/NativeWebMouseEventWPE.cpp b/Source/WebKit2/Shared/wpe/NativeWebMouseEventWPE.cpp
new file mode 100644 (file)
index 0000000..b4d9d43
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "NativeWebMouseEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebMouseEvent::NativeWebMouseEvent(struct wpe_input_pointer_event* event, float deviceScaleFactor)
+    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, deviceScaleFactor))
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/NativeWebTouchEventWPE.cpp b/Source/WebKit2/Shared/wpe/NativeWebTouchEventWPE.cpp
new file mode 100644 (file)
index 0000000..0cc6658
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "NativeWebTouchEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebTouchEvent::NativeWebTouchEvent(struct wpe_input_touch_event* event, float deviceScaleFactor)
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, deviceScaleFactor))
+    , m_fallbackTouchPoint { wpe_input_touch_event_type_null, 0, 0, 0, 0 }
+{
+    for (unsigned i = 0; i < event->touchpoints_length; ++i) {
+        auto& point = event->touchpoints[i];
+        if (point.type != wpe_input_touch_event_type_null) {
+            m_fallbackTouchPoint = point;
+            break;
+        }
+    }
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/NativeWebWheelEventWPE.cpp b/Source/WebKit2/Shared/wpe/NativeWebWheelEventWPE.cpp
new file mode 100644 (file)
index 0000000..ba962ed
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "NativeWebWheelEvent.h"
+
+#include "WebEventFactory.h"
+
+#include <cstdio>
+
+namespace WebKit {
+
+NativeWebWheelEvent::NativeWebWheelEvent(struct wpe_input_axis_event* event, float deviceScaleFactor)
+    : WebWheelEvent(WebEventFactory::createWebWheelEvent(event, deviceScaleFactor))
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/ProcessExecutablePathWPE.cpp b/Source/WebKit2/Shared/wpe/ProcessExecutablePathWPE.cpp
new file mode 100644 (file)
index 0000000..d87a927
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
+ *
+ * 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 MOTOROLA 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 MOTOROLA 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 "ProcessExecutablePath.h"
+
+#include <WebCore/FileSystem.h>
+#include <glib.h>
+#include <wtf/glib/GLibUtilities.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static String getExecutablePath()
+{
+    CString executablePath = getCurrentExecutablePath();
+    if (!executablePath.isNull())
+        return directoryName(stringFromFileSystemRepresentation(executablePath.data()));
+    return String();
+}
+
+static String findWebKitProcess(const char* processName)
+{
+    static const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
+    if (execDirectory) {
+        String processPath = pathByAppendingComponent(stringFromFileSystemRepresentation(execDirectory), processName);
+        if (fileExists(processPath))
+            return processPath;
+    }
+
+    static String executablePath = getExecutablePath();
+    if (!executablePath.isNull()) {
+        String processPath = pathByAppendingComponent(executablePath, processName);
+        if (fileExists(processPath))
+            return processPath;
+    }
+
+    return pathByAppendingComponent(stringFromFileSystemRepresentation(LIBEXECDIR), processName);
+}
+
+String executablePathOfWebProcess()
+{
+    return findWebKitProcess("WPEWebProcess");
+}
+
+String executablePathOfPluginProcess()
+{
+    return findWebKitProcess("WPEPluginProcess");
+}
+
+String executablePathOfNetworkProcess()
+{
+    return findWebKitProcess("WPENetworkProcess");
+}
+
+#if ENABLE(DATABASE_PROCESS)
+String executablePathOfDatabaseProcess()
+{
+    return findWebKitProcess("WPEDatabaseProcess");
+}
+#endif
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/WebEventFactory.cpp b/Source/WebKit2/Shared/wpe/WebEventFactory.cpp
new file mode 100644 (file)
index 0000000..5571e1a
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebEventFactory.h"
+
+#include <WebCore/Scrollbar.h>
+#include <cstdlib>
+#include <wpe/input.h>
+#include <wtf/glib/GUniquePtr.h>
+
+namespace WebKit {
+
+static WebEvent::Modifiers modifiersForEvent(struct wpe_input_keyboard_event* event)
+{
+    unsigned modifiers = 0;
+    unsigned eventModifiers = event->modifiers;
+
+    if (eventModifiers & wpe_input_keyboard_modifier_control)
+        modifiers |= WebEvent::ControlKey;
+    if (eventModifiers & wpe_input_keyboard_modifier_shift)
+        modifiers |= WebEvent::ShiftKey;
+    if (eventModifiers & wpe_input_keyboard_modifier_alt)
+        modifiers |= WebEvent::AltKey;
+    if (eventModifiers & wpe_input_keyboard_modifier_meta)
+        modifiers |= WebEvent::MetaKey;
+
+    return static_cast<WebEvent::Modifiers>(modifiers);
+}
+
+static String singleCharacterStringForKeyEvent(struct wpe_input_keyboard_event* event)
+{
+    const char* singleCharacter = wpe_input_single_character_for_key_event(wpe_input_key_mapper_get_singleton(), event);
+    if (singleCharacter)
+        return String(singleCharacter);
+
+    glong length;
+    GUniquePtr<gunichar2> uchar16(g_ucs4_to_utf16(&event->unicode, 1, 0, &length, nullptr));
+    if (uchar16)
+        return String(uchar16.get());
+    return String();
+}
+
+static String identifierStringForKeyEvent(struct wpe_input_keyboard_event* event)
+{
+    const char* identifier = wpe_input_identifier_for_key_event(wpe_input_key_mapper_get_singleton(), event);
+    if (identifier)
+        return String(identifier);
+
+    return String::format("U+%04X", event->unicode);
+}
+
+WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(struct wpe_input_keyboard_event* event)
+{
+    String singleCharacterString = singleCharacterStringForKeyEvent(event);
+    String identifierString = identifierStringForKeyEvent(event);
+
+    return WebKeyboardEvent(event->pressed ? WebEvent::KeyDown : WebEvent::KeyUp,
+        singleCharacterString, singleCharacterString, identifierString,
+        wpe_input_windows_key_code_for_key_event(wpe_input_key_mapper_get_singleton(), event),
+        event->keyCode, 0, false, false, false,
+        modifiersForEvent(event), event->time);
+}
+
+WebMouseEvent WebEventFactory::createWebMouseEvent(struct wpe_input_pointer_event* event, float deviceScaleFactor)
+{
+    WebEvent::Type type = WebEvent::NoType;
+    switch (event->type) {
+    case wpe_input_pointer_event_type_motion:
+        type = WebEvent::MouseMove;
+        break;
+    case wpe_input_pointer_event_type_button:
+        type = event->state ? WebEvent::MouseDown : WebEvent::MouseUp;
+        break;
+    case wpe_input_pointer_event_type_null:
+        ASSERT_NOT_REACHED();
+    }
+
+    WebMouseEvent::Button button = WebMouseEvent::NoButton;
+    switch (event->type) {
+    case wpe_input_pointer_event_type_motion:
+    case wpe_input_pointer_event_type_button:
+        if (event->button == 1)
+            button = WebMouseEvent::LeftButton;
+        else if (event->button == 2)
+            button = WebMouseEvent::RightButton;
+        else if (event->button == 3)
+            button = WebMouseEvent::MiddleButton;
+        break;
+    case wpe_input_pointer_event_type_null:
+        ASSERT_NOT_REACHED();
+    }
+
+    unsigned clickCount = (type == WebEvent::MouseDown) ? 1 : 0;
+
+    // FIXME: Proper button support. Modifiers. deltaX/Y/Z. Click count.
+    WebCore::IntPoint position(event->x, event->y);
+    position.scale(1 / deviceScaleFactor);
+    return WebMouseEvent(type, button, position, position,
+        0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), event->time);
+}
+
+WebWheelEvent WebEventFactory::createWebWheelEvent(struct wpe_input_axis_event* event, float deviceScaleFactor)
+{
+    // FIXME: We shouldn't hard-code this.
+    enum Axis {
+        Vertical,
+        Horizontal,
+        Smooth
+    };
+
+    WebCore::FloatSize wheelTicks;
+    WebCore::FloatSize delta;
+    switch (event->axis) {
+    case Vertical:
+        wheelTicks = WebCore::FloatSize(0, event->value / std::abs(event->value));
+        delta = wheelTicks;
+        delta.scale(WebCore::Scrollbar::pixelsPerLineStep());
+        break;
+    case Horizontal:
+        wheelTicks = WebCore::FloatSize(event->value / std::abs(event->value), 0);
+        delta = wheelTicks;
+        delta.scale(WebCore::Scrollbar::pixelsPerLineStep());
+        break;
+    case Smooth:
+        wheelTicks = WebCore::FloatSize(0, event->value / deviceScaleFactor);
+        delta = wheelTicks;
+    default:
+        ASSERT_NOT_REACHED();
+    };
+
+    WebCore::IntPoint position(event->x, event->y);
+    position.scale(1 / deviceScaleFactor);
+    return WebWheelEvent(WebEvent::Wheel, position, position,
+        delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, static_cast<WebEvent::Modifiers>(0), event->time);
+}
+
+static WebKit::WebPlatformTouchPoint::TouchPointState stateForTouchPoint(int mainEventId, const struct wpe_input_touch_event_raw* point)
+{
+    if (point->id != mainEventId)
+        return WebKit::WebPlatformTouchPoint::TouchStationary;
+
+    switch (point->type) {
+    case wpe_input_touch_event_type_down:
+        return WebKit::WebPlatformTouchPoint::TouchPressed;
+    case wpe_input_touch_event_type_motion:
+        return WebKit::WebPlatformTouchPoint::TouchMoved;
+    case wpe_input_touch_event_type_up:
+        return WebKit::WebPlatformTouchPoint::TouchReleased;
+    case wpe_input_touch_event_type_null:
+        ASSERT_NOT_REACHED();
+        break;
+    };
+
+    return WebKit::WebPlatformTouchPoint::TouchStationary;
+}
+
+WebTouchEvent WebEventFactory::createWebTouchEvent(struct wpe_input_touch_event* event, float deviceScaleFactor)
+{
+    WebEvent::Type type = WebEvent::NoType;
+    switch (event->type) {
+    case wpe_input_touch_event_type_down:
+        type = WebEvent::TouchStart;
+        break;
+    case wpe_input_touch_event_type_motion:
+        type = WebEvent::TouchMove;
+        break;
+    case wpe_input_touch_event_type_up:
+        type = WebEvent::TouchEnd;
+        break;
+    case wpe_input_touch_event_type_null:
+        ASSERT_NOT_REACHED();
+    }
+
+    Vector<WebKit::WebPlatformTouchPoint> touchPoints;
+    touchPoints.reserveCapacity(event->touchpoints_length);
+
+    for (unsigned i = 0; i < event->touchpoints_length; ++i) {
+        auto& point = event->touchpoints[i];
+        if (point.type == wpe_input_touch_event_type_null)
+            continue;
+
+        WebCore::IntPoint pointCoordinates(point.x, point.y);
+        pointCoordinates.scale(1 / deviceScaleFactor);
+        touchPoints.uncheckedAppend(
+            WebKit::WebPlatformTouchPoint(point.id, stateForTouchPoint(event->id, &point),
+                pointCoordinates, pointCoordinates));
+    }
+
+    return WebTouchEvent(type, WTFMove(touchPoints), WebEvent::Modifiers(0), event->time);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/wpe/WebEventFactory.h b/Source/WebKit2/Shared/wpe/WebEventFactory.h
new file mode 100644 (file)
index 0000000..a2aa034
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebEvent.h"
+
+struct wpe_input_axis_event;
+struct wpe_input_keyboard_event;
+struct wpe_input_pointer_event;
+struct wpe_input_touch_event;
+
+namespace WebKit {
+
+class WebEventFactory {
+public:
+    static WebKeyboardEvent createWebKeyboardEvent(struct wpe_input_keyboard_event*);
+    static WebMouseEvent createWebMouseEvent(struct wpe_input_pointer_event*, float deviceScaleFactor);
+    static WebWheelEvent createWebWheelEvent(struct wpe_input_axis_event*, float deviceScaleFactor);
+    static WebTouchEvent createWebTouchEvent(struct wpe_input_touch_event*, float deviceScaleFactor);
+};
+
+} // namespace WebKit
index 1b66ab3..9a4fd89 100644 (file)
@@ -575,4 +575,8 @@ inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& gram
 #include "WKAPICastGtk.h"
 #endif
 
+#if defined(BUILDING_WPE__)
+#include "WKAPICastWPE.h"
+#endif
+
 #endif // WKAPICast_h
diff --git a/Source/WebKit2/UIProcess/API/C/wpe/WKAPICastWPE.h b/Source/WebKit2/UIProcess/API/C/wpe/WKAPICastWPE.h
new file mode 100644 (file)
index 0000000..0f8a1e7
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WKAPICastWPE_h
+#define WKAPICastWPE_h
+
+#ifndef WKAPICast_h
+#error "Please #include \"WKAPICast.h\" instead of this file directly."
+#endif
+
+#include "WKView.h"
+#include <WebCore/ActivityState.h>
+
+namespace WKWPE {
+class View;
+}
+
+namespace WebKit {
+
+WK_ADD_API_MAPPING(WKViewRef, WKWPE::View)
+
+inline WebCore::ActivityState::Flags toViewStateFlags(WKViewState wkViewState)
+{
+    unsigned viewStateFlags = 0;
+
+    if (wkViewState & kWKViewStateIsInWindow)
+        viewStateFlags |= WebCore::ActivityState::IsInWindow;
+    if (wkViewState & kWKViewStateIsVisible)
+        viewStateFlags |= WebCore::ActivityState::IsVisible;
+
+    return static_cast<WebCore::ActivityState::Flags>(viewStateFlags);
+}
+
+}
+
+#endif // WKAPICastWPE_h
diff --git a/Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp b/Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp
new file mode 100644 (file)
index 0000000..ccbb237
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "PageClientImpl.h"
+#include "WKAPICast.h"
+#include "WPEView.h"
+
+using namespace WebKit;
+
+WKViewRef WKViewCreate(WKPageConfigurationRef configuration)
+{
+    return toAPI(WKWPE::View::create(nullptr, *toImpl(configuration)));
+}
+
+WKViewRef WKViewCreateWithViewBackend(struct wpe_view_backend* backend, WKPageConfigurationRef configuration)
+{
+    return toAPI(WKWPE::View::create(backend, *toImpl(configuration)));
+}
+
+WKPageRef WKViewGetPage(WKViewRef view)
+{
+    return toAPI(&toImpl(view)->page());
+}
+
+void WKViewSetViewState(WKViewRef view, WKViewState viewState)
+{
+    toImpl(view)->setViewState(toViewStateFlags(viewState));
+}
+
+void WKViewSetViewClient(WKViewRef view, const WKViewClientBase* client)
+{
+    toImpl(view)->initializeClient(client);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/wpe/WKView.h b/Source/WebKit2/UIProcess/API/C/wpe/WKView.h
new file mode 100644 (file)
index 0000000..559ec2b
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WKView_h
+#define WKView_h
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKGeometry.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct wpe_view_backend;
+
+WK_EXPORT WKViewRef WKViewCreate(WKPageConfigurationRef);
+WK_EXPORT WKViewRef WKViewCreateWithViewBackend(struct wpe_view_backend*, WKPageConfigurationRef);
+
+WK_EXPORT WKPageRef WKViewGetPage(WKViewRef);
+
+enum {
+    kWKViewStateIsInWindow = 1 << 0,
+    kWKViewStateIsVisible = 1 << 1,
+};
+typedef uint32_t WKViewState;
+
+WK_EXPORT void WKViewSetViewState(WKViewRef, WKViewState);
+
+typedef void (*WKViewFrameDisplayed)(WKViewRef view, const void* clientInfo);
+
+typedef struct WKViewClientBase {
+    int version;
+    const void* clientInfo;
+} WKViewClientBase;
+
+typedef struct WKViewClientV0 {
+    WKViewClientBase base;
+
+    // version 0
+    WKViewFrameDisplayed frameDisplayed;
+} WKViewClientV0;
+
+WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClientBase*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKView_h
diff --git a/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.cpp b/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.cpp
new file mode 100644 (file)
index 0000000..a404ec5
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "CompositingManagerProxy.h"
+
+#include "Attachment.h"
+#include "CompositingManagerProxyMessages.h"
+#include "WPEView.h"
+#include "WebProcessPool.h"
+#include "WebProcessProxy.h"
+#include <wpe/view-backend.h>
+
+namespace WebKit {
+
+CompositingManagerProxy::CompositingManagerProxy(WKWPE::View& view)
+    : m_view(view)
+{
+}
+
+CompositingManagerProxy::~CompositingManagerProxy() = default;
+
+void CompositingManagerProxy::initialize()
+{
+    m_view.page().process().processPool().addMessageReceiver(Messages::CompositingManagerProxy::messageReceiverName(), m_view.page().pageID(), *this);
+}
+
+void CompositingManagerProxy::establishConnection(IPC::Attachment& connectionHandle)
+{
+    connectionHandle = IPC::Attachment(wpe_view_backend_get_renderer_host_fd(m_view.backend()));
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.h b/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.h
new file mode 100644 (file)
index 0000000..ca35c07
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "MessageReceiver.h"
+#include <wtf/Noncopyable.h>
+
+namespace IPC {
+class Attachment;
+}
+
+namespace WKWPE {
+class View;
+}
+
+namespace WebKit {
+
+class CompositingManagerProxy final : public IPC::MessageReceiver {
+    WTF_MAKE_NONCOPYABLE(CompositingManagerProxy);
+public:
+    CompositingManagerProxy(WKWPE::View&);
+    virtual ~CompositingManagerProxy();
+
+    void initialize();
+
+private:
+    // IPC::MessageReceiver
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override { }
+    void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>& replyEncoder) override;
+
+    void establishConnection(IPC::Attachment&);
+
+    WKWPE::View& m_view;
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.messages.in b/Source/WebKit2/UIProcess/API/wpe/CompositingManagerProxy.messages.in
new file mode 100644 (file)
index 0000000..19a0055
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (C) 2015 Igalia S.L.
+#
+# 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.
+
+messages -> CompositingManagerProxy {
+    EstablishConnection() -> (IPC::Attachment connectionHandle)
+}
diff --git a/Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.cpp b/Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.cpp
new file mode 100644 (file)
index 0000000..373c0f6
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "DrawingAreaProxyWPE.h"
+
+#include "DrawingAreaMessages.h"
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+DrawingAreaProxyWPE::DrawingAreaProxyWPE(WebPageProxy& page)
+    : DrawingAreaProxy(DrawingAreaTypeWPE, page)
+{
+}
+
+DrawingAreaProxyWPE::~DrawingAreaProxyWPE()
+{
+}
+
+void DrawingAreaProxyWPE::deviceScaleFactorDidChange()
+{
+    notImplemented();
+}
+
+void DrawingAreaProxyWPE::sizeDidChange()
+{
+    if (m_webPageProxy.isValid())
+        m_webPageProxy.process().send(Messages::DrawingArea::UpdateBackingStoreState(0, false, m_webPageProxy.deviceScaleFactor(), m_size, m_scrollOffset), m_webPageProxy.pageID());
+}
+
+void DrawingAreaProxyWPE::dispatchAfterEnsuringDrawing(std::function<void(CallbackBase::Error)> callbackFunction)
+{
+    if (!m_webPageProxy.isValid()) {
+        callbackFunction(CallbackBase::Error::OwnerWasInvalidated);
+        return;
+    }
+
+    RunLoop::main().dispatch(
+        [callbackFunction] {
+            callbackFunction(CallbackBase::Error::None);
+        });
+}
+
+void DrawingAreaProxyWPE::update(uint64_t backingStoreStateID, const UpdateInfo&)
+{
+    notImplemented();
+}
+
+void DrawingAreaProxyWPE::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&)
+{
+    notImplemented();
+}
+
+void DrawingAreaProxyWPE::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext)
+{
+    ASSERT(!backingStoreStateID);
+
+    m_layerTreeContext = layerTreeContext;
+    m_webPageProxy.enterAcceleratedCompositingMode(layerTreeContext);
+}
+
+void DrawingAreaProxyWPE::exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&)
+{
+    notImplemented();
+}
+
+void DrawingAreaProxyWPE::updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&)
+{
+    notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.h b/Source/WebKit2/UIProcess/API/wpe/DrawingAreaProxyWPE.h
new file mode 100644 (file)
index 0000000..1f427b4
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "DrawingAreaProxy.h"
+
+#include "LayerTreeContext.h"
+
+namespace WebKit {
+
+class DrawingAreaProxyWPE final : public DrawingAreaProxy {
+public:
+    explicit DrawingAreaProxyWPE(WebPageProxy&);
+    virtual ~DrawingAreaProxyWPE();
+
+private:
+    // DrawingAreaProxy
+    void deviceScaleFactorDidChange() override;
+    void sizeDidChange() override;
+    void dispatchAfterEnsuringDrawing(std::function<void(CallbackBase::Error)>) override;
+
+    // IPC message handlers
+    void update(uint64_t backingStoreStateID, const UpdateInfo&) override;
+    void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) override;
+    void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) override;
+    void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) override;
+    void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) override;
+
+    // The current layer tree context.
+    LayerTreeContext m_layerTreeContext;
+};
+
+}
diff --git a/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp
new file mode 100644 (file)
index 0000000..d165309
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "DrawingAreaProxyWPE.h"
+#include "NativeWebMouseEvent.h"
+#include "NativeWebWheelEvent.h"
+#include "ScrollGestureController.h"
+#include "WPEView.h"
+#include "WebContextMenuProxy.h"
+#include <WebCore/ActivityState.h>
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+PageClientImpl::PageClientImpl(WKWPE::View& view)
+    : m_view(view)
+    , m_scrollGestureController(std::make_unique<ScrollGestureController>())
+{
+}
+
+PageClientImpl::~PageClientImpl() = default;
+
+std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
+{
+    return std::make_unique<DrawingAreaProxyWPE>(m_view.page());
+}
+
+void PageClientImpl::setViewNeedsDisplay(const WebCore::Region&)
+{
+}
+
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
+{
+}
+
+WebCore::FloatPoint PageClientImpl::viewScrollPosition()
+{
+    return { };
+}
+
+WebCore::IntSize PageClientImpl::viewSize()
+{
+    return m_view.size();
+}
+
+bool PageClientImpl::isViewWindowActive()
+{
+    return m_view.viewState() & WebCore::ActivityState::WindowIsActive;
+}
+
+bool PageClientImpl::isViewFocused()
+{
+    return m_view.viewState() & WebCore::ActivityState::IsFocused;
+}
+
+bool PageClientImpl::isViewVisible()
+{
+    return m_view.viewState() & WebCore::ActivityState::IsVisible;
+}
+
+bool PageClientImpl::isViewInWindow()
+{
+    return m_view.viewState() & WebCore::ActivityState::IsInWindow;
+}
+
+void PageClientImpl::processDidExit()
+{
+}
+
+void PageClientImpl::didRelaunchProcess()
+{
+}
+
+void PageClientImpl::pageClosed()
+{
+}
+
+void PageClientImpl::preferencesDidChange()
+{
+}
+
+void PageClientImpl::toolTipChanged(const String&, const String&)
+{
+}
+
+void PageClientImpl::didCommitLoadForMainFrame(const String&, bool)
+{
+}
+
+void PageClientImpl::handleDownloadRequest(DownloadProxy*)
+{
+}
+
+void PageClientImpl::didChangeContentSize(const WebCore::IntSize&)
+{
+}
+
+void PageClientImpl::setCursor(const WebCore::Cursor&)
+{
+}
+
+void PageClientImpl::setCursorHiddenUntilMouseMoves(bool)
+{
+}
+
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
+{
+}
+
+void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo)
+{
+}
+
+void PageClientImpl::clearAllEditCommands()
+{
+}
+
+bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo)
+{
+    return false;
+}
+
+void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo)
+{
+}
+
+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;
+}
+
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
+{
+}
+
+void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& touchEvent, bool wasEventHandled)
+{
+    if (wasEventHandled)
+        return;
+
+    const struct wpe_input_touch_event_raw* touchPoint = touchEvent.nativeFallbackTouchPoint();
+    if (touchPoint->type == wpe_input_touch_event_type_null)
+        return;
+
+    auto& page = m_view.page();
+
+    if (m_scrollGestureController->handleEvent(touchPoint)) {
+        struct wpe_input_axis_event* axisEvent = m_scrollGestureController->axisEvent();
+        if (axisEvent->type != wpe_input_axis_event_type_null)
+            page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor()));
+        return;
+    }
+
+    struct wpe_input_pointer_event pointerEvent {
+        wpe_input_pointer_event_type_null, touchPoint->time,
+        touchPoint->x, touchPoint->y,
+        1, 0
+    };
+
+    switch (touchPoint->type) {
+    case wpe_input_touch_event_type_down:
+        pointerEvent.type = wpe_input_pointer_event_type_button;
+        pointerEvent.state = 1;
+        break;
+    case wpe_input_touch_event_type_motion:
+        pointerEvent.type = wpe_input_pointer_event_type_motion;
+        pointerEvent.state = 1;
+        break;
+    case wpe_input_touch_event_type_up:
+        pointerEvent.type = wpe_input_pointer_event_type_button;
+        pointerEvent.state = 0;
+        break;
+    case wpe_input_pointer_event_type_null:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    page.handleMouseEvent(NativeWebMouseEvent(&pointerEvent, page.deviceScaleFactor()));
+}
+
+void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&)
+{
+}
+
+RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy&)
+{
+    return nullptr;
+}
+
+#if ENABLE(CONTEXT_MENUS)
+std::unique_ptr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&)
+{
+    return nullptr;
+}
+#endif
+
+void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext&)
+{
+}
+
+void PageClientImpl::exitAcceleratedCompositingMode()
+{
+}
+
+void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&)
+{
+}
+
+void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&)
+{
+}
+
+void PageClientImpl::navigationGestureDidBegin()
+{
+}
+
+void PageClientImpl::navigationGestureWillEnd(bool, WebBackForwardListItem&)
+{
+}
+
+void PageClientImpl::navigationGestureDidEnd(bool, 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::refView()
+{
+}
+
+void PageClientImpl::derefView()
+{
+}
+
+#if ENABLE(VIDEO)
+bool PageClientImpl::decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&)
+{
+    return false;
+}
+#endif
+
+void PageClientImpl::didRestoreScrollPosition()
+{
+}
+
+WebCore::UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection()
+{
+    return WebCore::UserInterfaceLayoutDirection::LTR;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.h b/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.h
new file mode 100644 (file)
index 0000000..e79ace1
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 WKWPE {
+class View;
+}
+
+namespace WebKit {
+
+class ScrollGestureController;
+
+class PageClientImpl final : public PageClient {
+public:
+    PageClientImpl(WKWPE::View&);
+    virtual ~PageClientImpl();
+
+private:
+    // PageClient
+    std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
+    void setViewNeedsDisplay(const WebCore::Region&) override;
+    void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) override;
+    WebCore::FloatPoint viewScrollPosition() override;
+    WebCore::IntSize viewSize() override;
+    bool isViewWindowActive() override;
+    bool isViewFocused() override;
+    bool isViewVisible() override;
+    bool isViewInWindow() override;
+
+    void processDidExit() override;
+    void didRelaunchProcess() override;
+    void pageClosed() override;
+    void preferencesDidChange() override;
+    void toolTipChanged(const String&, const String&) override;
+
+    void didCommitLoadForMainFrame(const String&, bool) override;
+    void handleDownloadRequest(DownloadProxy*) override;
+
+    void didChangeContentSize(const WebCore::IntSize&) override;
+
+    void setCursor(const WebCore::Cursor&) override;
+    void setCursorHiddenUntilMouseMoves(bool) override;
+    void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
+
+    void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) override;
+    void clearAllEditCommands() override;
+    bool canUndoRedo(WebPageProxy::UndoOrRedo) override;
+    void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
+
+    WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
+    WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
+    WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
+    WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
+
+    void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) override;
+    void doneWithTouchEvent(const NativeWebTouchEvent&, bool) override;
+    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
+
+    RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
+#if ENABLE(CONTEXT_MENUS)
+    std::unique_ptr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override;
+#endif
+
+    void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
+    void exitAcceleratedCompositingMode() override;
+    void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
+
+    void didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&) override;
+
+    void navigationGestureDidBegin() override;
+    void navigationGestureWillEnd(bool, WebBackForwardListItem&) override;
+    void navigationGestureDidEnd(bool, WebBackForwardListItem&) override;
+    void navigationGestureDidEnd() override;
+    void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
+    void didRemoveNavigationGestureSnapshot() override;
+
+    void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
+    void didFinishLoadForMainFrame() override;
+    void didFailLoadForMainFrame() override;
+    void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
+
+    void didChangeBackgroundColor() override;
+
+    void refView() override;
+    void derefView() override;
+
+#if ENABLE(VIDEO)
+    bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override;
+#endif
+
+    void didRestoreScrollPosition() override;
+
+    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
+
+    void didChangeAvoidsUnsafeArea(bool) override { }
+
+    WKWPE::View& m_view;
+
+    std::unique_ptr<ScrollGestureController> m_scrollGestureController;
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.cpp b/Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.cpp
new file mode 100644 (file)
index 0000000..da12c8e
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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 "ScrollGestureController.h"
+
+#include <WebCore/Scrollbar.h>
+
+namespace WebKit {
+
+bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw* touchPoint)
+{
+    switch (touchPoint->type) {
+    case wpe_input_touch_event_type_down:
+        m_start.time = touchPoint->time;
+        m_start.x = touchPoint->x;
+        m_start.y = touchPoint->y;
+        m_offset.x = touchPoint->x;
+        m_offset.y = touchPoint->y;
+        return false;
+    case wpe_input_touch_event_type_motion:
+        if (!m_handling) {
+            int32_t deltaX = touchPoint->x - m_start.x;
+            int32_t deltaY = touchPoint->y - m_start.y;
+            uint32_t deltaTime = touchPoint->time - m_start.time;
+
+            int pixelsPerLineStep = WebCore::Scrollbar::pixelsPerLineStep();
+            m_handling = std::abs(deltaX) >= pixelsPerLineStep
+                || std::abs(deltaY) >= pixelsPerLineStep
+                || deltaTime >= 200;
+        }
+        if (m_handling) {
+            m_axisEvent = {
+                wpe_input_axis_event_type_motion,
+                touchPoint->time, m_start.x, m_start.y,
+                2, (touchPoint->y - m_offset.y)
+            };
+            m_offset.x = touchPoint->x;
+            m_offset.y = touchPoint->y;
+            return true;
+        }
+        return false;
+    case wpe_input_touch_event_type_up:
+        if (m_handling) {
+            m_handling = false;
+            m_axisEvent = {
+                wpe_input_axis_event_type_null,
+                0, 0, 0, 0, 0
+            };
+            return true;
+        }
+        return false;
+    default:
+        return false;
+    }
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.h b/Source/WebKit2/UIProcess/API/wpe/ScrollGestureController.h
new file mode 100644 (file)
index 0000000..07d1724
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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 <wpe/input.h>
+
+namespace WebKit {
+
+struct ScrollGestureController {
+public:
+    ScrollGestureController() = default;
+
+    struct wpe_input_axis_event* axisEvent() { return &m_axisEvent; }
+
+    bool handleEvent(const struct wpe_input_touch_event_raw*);
+
+private:
+    struct {
+        uint32_t time { 0 };
+        int32_t x { 0 };
+        int32_t y { 0 };
+    } m_start;
+
+    struct {
+        int32_t x { 0 };
+        int32_t y { 0 };
+    } m_offset;
+
+    bool m_handling { false };
+    struct wpe_input_axis_event m_axisEvent;
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/WPEView.cpp b/Source/WebKit2/UIProcess/API/wpe/WPEView.cpp
new file mode 100644 (file)
index 0000000..3d7b623
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WPEView.h"
+
+#include "APIPageConfiguration.h"
+#include "NativeWebKeyboardEvent.h"
+#include "NativeWebMouseEvent.h"
+#include "NativeWebTouchEvent.h"
+#include "NativeWebWheelEvent.h"
+#include "WebPageGroup.h"
+#include "WebProcessPool.h"
+#include <wpe/view-backend.h>
+
+using namespace WebKit;
+
+namespace WKWPE {
+
+View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseConfiguration)
+    : m_pageClient(std::make_unique<PageClientImpl>(*this))
+    , m_size { 800, 600 }
+    , m_viewStateFlags(WebCore::ActivityState::WindowIsActive | WebCore::ActivityState::IsFocused | WebCore::ActivityState::IsVisible | WebCore::ActivityState::IsInWindow)
+    , m_compositingManagerProxy(*this)
+{
+    auto configuration = baseConfiguration.copy();
+    auto* preferences = configuration->preferences();
+    if (!preferences && configuration->pageGroup()) {
+        preferences = &configuration->pageGroup()->preferences();
+        configuration->setPreferences(preferences);
+    }
+    if (preferences) {
+        preferences->setAcceleratedCompositingEnabled(true);
+        preferences->setForceCompositingMode(true);
+        preferences->setAccelerated2dCanvasEnabled(true);
+        preferences->setWebGLEnabled(true);
+        preferences->setWebSecurityEnabled(false);
+        preferences->setDeveloperExtrasEnabled(true);
+    }
+
+    auto* pool = configuration->processPool();
+    m_pageProxy = pool->createWebPage(*m_pageClient, WTFMove(configuration));
+
+    m_backend = backend;
+    if (!m_backend)
+        m_backend = wpe_view_backend_create();
+    m_compositingManagerProxy.initialize();
+
+    static struct wpe_view_backend_client s_backendClient = {
+        // set_size
+        [](void* data, uint32_t width, uint32_t height)
+        {
+            auto& view = *reinterpret_cast<View*>(data);
+            view.setSize(WebCore::IntSize(width, height));
+        },
+        // frame_displayed
+        [](void* data)
+        {
+            auto& view = *reinterpret_cast<View*>(data);
+            view.frameDisplayed();
+        }
+    };
+    wpe_view_backend_set_backend_client(m_backend, &s_backendClient, this);
+
+    static struct wpe_view_backend_input_client s_inputClient = {
+        // handle_keyboard_event
+        [](void* data, struct wpe_input_keyboard_event* event)
+        {
+            auto& view = *reinterpret_cast<View*>(data);
+            view.page().handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(event));
+        },
+        // handle_pointer_event
+        [](void* data, struct wpe_input_pointer_event* event)
+        {
+            auto& page = reinterpret_cast<View*>(data)->page();
+            page.handleMouseEvent(WebKit::NativeWebMouseEvent(event, page.deviceScaleFactor()));
+        },
+        // handle_axis_event
+        [](void* data, struct wpe_input_axis_event* event)
+        {
+            auto& page = reinterpret_cast<View*>(data)->page();
+            page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor()));
+        },
+        // handle_touch_event
+        [](void* data, struct wpe_input_touch_event* event)
+        {
+            auto& page = reinterpret_cast<View*>(data)->page();
+            page.handleTouchEvent(WebKit::NativeWebTouchEvent(event, page.deviceScaleFactor()));
+        },
+    };
+    wpe_view_backend_set_input_client(m_backend, &s_inputClient, this);
+
+    wpe_view_backend_initialize(m_backend);
+
+    m_pageProxy->initializeWebPage();
+}
+
+View::~View()
+{
+    wpe_view_backend_destroy(m_backend);
+}
+
+void View::initializeClient(const WKViewClientBase* client)
+{
+    m_client.initialize(client);
+}
+
+void View::frameDisplayed()
+{
+    m_client.frameDisplayed(*this);
+}
+
+void View::setSize(const WebCore::IntSize& size)
+{
+    m_size = size;
+    if (m_pageProxy->drawingArea())
+        m_pageProxy->drawingArea()->setSize(size, WebCore::IntSize(), WebCore::IntSize());
+}
+
+void View::setViewState(WebCore::ActivityState::Flags flags)
+{
+    static const WebCore::ActivityState::Flags defaultFlags = WebCore::ActivityState::WindowIsActive | WebCore::ActivityState::IsFocused;
+
+    WebCore::ActivityState::Flags changedFlags = m_viewStateFlags ^ (defaultFlags | flags);
+    m_viewStateFlags = defaultFlags | flags;
+
+    if (changedFlags)
+        m_pageProxy->activityStateDidChange(changedFlags);
+}
+
+} // namespace WKWPE
diff --git a/Source/WebKit2/UIProcess/API/wpe/WPEView.h b/Source/WebKit2/UIProcess/API/wpe/WPEView.h
new file mode 100644 (file)
index 0000000..2b3c9d8
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "CompositingManagerProxy.h"
+#include "PageClientImpl.h"
+#include "WPEViewClient.h"
+#include "WebPageProxy.h"
+#include <WebCore/ActivityState.h>
+#include <memory>
+#include <wtf/RefPtr.h>
+
+struct wpe_view_backend;
+
+namespace WebKit {
+class WebPageGroup;
+class WebProcessPool;
+}
+
+namespace WKWPE {
+
+class View : public API::ObjectImpl<API::Object::Type::View> {
+public:
+    static View* create(struct wpe_view_backend* backend, const API::PageConfiguration& configuration)
+    {
+        return new View(backend, configuration);
+    }
+
+    // Client methods
+    void initializeClient(const WKViewClientBase*);
+    void frameDisplayed();
+
+    WebKit::WebPageProxy& page() { return *m_pageProxy; }
+
+    struct wpe_view_backend* backend() { return m_backend; }
+
+    const WebCore::IntSize& size() const { return m_size; }
+
+    WebCore::ActivityState::Flags viewState() const { return m_viewStateFlags; }
+    void setViewState(WebCore::ActivityState::Flags);
+
+private:
+    View(struct wpe_view_backend*, const API::PageConfiguration&);
+    virtual ~View();
+
+    void setSize(const WebCore::IntSize&);
+
+    ViewClient m_client;
+
+    std::unique_ptr<WebKit::PageClientImpl> m_pageClient;
+    RefPtr<WebKit::WebPageProxy> m_pageProxy;
+    WebCore::IntSize m_size;
+    WebCore::ActivityState::Flags m_viewStateFlags;
+
+    WebKit::CompositingManagerProxy m_compositingManagerProxy;
+    struct wpe_view_backend* m_backend;
+};
+
+} // namespace WKWPE
diff --git a/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp b/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp
new file mode 100644 (file)
index 0000000..444ac98
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * 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 "WPEViewClient.h"
+
+#include "WKAPICast.h"
+#include "WKBase.h"
+#include "WPEView.h"
+
+using namespace WebKit;
+
+namespace WKWPE {
+
+void ViewClient::frameDisplayed(View& view)
+{
+    if (m_client.frameDisplayed)
+        m_client.frameDisplayed(toAPI(&view), m_client.base.clientInfo);
+}
+
+} // namespace WKWPE
diff --git a/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h b/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h
new file mode 100644 (file)
index 0000000..d5e559f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * 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 "APIClient.h"
+#include <WebKit/WKView.h>
+
+namespace API {
+template<> struct ClientTraits<WKViewClientBase> {
+    typedef std::tuple<WKViewClientV0> Versions;
+};
+}
+
+namespace WKWPE {
+
+class View;
+
+class ViewClient : public API::Client<WKViewClientBase> {
+public:
+    void frameDisplayed(View&);
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml b/Source/WebKit2/UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml
new file mode 100644 (file)
index 0000000..582092b
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/wpe/inspector/UserInterface">
+    <file>inspectorPageIndex.html</file>
+  </gresource>
+</gresources>
index 27bec36..fd848cc 100644 (file)
@@ -55,7 +55,7 @@ void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchO
     if (m_alwaysRunsAtBackgroundPriority)
         launchOptions.extraInitializationData.add(ASCIILiteral("always-runs-at-background-priority"), "true");
 
-#if ENABLE(DEVELOPER_MODE) && PLATFORM(GTK)
+#if ENABLE(DEVELOPER_MODE) && (PLATFORM(GTK) || PLATFORM(WPE))
     const char* varname;
     switch (launchOptions.processType) {
     case ProcessLauncher::ProcessType::Web:
@@ -79,7 +79,7 @@ void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchO
     const char* processCmdPrefix = getenv(varname);
     if (processCmdPrefix && *processCmdPrefix)
         launchOptions.processCmdPrefix = String::fromUTF8(processCmdPrefix);
-#endif // ENABLE(DEVELOPER_MODE) && PLATFORM(GTK)
+#endif // ENABLE(DEVELOPER_MODE) && (PLATFORM(GTK) || PLATFORM(WPE))
 }
 
 void ChildProcessProxy::connect()
index 3995069..ba77c2a 100644 (file)
@@ -60,7 +60,7 @@ public:
         ProcessType processType;
         HashMap<String, String> extraInitializationData;
 
-#if ENABLE(DEVELOPER_MODE) && PLATFORM(GTK)
+#if ENABLE(DEVELOPER_MODE) && (PLATFORM(GTK) || PLATFORM(WPE))
         String processCmdPrefix;
 #endif
     };
diff --git a/Source/WebKit2/UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp b/Source/WebKit2/UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp
new file mode 100644 (file)
index 0000000..6d46098
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
+ *
+ * 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 MOTOROLA 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 MOTOROLA 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 "ProcessLauncher.h"
+
+#include "Connection.h"
+#include "ProcessExecutablePath.h"
+#include <WebCore/FileSystem.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <wpe/renderer-host.h>
+#include <wtf/RunLoop.h>
+#include <wtf/glib/GLibUtilities.h>
+#include <wtf/glib/GUniquePtr.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+// FIXME: Merge with ProcessLauncherGtk?
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static void childSetupFunction(gpointer userData)
+{
+    int socket = GPOINTER_TO_INT(userData);
+    close(socket);
+}
+
+void ProcessLauncher::launchProcess()
+{
+    GPid pid = 0;
+
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(IPC::Connection::ConnectionOptions::SetCloexecOnServer);
+
+    String executablePath;
+    CString realExecutablePath;
+    switch (m_launchOptions.processType) {
+    case ProcessLauncher::ProcessType::Web:
+        executablePath = executablePathOfWebProcess();
+        break;
+    case ProcessLauncher::ProcessType::Network:
+        executablePath = executablePathOfNetworkProcess();
+        break;
+#if ENABLE(DATABASE_PROCESS)
+    case ProcessLauncher::ProcessType::Database:
+        executablePath = executablePathOfDatabaseProcess();
+        break;
+#endif
+    default:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    realExecutablePath = fileSystemRepresentation(executablePath);
+    GUniquePtr<gchar> wkSocket(g_strdup_printf("%d", socketPair.client));
+    GUniquePtr<gchar> wpeSocket;
+
+    unsigned nargs = 4; // size of the argv array for g_spawn_async()
+    if (m_launchOptions.processType == ProcessLauncher::ProcessType::Web) {
+        wpeSocket = GUniquePtr<gchar>(g_strdup_printf("%d", wpe_renderer_host_create_client()));
+        nargs = 5;
+    }
+
+#if ENABLE(DEVELOPER_MODE)
+    Vector<CString> prefixArgs;
+    if (!m_launchOptions.processCmdPrefix.isNull()) {
+        Vector<String> splitArgs;
+        m_launchOptions.processCmdPrefix.split(' ', splitArgs);
+        for (auto it = splitArgs.begin(); it != splitArgs.end(); it++)
+            prefixArgs.append(it->utf8());
+        nargs += prefixArgs.size();
+    }
+#endif
+
+    char** argv = g_newa(char*, nargs);
+    unsigned i = 0;
+#if ENABLE(DEVELOPER_MODE)
+    // If there's a prefix command, put it before the rest of the args.
+    for (auto it = prefixArgs.begin(); it != prefixArgs.end(); it++)
+        argv[i++] = const_cast<char*>(it->data());
+#endif
+    argv[i++] = const_cast<char*>(realExecutablePath.data());
+    argv[i++] = wkSocket.get();
+    if (m_launchOptions.processType == ProcessLauncher::ProcessType::Web)
+        argv[i++] = wpeSocket.get();
+    argv[i++] = nullptr;
+
+    GUniqueOutPtr<GError> error;
+    if (!g_spawn_async(0, argv, 0, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, childSetupFunction, GINT_TO_POINTER(socketPair.server), &pid, &error.outPtr())) {
+        g_printerr("Unable to fork a new WebProcess: %s.\n", error->message);
+        ASSERT_NOT_REACHED();
+    }
+
+    // Don't expose the parent socket to potential future children.
+    while (fcntl(socketPair.client, F_SETFD, FD_CLOEXEC) == -1)
+        RELEASE_ASSERT(errno != EINTR);
+
+    close(socketPair.client);
+    m_processIdentifier = pid;
+
+    // We've finished launching the process, message back to the main run loop.
+    RefPtr<ProcessLauncher> protectedThis(this);
+    IPC::Connection::Identifier serverSocket = socketPair.server;
+    RunLoop::main().dispatch([protectedThis, pid, serverSocket] {
+        protectedThis->didFinishLaunchingProcess(pid, serverSocket);
+    });
+}
+
+void ProcessLauncher::terminateProcess()
+{
+    if (m_isLaunching) {
+        invalidate();
+        return;
+    }
+
+    if (!m_processIdentifier)
+        return;
+
+    kill(m_processIdentifier, SIGKILL);
+    m_processIdentifier = 0;
+}
+
+void ProcessLauncher::platformInvalidate()
+{
+}
+
+} // namespace WebKit
index 1c8ef46..847fb5c 100644 (file)
@@ -224,7 +224,7 @@ private:
 
     WebPreferences& inspectorPagePreferences() const;
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
     void createInspectorWindow();
     void updateInspectorWindowTitle() const;
 #endif
index 44e8365..9bb6d54 100644 (file)
@@ -98,6 +98,7 @@ private:
     void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, uint64_t& newChangeCount);
     void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, uint64_t& newChangeCount);
 #endif
+
 #if PLATFORM(GTK)
     void writeToClipboard(const String& pasteboardName, const WebSelectionData&);
     void readFromClipboard(const String& pasteboardName, WebSelectionData&);
@@ -105,7 +106,14 @@ private:
     WebFrameProxy* m_primarySelectionOwner { nullptr };
     WebFrameProxy* m_frameWritingToClipboard { nullptr };
 #endif // PLATFORM(GTK)
-    
+
+#if PLATFORM(WPE)
+    void getPasteboardTypes(Vector<String>& pasteboardTypes);
+    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String&);
+    void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&);
+    void writeStringToPasteboard(const String& pasteboardType, const String&);
+#endif
+
     WebProcessProxyList m_webProcessProxyList;
 };
 
index 766bc12..4012ad5 100644 (file)
@@ -58,4 +58,11 @@ messages -> WebPasteboardProxy {
     WriteToClipboard(String pasteboardName, struct WebKit::WebSelectionData pasteboardContent)
     ReadFromClipboard(String pasteboardName) -> (struct WebKit::WebSelectionData pasteboardContent)
 #endif
+
+#if PLATFORM(WPE)
+    GetPasteboardTypes() -> (Vector<String> types)
+    ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string)
+    WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content)
+    WriteStringToPasteboard(String pasteboardType, String text)
+#endif
 }
index 850e65d..97e461c 100644 (file)
@@ -285,7 +285,7 @@ WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration& configuration)
     notifyThisWebProcessPoolWasCreated();
 }
 
-#if !PLATFORM(COCOA) && !PLATFORM(GTK)
+#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE)
 void WebProcessPool::platformInitialize()
 {
 }
diff --git a/Source/WebKit2/UIProcess/wpe/TextCheckerWPE.cpp b/Source/WebKit2/UIProcess/wpe/TextCheckerWPE.cpp
new file mode 100644 (file)
index 0000000..5b5595f
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "TextChecker.h"
+
+#include "TextCheckerState.h"
+#include <WebCore/NotImplemented.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static TextCheckerState textCheckerState;
+
+const TextCheckerState& TextChecker::state()
+{
+    return textCheckerState;
+}
+
+void TextChecker::setTestingMode(bool)
+{
+}
+
+bool TextChecker::isTestingMode()
+{
+    notImplemented();
+    return false;
+}
+
+bool TextChecker::isContinuousSpellCheckingAllowed()
+{
+    notImplemented();
+    return false;
+}
+
+void TextChecker::setContinuousSpellCheckingEnabled(bool)
+{
+    notImplemented();
+}
+
+void TextChecker::setGrammarCheckingEnabled(bool)
+{
+    notImplemented();
+}
+
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool)
+{
+    notImplemented();
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool)
+{
+    notImplemented();
+}
+
+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
+{
+    notImplemented();
+    return false;
+}
+
+void TextChecker::closeSpellDocumentWithTag(int64_t)
+{
+    notImplemented();
+}
+
+void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)
+{
+    notImplemented();
+}
+
+void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
+{
+    notImplemented();
+}
+
+bool TextChecker::spellingUIIsShowing()
+{
+    notImplemented();
+    return false;
+}
+
+void TextChecker::toggleSpellingUIIsShowing()
+{
+    notImplemented();
+}
+
+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t, const String&)
+{
+    notImplemented();
+}
+
+void TextChecker::updateSpellingUIWithGrammarString(int64_t, const String&, const GrammarDetail&)
+{
+    notImplemented();
+}
+
+void TextChecker::getGuessesForWord(int64_t, const String&, const String&, int32_t, Vector<String>&, bool)
+{
+    notImplemented();
+}
+
+void TextChecker::learnWord(int64_t, const String&)
+{
+    notImplemented();
+}
+
+void TextChecker::ignoreWord(int64_t, const String&)
+{
+    notImplemented();
+}
+
+void TextChecker::requestCheckingOfString(Ref<TextCheckerCompletion>&&, int32_t)
+{
+    notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/wpe/WebInspectorProxyWPE.cpp b/Source/WebKit2/UIProcess/wpe/WebInspectorProxyWPE.cpp
new file mode 100644 (file)
index 0000000..5baeee3
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebInspectorProxy.h"
+
+#include <WebCore/NotImplemented.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
+{
+    notImplemented();
+    return nullptr;
+}
+
+void WebInspectorProxy::createInspectorWindow()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformOpen()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformDidClose()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformDidCloseForCrash()
+{
+}
+
+void WebInspectorProxy::platformInvalidate()
+{
+}
+
+void WebInspectorProxy::platformHide()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformBringToFront()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformBringInspectedPageToFront()
+{
+    notImplemented();
+}
+
+bool WebInspectorProxy::platformIsFront()
+{
+    notImplemented();
+    return false;
+}
+
+void WebInspectorProxy::platformInspectedURLChanged(const String&)
+{
+    notImplemented();
+}
+
+String WebInspectorProxy::inspectorPageURL()
+{
+    return String("resource:///org/wpe/inspector/UserInterface/Main.html");
+}
+
+String WebInspectorProxy::inspectorTestPageURL()
+{
+    return String("resource:///org/wpe/inspector/UserInterface/Test.html");
+}
+
+String WebInspectorProxy::inspectorBaseURL()
+{
+    return String("resource:///org/wpe/inspector/UserInterface/");
+}
+
+unsigned WebInspectorProxy::platformInspectedWindowHeight()
+{
+    notImplemented();
+    return 0;
+}
+
+unsigned WebInspectorProxy::platformInspectedWindowWidth()
+{
+    notImplemented();
+    return 0;
+}
+
+void WebInspectorProxy::platformAttach()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformDetach()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformStartWindowDrag()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSave(const String&, const String&, bool, bool)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformAppend(const String&, const String&)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformAttachAvailabilityChanged(bool)
+{
+    notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/wpe/WebPageProxyWPE.cpp b/Source/WebKit2/UIProcess/wpe/WebPageProxyWPE.cpp
new file mode 100644 (file)
index 0000000..4a202ab
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebPageProxy.h"
+
+#include "WebsiteDataStore.h"
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebPageProxy::platformInitialize()
+{
+    notImplemented();
+}
+
+String WebPageProxy::standardUserAgent(const String&)
+{
+    return "Mozilla/5.0 (Linux; x86_64 GNU/Linux) AppleWebKit/601.1 (KHTML, like Gecko) Version/8.0 Safari/601.1";
+}
+
+void WebPageProxy::saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&)
+{
+    notImplemented();
+}
+
+void WebPageProxy::loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&)
+{
+    notImplemented();
+}
+
+void WebsiteDataStore::platformRemoveRecentSearches(std::chrono::system_clock::time_point)
+{
+    notImplemented();
+}
+
+void WebPageProxy::editorStateChanged(const EditorState&)
+{
+    notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/wpe/WebPasteboardProxyWPE.cpp b/Source/WebKit2/UIProcess/wpe/WebPasteboardProxyWPE.cpp
new file mode 100644 (file)
index 0000000..8d3d0eb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "WebPasteboardProxy.h"
+
+#include <WebCore/PlatformPasteboard.h>
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+void WebPasteboardProxy::getPasteboardTypes(Vector<String>& pasteboardTypes)
+{
+    PlatformPasteboard().getTypes(pasteboardTypes);
+}
+
+void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String& value)
+{
+    value = PlatformPasteboard().readString(index, pasteboardType);
+}
+
+void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content)
+{
+    PlatformPasteboard().write(content);
+}
+
+void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text)
+{
+    PlatformPasteboard().write(pasteboardType, text);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/wpe/WebPreferencesWPE.cpp b/Source/WebKit2/UIProcess/wpe/WebPreferencesWPE.cpp
new file mode 100644 (file)
index 0000000..ff81fcd
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebPreferences.h"
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebPreferences::platformInitializeStore()
+{
+    notImplemented();
+}
+
+void WebPreferences::platformUpdateStringValueForKey(const String&, const String&)
+{
+    notImplemented();
+}
+
+void WebPreferences::platformUpdateBoolValueForKey(const String&, bool)
+{
+    notImplemented();
+}
+
+void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t)
+{
+    notImplemented();
+}
+
+void WebPreferences::platformUpdateDoubleValueForKey(const String&, double)
+{
+    notImplemented();
+}
+
+void WebPreferences::platformUpdateFloatValueForKey(const String&, float)
+{
+    notImplemented();
+}
+
+bool WebPreferences::platformGetStringUserValueForKey(const String&, String&)
+{
+    notImplemented();
+    return false;
+}
+
+bool WebPreferences::platformGetBoolUserValueForKey(const String&, bool&)
+{
+    notImplemented();
+    return false;
+}
+
+bool WebPreferences::platformGetUInt32UserValueForKey(const String&, uint32_t&)
+{
+    notImplemented();
+    return false;
+}
+
+bool WebPreferences::platformGetDoubleUserValueForKey(const String&, double&)
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp b/Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp
new file mode 100644 (file)
index 0000000..401552b
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
+ * Copyright (C) 2012 Samsung Electronics Ltd. All Rights Reserved.
+ *
+ * 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 "WebProcessPool.h"
+
+#include "APIProcessPoolConfiguration.h"
+#include "Logging.h"
+#include "NetworkProcessMessages.h"
+#include "WebCookieManagerProxy.h"
+#include "WebInspectorServer.h"
+#include "WebProcessCreationParameters.h"
+#include "WebProcessMessages.h"
+#include <WebCore/FileSystem.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/SchemeRegistry.h>
+#include <cstdlib>
+#include <wtf/glib/GUniquePtr.h>
+
+namespace WebKit {
+
+WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
+{
+    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(cacheDirectory.get());
+}
+
+WTF::String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()
+{
+    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(cacheDirectory.get());
+}
+
+void WebProcessPool::platformInitialize()
+{
+    m_websiteDataStore->websiteDataStore().registerSharedResourceLoadObserver();
+}
+
+void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
+{
+    parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;
+}
+
+void WebProcessPool::platformInvalidateContext()
+{
+    notImplemented();
+}
+
+String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()
+{
+    GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(databaseDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()
+{
+    GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get());
+}
+
+String WebProcessPool::platformDefaultIconDatabasePath() const
+{
+    GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "icondatabase", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(databaseDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
+{
+    GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(storageDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()
+{
+    GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
+{
+    GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(diskCacheDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()
+{
+    GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "JavaScriptCoreDebug", nullptr));
+    return WebCore::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());
+}
+
+void WebProcessPool::platformResolvePathsForSandboxExtensions()
+{
+}
+
+} // namespace WebKit
index 05704bb..d1cc9cd 100644 (file)
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "WKBASE_H=${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}/WKBase.h\n\nunifdef -B -D__APPLE__ -UBUILDING_GTK__ -UUSE_SOUP -o \"${WKBASE_H}\".unifdef \"${WKBASE_H}\"\n\ncase $? in\n0)\n    rm \"${WKBASE_H}\".unifdef\n    ;;\n1)\n    mv \"${WKBASE_H}\"{.unifdef,}\n    ;;\n*)\n    exit 1\nesac\n";
+                       shellScript = "WKBASE_H=${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}/WKBase.h\n\nunifdef -B -D__APPLE__ -UBUILDING_GTK__ -UBUILDING_WPE__ -UUSE_SOUP -o \"${WKBASE_H}\".unifdef \"${WKBASE_H}\"\n\ncase $? in\n0)\n    rm \"${WKBASE_H}\".unifdef\n    ;;\n1)\n    mv \"${WKBASE_H}\"{.unifdef,}\n    ;;\n*)\n    exit 1\nesac\n";
                };
                37E531011B2391090074F0DF /* Copy iOS Sandbox Profiles for Manual Sandboxing */ = {
                        isa = PBXShellScriptBuildPhase;
index 57509b9..e2be809 100644 (file)
@@ -57,7 +57,7 @@
 
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
 #define ENABLE_SHAREABLE_RESOURCE 1
 #endif
 
index a831334..8e26d9c 100644 (file)
@@ -297,7 +297,7 @@ void WebEditorClient::redo()
     m_page->sendSync(Messages::WebPageProxy::ExecuteUndoRedo(static_cast<uint32_t>(WebPageProxy::Redo)), Messages::WebPageProxy::ExecuteUndoRedo::Reply(result));
 }
 
-#if !PLATFORM(GTK) && !PLATFORM(COCOA)
+#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WPE)
 void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
 {
     if (m_page->handleEditingKeyboardEvent(event))
index 823290d..1aa2d8b 100644 (file)
@@ -375,4 +375,31 @@ Ref<SelectionData> WebPlatformStrategies::readFromClipboard(const String& pasteb
 
 #endif // PLATFORM(GTK)
 
+#if PLATFORM(WPE)
+// PasteboardStrategy
+
+void WebPlatformStrategies::getTypes(Vector<String>& types)
+{
+    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardTypes(), Messages::WebPasteboardProxy::GetPasteboardTypes::Reply(types), 0);
+}
+
+String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType)
+{
+    String value;
+    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);
+    return value;
+}
+
+void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content), 0);
+}
+
+void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteStringToPasteboard(pasteboardType, text), 0);
+}
+
+#endif // PLATFORM(WPE)
+
 } // namespace WebKit
index 41938ed..72dcf9f 100644 (file)
@@ -93,6 +93,12 @@ private:
     void writeToClipboard(const String& pasteboardName, const WebCore::SelectionData&) override;
     Ref<WebCore::SelectionData> readFromClipboard(const String& pasteboardName) override;
 #endif
+#if PLATFORM(WPE)
+    void getTypes(Vector<String>& types) override;
+    String readStringFromPasteboard(int index, const String& pasteboardType) override;
+    void writeToPasteboard(const WebCore::PasteboardWebContent&) override;
+    void writeToPasteboard(const String& pasteboardType, const String&) override;
+#endif
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebContextMenuClientWPE.cpp
new file mode 100644 (file)
index 0000000..ed034b0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebContextMenuClient.h"
+
+#if ENABLE(CONTEXT_MENUS)
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebContextMenuClient::lookUpInDictionary(WebCore::Frame*)
+{
+    notImplemented();
+}
+
+bool WebContextMenuClient::isSpeaking()
+{
+    notImplemented();
+    return false;
+}
+
+void WebContextMenuClient::speak(const String&)
+{
+    notImplemented();
+}
+
+void WebContextMenuClient::stopSpeaking()
+{
+    notImplemented();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(CONTEXT_MENUS)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp
new file mode 100644 (file)
index 0000000..bdca302
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "WebEditorClient.h"
+
+#include "PlatformKeyboardEvent.h"
+#include <WebCore/Document.h>
+#include <WebCore/Editor.h>
+#include <WebCore/EventNames.h>
+#include <WebCore/Frame.h>
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/Node.h>
+#include <WebCore/WindowsKeyboardCodes.h>
+#include <wtf/NeverDestroyed.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+// The idea for the array/map below comes from Blink's EditingBehavior.cpp.
+
+static const unsigned CtrlKey  = 1 << 0;
+static const unsigned AltKey   = 1 << 1;
+static const unsigned ShiftKey = 1 << 2;
+static const unsigned MetaKey  = 1 << 3;
+
+// Keys with special meaning. These will be delegated to the editor using
+// the execCommand() method
+struct KeyDownEntry {
+    unsigned virtualKey;
+    unsigned modifiers;
+    const char* name;
+};
+
+struct KeyPressEntry {
+    unsigned charCode;
+    unsigned modifiers;
+    const char* name;
+};
+
+static const KeyDownEntry keyDownEntries[] = {
+    { VK_LEFT,   0,                  "MoveLeft"                                },
+    { VK_LEFT,   ShiftKey,           "MoveLeftAndModifySelection"              },
+    { VK_LEFT,   CtrlKey,            "MoveWordLeft"                            },
+    { VK_LEFT,   CtrlKey | ShiftKey,
+        "MoveWordLeftAndModifySelection"                                       },
+    { VK_RIGHT,  0,                  "MoveRight"                               },
+    { VK_RIGHT,  ShiftKey,           "MoveRightAndModifySelection"             },
+    { VK_RIGHT,  CtrlKey,            "MoveWordRight"                           },
+    { VK_RIGHT,  CtrlKey | ShiftKey, "MoveWordRightAndModifySelection"         },
+    { VK_UP,     0,                  "MoveUp"                                  },
+    { VK_UP,     ShiftKey,           "MoveUpAndModifySelection"                },
+    { VK_PRIOR,  ShiftKey,           "MovePageUpAndModifySelection"            },
+    { VK_DOWN,   0,                  "MoveDown"                                },
+    { VK_DOWN,   ShiftKey,           "MoveDownAndModifySelection"              },
+    { VK_NEXT,   ShiftKey,           "MovePageDownAndModifySelection"          },
+    { VK_UP,     CtrlKey | ShiftKey, "MoveParagraphBackwardAndModifySelection" },
+    { VK_DOWN,   CtrlKey | ShiftKey, "MoveParagraphForwardAndModifySelection"  },
+    { VK_PRIOR,  0,                  "MovePageUp"                              },
+    { VK_NEXT,   0,                  "MovePageDown"                            },
+    { VK_HOME,   0,                  "MoveToBeginningOfLine"                   },
+    { VK_HOME,   ShiftKey,
+        "MoveToBeginningOfLineAndModifySelection"                              },
+    { VK_HOME,   CtrlKey,            "MoveToBeginningOfDocument"               },
+    { VK_HOME,   CtrlKey | ShiftKey,
+        "MoveToBeginningOfDocumentAndModifySelection"                          },
+    { VK_END,    0,                  "MoveToEndOfLine"                         },
+    { VK_END,    ShiftKey,           "MoveToEndOfLineAndModifySelection"       },
+    { VK_END,    CtrlKey,            "MoveToEndOfDocument"                     },
+    { VK_END,    CtrlKey | ShiftKey,
+        "MoveToEndOfDocumentAndModifySelection"                                },
+    { VK_BACK,   0,                  "DeleteBackward"                          },
+    { VK_BACK,   ShiftKey,           "DeleteBackward"                          },
+    { VK_DELETE, 0,                  "DeleteForward"                           },
+    { VK_BACK,   CtrlKey,            "DeleteWordBackward"                      },
+    { VK_DELETE, CtrlKey,            "DeleteWordForward"                       },
+    { 'B',         CtrlKey,          "ToggleBold"                              },
+    { 'I',         CtrlKey,          "ToggleItalic"                            },
+    { 'U',         CtrlKey,          "ToggleUnderline"                         },
+    { VK_ESCAPE, 0,                  "Cancel"                                  },
+    { VK_OEM_PERIOD, CtrlKey,        "Cancel"                                  },
+    { VK_TAB,    0,                  "InsertTab"                               },
+    { VK_TAB,    ShiftKey,           "InsertBacktab"                           },
+    { VK_RETURN, 0,                  "InsertNewline"                           },
+    { VK_RETURN, CtrlKey,            "InsertNewline"                           },
+    { VK_RETURN, AltKey,             "InsertNewline"                           },
+    { VK_RETURN, AltKey | ShiftKey,  "InsertNewline"                           },
+    { VK_RETURN, ShiftKey,           "InsertLineBreak"                         },
+    // These probably need handling somewhere else so do not execute them. The
+    // 'Cut' command is removing text so let's avoid losing the user losing data
+    // until we implement clipboard support wherever it should be.
+    { VK_INSERT, CtrlKey,            "Copy"                                    },
+    { VK_INSERT, ShiftKey,           "Paste"                                   },
+    { VK_DELETE, ShiftKey,           "Cut"                                     },
+    { 'C',         CtrlKey,          "Copy"                                    },
+    { 'V',         CtrlKey,          "Paste"                                   },
+    { 'V',         CtrlKey | ShiftKey, "PasteAndMatchStyle"                    },
+    { 'X',         CtrlKey,          "Cut"                                     },
+    { 'A',         CtrlKey,          "SelectAll"                               },
+    { 'Z',         CtrlKey,          "Undo"                                    },
+    { 'Z',         CtrlKey | ShiftKey, "Redo"                                  },
+    { 'Y',         CtrlKey,          "Redo"                                    },
+    { VK_INSERT, 0,                  "OverWrite"                               },
+};
+
+static const KeyPressEntry keyPressEntries[] = {
+    { '\t',   0,                  "InsertTab"                                  },
+    { '\t',   ShiftKey,           "InsertBacktab"                              },
+    { '\r',   0,                  "InsertNewline"                              },
+    { '\r',   CtrlKey,            "InsertNewline"                              },
+    { '\r',   ShiftKey,           "InsertLineBreak"                            },
+    { '\r',   AltKey,             "InsertNewline"                              },
+    { '\r',   AltKey | ShiftKey,  "InsertNewline"                              },
+};
+
+static const char* interpretKeyEvent(const KeyboardEvent& event)
+{
+    static NeverDestroyed<HashMap<int, const char*>> keyDownCommandsMap;
+    static NeverDestroyed<HashMap<int, const char*>> keyPressCommandsMap;
+
+    if (keyDownCommandsMap.get().isEmpty()) {
+        for (unsigned i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); i++)
+            keyDownCommandsMap.get().set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);
+        for (unsigned i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); i++)
+            keyPressCommandsMap.get().set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
+    }
+
+    unsigned modifiers = 0;
+    if (event.shiftKey())
+        modifiers |= ShiftKey;
+    if (event.altKey())
+        modifiers |= AltKey;
+    if (event.ctrlKey())
+        modifiers |= CtrlKey;
+    if (event.metaKey())
+        modifiers |= MetaKey;
+
+    if (event.type() == eventNames().keydownEvent) {
+        int mapKey = modifiers << 16 | event.keyCode();
+        return mapKey ? keyDownCommandsMap.get().get(mapKey) : nullptr;
+    }
+
+    int mapKey = modifiers << 16 | event.charCode();
+    return mapKey ? keyPressCommandsMap.get().get(mapKey) : nullptr;
+}
+
+static void handleKeyPress(Frame& frame, KeyboardEvent& event, const PlatformKeyboardEvent& platformEvent)
+{
+    String commandName = interpretKeyEvent(event);
+
+    if (!commandName.isEmpty()) {
+        frame.editor().command(commandName).execute();
+        event.setDefaultHandled();
+        return;
+    }
+
+    // Don't insert null or control characters as they can result in unexpected behaviour
+    if (event.charCode() < ' ')
+        return;
+
+    // Don't insert anything if a modifier is pressed and it has not been handled yet
+    if (platformEvent.ctrlKey() || platformEvent.altKey())
+        return;
+
+    if (frame.editor().insertText(platformEvent.text(), &event))
+        event.setDefaultHandled();
+}
+
+static void handleKeyDown(Frame& frame, KeyboardEvent& event, const PlatformKeyboardEvent&)
+{
+    String commandName = interpretKeyEvent(event);
+    if (commandName.isEmpty())
+        return;
+
+    // We shouldn't insert text through the editor. Let WebCore decide
+    // how to handle that (say, Tab, which could also be used to
+    // change focus).
+    Editor::Command command = frame.editor().command(commandName);
+    if (command.isTextInsertion())
+        return;
+
+    command.execute();
+    event.setDefaultHandled();
+}
+
+void WebEditorClient::handleKeyboardEvent(WebCore::KeyboardEvent* event)
+{
+    Node* node = event->target()->toNode();
+    ASSERT(node);
+    Frame* frame = node->document().frame();
+    ASSERT(frame);
+
+    // FIXME: Reorder the checks in a more sensible way.
+
+    const PlatformKeyboardEvent* platformEvent = event->keyEvent();
+    if (!platformEvent)
+        return;
+
+    // If this was an IME event don't do anything.
+    if (platformEvent->windowsVirtualKeyCode() == VK_PROCESSKEY)
+        return;
+
+    // Don't allow text insertion for nodes that cannot edit.
+    if (!frame->editor().canEdit())