Skip to content

Commit

Permalink
[WPE] Upstream the new WPE platform API
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265286

Reviewed by Adrian Perez de Castro and Michael Catanzaro.

New WPE platform API is still work in progress, but we have enough
already to know that this is the way we want to go, so we can continue
working upstream.

The new API is always built, but the old one will be used by default, so
there shouldn't be any change in behavior. MiniBrowser and WKTR can use
the new api by using a new command line option to enable it.

* Source/WebCore/PlatformWPE.cmake:
* Source/WebCore/SourcesWPE.txt:
* Source/WebCore/platform/Scrollbar.cpp:
(WebCore::Scrollbar::pixelsPerLineStep):
* Source/WebCore/platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::createPlatformDisplay):
* Source/WebCore/platform/graphics/PlatformDisplay.h:
(WebCore::PlatformDisplay::setUseDMABufForRendering):
* Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
(WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
* Source/WebKit/PlatformWPE.cmake:
* Source/WebKit/Shared/NativeWebKeyboardEvent.h:
* Source/WebKit/Shared/NativeWebMouseEvent.h:
* Source/WebKit/Shared/NativeWebTouchEvent.h:
* Source/WebKit/Shared/NativeWebWheelEvent.h:
* Source/WebKit/Shared/WebKeyboardEvent.h:
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/Shared/WebPageCreationParameters.serialization.in:
* Source/WebKit/Shared/WebProcessCreationParameters.h:
* Source/WebKit/Shared/WebProcessCreationParameters.serialization.in:
* Source/WebKit/Shared/libwpe/WebEventFactory.h:
* Source/WebKit/Shared/wpe/GRefPtrWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WTF::refGPtr):
(WTF::derefGPtr):
* Source/WebKit/Shared/wpe/GRefPtrWPE.h: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
* Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
* Source/WebKit/Shared/wpe/NativeWebMouseEventWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* Source/WebKit/Shared/wpe/NativeWebTouchEventWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
* Source/WebKit/Shared/wpe/NativeWebWheelEventWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
* Source/WebKit/Shared/wpe/WebEventFactoryWPE.cpp: Added.
(WebKit::wallTimeForEvent):
(WebKit::modifiersFromWPEModifiers):
(WebKit::buttonForWPEButton):
(WebKit::buttonFromWPEModifiers):
(WebKit::movementDeltaFromEvent):
(WebKit::pressedMouseButtons):
(WebKit::positionFromEvent):
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* Source/WebKit/Shared/wpe/WebKeyboardEventWPE.cpp: Copied from Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp.
(WebKit::WebKeyboardEvent::keyValueStringForWPEKeyval):
(WebKit::WebKeyboardEvent::keyCodeStringForWPEKeycode):
(WebKit::WebKeyboardEvent::keyIdentifierForWPEKeyval):
(WebKit::WebKeyboardEvent::windowsKeyCodeForWPEKeyval):
(WebKit::WebKeyboardEvent::singleCharacterStringForWPEKeyval):
* Source/WebKit/SourcesWPE.txt:
* Source/WebKit/UIProcess/API/C/wpe/WKView.cpp:
(WKViewCreate):
(WKViewCreateDeprecated):
(WKViewGetView):
(WKViewSetViewClient): Deleted.
* Source/WebKit/UIProcess/API/C/wpe/WKView.h:
* Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:
(WebKitWebViewClient::enterFullScreen):
(WebKitWebViewClient::exitFullScreen):
(webkitWebViewConstructed):
(webkitWebViewSetProperty):
(webkitWebViewGetProperty):
(webkit_web_view_class_init):
(webkitWebViewCreatePage):
(webkit_web_view_get_display):
(webkit_web_view_get_wpe_view):
* Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in:
* Source/WebKit/UIProcess/API/wpe/APIViewClient.h:
(API::ViewClient::enterFullScreen):
(API::ViewClient::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::wpeView const):
(WebKit::PageClientImpl::hostFileDescriptor):
(WebKit::PageClientImpl::setCursor):
(WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::exitAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
(WebKit::PageClientImpl::enterFullScreen):
(WebKit::PageClientImpl::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.h:
* Source/WebKit/UIProcess/API/wpe/WPEWebView.cpp:
(WKWPE::View::View):
(WKWPE::m_wpeDisplay):
(WKWPE::View::~View):
(WKWPE::View::isFullScreen const):
(WKWPE::View::willEnterFullScreen):
(WKWPE::View::enterFullScreen):
(WKWPE::View::didEnterFullScreen):
(WKWPE::View::willExitFullScreen):
(WKWPE::View::exitFullScreen):
(WKWPE::View::didExitFullScreen):
(WKWPE::View::requestExitFullScreen):
(WKWPE::View::setFullScreen):
(WKWPE::View::updateAcceleratedSurface):
(WKWPE::View::touchPointsForEvent):
(WKWPE::View::setCursor):
(WKWPE::m_backend): Deleted.
* Source/WebKit/UIProcess/API/wpe/WPEWebView.h:
(WKWPE::View::create):
(WKWPE::View::wpeView const):
(WKWPE::View::isFullScreen): Deleted.
* Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h:
* Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp:
(webkit_web_view_new):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::updateCurrentModifierState):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/glib/DisplayVBlankMonitorDRM.cpp:
(WebKit::DisplayVBlankMonitorDRM::create):
* Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.cpp: Added.
(WebKit::AcceleratedBackingStoreDMABuf::create):
(WebKit::AcceleratedBackingStoreDMABuf::AcceleratedBackingStoreDMABuf):
(WebKit::AcceleratedBackingStoreDMABuf::~AcceleratedBackingStoreDMABuf):
(WebKit::AcceleratedBackingStoreDMABuf::updateSurfaceID):
(WebKit::AcceleratedBackingStoreDMABuf::didCreateBuffer):
(WebKit::AcceleratedBackingStoreDMABuf::didCreateBufferSHM):
(WebKit::AcceleratedBackingStoreDMABuf::didDestroyBuffer):
(WebKit::AcceleratedBackingStoreDMABuf::frame):
(WebKit::AcceleratedBackingStoreDMABuf::frameDone):
(WebKit::AcceleratedBackingStoreDMABuf::bufferRendered):
* Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.h: Added.
* Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::wpeView const):
(WebKit::WebPageProxy::preferredBufferFormats const):
(WebKit::WebPageProxy::preferredBufferFormatsDidChange):
(WebKit::WebPageProxy::currentStateOfModifierKeys):
* Source/WebKit/WPEPlatform: Added.
* Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp:
(WebKit::AcceleratedSurface::create):
* Source/WebKit/WebProcess/WebPage/AcceleratedSurface.h:
(WebKit::AcceleratedSurface::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.cpp:
(WebKit::AcceleratedSurfaceDMABuf::SwapChain::setupBufferFormat):
(WebKit::AcceleratedSurfaceDMABuf::SwapChain::nextTarget):
(WebKit::AcceleratedSurfaceDMABuf::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.h:
* Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::preferredBufferFormatsDidChange):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
* Source/WebKit/wpe/wpe-webkit-uninstalled.pc.in:
* Source/WebKit/wpe/wpe-webkit.pc.in:
* Source/cmake/FindLibInput.cmake: Added.
* Source/cmake/FindUdev.cmake: Added.
* Source/cmake/OptionsWPE.cmake:
* Tools/MiniBrowser/wpe/CMakeLists.txt:
* Tools/MiniBrowser/wpe/main.cpp:
(createViewBackend):
(createWebView):
(activate):
(main):
* Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Tools/Scripts/webkitpy/port/driver.py:
(Driver.cmd_line):
* Tools/Scripts/webkitpy/port/wpe.py:
(WPEPort.setup_environ_for_server):
* Tools/Scripts/webkitpy/style/checker.py:
* Tools/Scripts/webkitpy/style/checkers/cpp.py:
(check_identifier_name_in_declaration):
* Tools/TestWebKitAPI/wpe/PlatformWebViewWPE.cpp:
(TestWebKitAPI::PlatformWebView::initialize):
* Tools/WebKitTestRunner/EventSenderProxy.h:
* Tools/WebKitTestRunner/Options.cpp:
(WTR::handleOptionWPEPlatformAPI):
(WTR::OptionsHandler::OptionsHandler):
* Tools/WebKitTestRunner/Options.h:
* Tools/WebKitTestRunner/PlatformWPE.cmake:
* Tools/WebKitTestRunner/PlatformWebView.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
* Tools/WebKitTestRunner/TestController.h:
(WTR::TestController::useWPEPlatformAPI const):
* Tools/WebKitTestRunner/libwpe/EventSenderProxyClient.h: Copied from Source/WebKit/UIProcess/API/wpe/APIViewClient.h.
(WTR::EventSenderProxyClient::addTouchPoint):
(WTR::EventSenderProxyClient::updateTouchPoint):
(WTR::EventSenderProxyClient::touchStart):
(WTR::EventSenderProxyClient::touchMove):
(WTR::EventSenderProxyClient::touchEnd):
(WTR::EventSenderProxyClient::touchCancel):
(WTR::EventSenderProxyClient::clearTouchPoints):
(WTR::EventSenderProxyClient::releaseTouchPoint):
(WTR::EventSenderProxyClient::cancelTouchPoint):
(WTR::EventSenderProxyClient::EventSenderProxyClient):
* Tools/WebKitTestRunner/libwpe/EventSenderProxyClientLibWPE.cpp: Copied from Tools/WebKitTestRunner/libwpe/EventSenderProxyLibWPE.cpp.
(WTR::EventSenderProxyClientLibWPE::EventSenderProxyClientLibWPE):
(WTR::viewBackend):
(WTR::secToMsTimestamp):
(WTR::senderButtonToWPEButton):
(WTR::modifierForButton):
(WTR::wkEventModifiersToWPE):
(WTR::EventSenderProxyClientLibWPE::mouseDown):
(WTR::EventSenderProxyClientLibWPE::mouseUp):
(WTR::EventSenderProxyClientLibWPE::mouseMoveTo):
(WTR::EventSenderProxyClientLibWPE::mouseScrollBy):
(WTR::wpeKeySymForKeyRef):
(WTR::EventSenderProxyClientLibWPE::keyDown):
(WTR::EventSenderProxyClientLibWPE::addTouchPoint):
(WTR::EventSenderProxyClientLibWPE::updateTouchPoint):
(WTR::EventSenderProxyClientLibWPE::touchStart):
(WTR::EventSenderProxyClientLibWPE::touchMove):
(WTR::EventSenderProxyClientLibWPE::touchEnd):
(WTR::EventSenderProxyClientLibWPE::touchCancel):
(WTR::EventSenderProxyClientLibWPE::clearTouchPoints):
(WTR::EventSenderProxyClientLibWPE::releaseTouchPoint):
(WTR::EventSenderProxyClientLibWPE::cancelTouchPoint):
(WTR::EventSenderProxyClientLibWPE::getUpdatedTouchEvents):
(WTR::EventSenderProxyClientLibWPE::removeUpdatedTouchEvents):
(WTR::EventSenderProxyClientLibWPE::prepareAndDispatchTouchEvent):
* Tools/WebKitTestRunner/libwpe/EventSenderProxyClientLibWPE.h: Added.
* Tools/WebKitTestRunner/libwpe/EventSenderProxyLibWPE.cpp:
(WTR::EventSenderProxy::EventSenderProxy):
(WTR::EventSenderProxy::mouseDown):
(WTR::EventSenderProxy::mouseUp):
(WTR::EventSenderProxy::mouseMoveTo):
(WTR::EventSenderProxy::mouseScrollBy):
(WTR::EventSenderProxy::keyDown):
(WTR::EventSenderProxy::addTouchPoint):
(WTR::EventSenderProxy::updateTouchPoint):
(WTR::EventSenderProxy::touchStart):
(WTR::EventSenderProxy::touchMove):
(WTR::EventSenderProxy::touchEnd):
(WTR::EventSenderProxy::touchCancel):
(WTR::EventSenderProxy::clearTouchPoints):
(WTR::EventSenderProxy::releaseTouchPoint):
(WTR::EventSenderProxy::cancelTouchPoint):
(WTR::viewBackend): Deleted.
(WTR::secToMsTimestamp): Deleted.
(WTR::senderButtonToWPEButton): Deleted.
(WTR::modifierForButton): Deleted.
(WTR::wkEventModifiersToWPE): Deleted.
(WTR::wpeKeySymForKeyRef): Deleted.
(WTR::EventSenderProxy::getUpdatedTouchEvents): Deleted.
(WTR::EventSenderProxy::removeUpdatedTouchEvents): Deleted.
(WTR::EventSenderProxy::prepareAndDispatchTouchEvent): Deleted.
* Tools/WebKitTestRunner/libwpe/PlatformWebViewClient.h: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
(WTR::PlatformWebViewClient::view const):
* Tools/WebKitTestRunner/libwpe/PlatformWebViewClientLibWPE.cpp: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.cpp.
(WTR::PlatformWebViewClientLibWPE::PlatformWebViewClientLibWPE):
(WTR::PlatformWebViewClientLibWPE::~PlatformWebViewClientLibWPE):
(WTR::PlatformWebViewClientLibWPE::addToWindow):
(WTR::PlatformWebViewClientLibWPE::removeFromWindow):
(WTR::PlatformWebViewClientLibWPE::snapshot):
* Tools/WebKitTestRunner/libwpe/PlatformWebViewClientLibWPE.h: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
* Tools/WebKitTestRunner/libwpe/PlatformWebViewLibWPE.cpp:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::addToWindow):
(WTR::PlatformWebView::removeFromWindow):
(WTR::PlatformWebView::windowSnapshotImage):
* Tools/WebKitTestRunner/wpe/EventSenderProxyClientWPE.cpp: Added.
(WTR::EventSenderProxyClientWPE::EventSenderProxyClientWPE):
(WTR::secToMsTimestamp):
(WTR::wkEventModifiersToWPE):
(WTR::eventSenderButtonToWPEButton):
(WTR::modifierForButton):
(WTR::EventSenderProxyClientWPE::mouseDown):
(WTR::EventSenderProxyClientWPE::mouseUp):
(WTR::EventSenderProxyClientWPE::mouseMoveTo):
(WTR::EventSenderProxyClientWPE::mouseScrollBy):
(WTR::wpeKeyvalForKeyRef):
(WTR::EventSenderProxyClientWPE::keyDown):
* Tools/WebKitTestRunner/wpe/EventSenderProxyClientWPE.h: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.
* Tools/WebKitTestRunner/wpe/PlatformWebViewClientWPE.cpp: Added.
(WTR::PlatformWebViewClientWPE::PlatformWebViewClientWPE):
(WTR::PlatformWebViewClientWPE::~PlatformWebViewClientWPE):
(WTR::PlatformWebViewClientWPE::addToWindow):
(WTR::PlatformWebViewClientWPE::removeFromWindow):
(WTR::PlatformWebViewClientWPE::snapshot):
* Tools/WebKitTestRunner/wpe/PlatformWebViewClientWPE.h: Copied from Source/WebKit/UIProcess/API/C/wpe/WKView.h.

Canonical link: https://commits.webkit.org/271330@main
  • Loading branch information
carlosgcampos committed Nov 30, 2023
1 parent 1531d41 commit b12e7ed
Show file tree
Hide file tree
Showing 191 changed files with 20,106 additions and 465 deletions.
2 changes: 2 additions & 0 deletions Source/WebCore/PlatformWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS

platform/glib/ApplicationGLib.h

platform/graphics/gbm/GBMVersioning.h

platform/graphics/wayland/PlatformDisplayWayland.h
)

Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/SourcesWPE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ platform/graphics/wpe/SystemFontDatabaseWPE.cpp

platform/graphics/egl/GLContext.cpp @no-unify
platform/graphics/egl/GLContextLibWPE.cpp @no-unify
platform/graphics/egl/PlatformDisplaySurfaceless.cpp @no-unify

platform/graphics/gbm/GBMBufferSwapchain.cpp
platform/graphics/gbm/GBMDevice.cpp
platform/graphics/gbm/GraphicsContextGLGBM.cpp @no-unify
platform/graphics/gbm/GraphicsContextGLGBMTextureMapper.cpp @no-unify
platform/graphics/gbm/PlatformDisplayGBM.cpp @no-unify

platform/graphics/libwpe/PlatformDisplayLibWPE.cpp

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/platform/Scrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Scrollbar::setShouldUseFixedPixelsPerLineStepForTesting(bool useFixedPixels

int Scrollbar::pixelsPerLineStep(int viewWidthOrHeight)
{
#if PLATFORM(GTK)
#if PLATFORM(GTK) || PLATFORM(WPE)
if (!s_shouldUseFixedPixelsPerLineStepForTesting && viewWidthOrHeight > 0)
return std::pow(viewWidthOrHeight, 2. / 3.);
#else
Expand Down
19 changes: 19 additions & 0 deletions Source/WebCore/platform/graphics/PlatformDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
#include "PlatformDisplayLibWPE.h"
#endif

#if PLATFORM(WPE)
#include "PlatformDisplayGBM.h"
#include "PlatformDisplaySurfaceless.h"
#endif

#if PLATFORM(GTK)
#include "GtkVersioning.h"
#endif
Expand Down Expand Up @@ -118,6 +123,10 @@ typedef EGLBoolean (*PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay, EGLImageKHR);

namespace WebCore {

#if PLATFORM(WPE)
bool PlatformDisplay::s_useDMABufForRendering = false;
#endif

std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
{
#if PLATFORM(GTK)
Expand Down Expand Up @@ -152,6 +161,16 @@ std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
return PlatformDisplayX11::create(nullptr);
#endif

#if PLATFORM(WPE)
if (s_useDMABufForRendering) {
if (GBMDevice::singleton().isInitialized()) {
if (auto* device = GBMDevice::singleton().device())
return PlatformDisplayGBM::create(device);
}
return PlatformDisplaySurfaceless::create();
}
#endif

#if USE(WPE_RENDERER)
return PlatformDisplayLibWPE::create();
#elif PLATFORM(WIN)
Expand Down
8 changes: 8 additions & 0 deletions Source/WebCore/platform/graphics/PlatformDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ class PlatformDisplay {
const String& accessibilityBusAddress() const;
#endif

#if PLATFORM(WPE)
static void setUseDMABufForRendering(bool useDMABufForRendering) { s_useDMABufForRendering = useDMABufForRendering; }
#endif

protected:
PlatformDisplay();
#if PLATFORM(GTK)
Expand Down Expand Up @@ -223,6 +227,10 @@ class PlatformDisplay {
mutable GRefPtr<GstGLDisplay> m_gstGLDisplay;
mutable GRefPtr<GstGLContext> m_gstGLContext;
#endif

#if PLATFORM(WPE)
static bool s_useDMABufForRendering;
#endif
};

} // namespace WebCore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,9 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardsCo

OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys()
{
return { }; // FIXME: Implement.
if (s_currentModifiers)
return *s_currentModifiers;
return { };
}

} // namespace WebCore
Expand Down
23 changes: 23 additions & 0 deletions Source/WebKit/PlatformWPE.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_subdirectory(${WEBKIT_DIR}/WPEPlatform)

include(GNUInstallDirs)
include(GLibMacros)
include(InspectorGResources.cmake)
Expand Down Expand Up @@ -89,13 +91,22 @@ list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
"SourcesWPE.txt"
)

list(APPEND WebKit_SERIALIZATION_IN_FILES Shared/glib/DMABufRendererBufferFormat.serialization.in)

list(APPEND WebCore_SERIALIZATION_IN_FILES SoupNetworkProxySettings.serialization.in)

list(APPEND WebKit_SERIALIZATION_IN_FILES
Shared/glib/DMABufRendererBufferMode.serialization.in
Shared/glib/InputMethodState.serialization.in
Shared/glib/UserMessage.serialization.in
)

list(APPEND WebKit_MESSAGES_IN_FILES
UIProcess/dmabuf/AcceleratedBackingStoreDMABuf

WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf
)

list(APPEND WebKit_DERIVED_SOURCES
${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
${WebKit_DERIVED_SOURCES_DIR}/WebKitDirectoryInputStreamData.cpp
Expand Down Expand Up @@ -349,6 +360,7 @@ list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES
"${DERIVED_SOURCES_WPE_API_DIR}"
"${FORWARDING_HEADERS_WPE_DIR}"
"${FORWARDING_HEADERS_WPE_EXTENSION_DIR}"
"${WPEPlatform_DERIVED_SOURCES_DIR}"
"${WEBKIT_DIR}/NetworkProcess/glib"
"${WEBKIT_DIR}/NetworkProcess/soup"
"${WEBKIT_DIR}/Platform/IPC/glib"
Expand All @@ -363,6 +375,7 @@ list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES
"${WEBKIT_DIR}/Shared/glib"
"${WEBKIT_DIR}/Shared/libwpe"
"${WEBKIT_DIR}/Shared/soup"
"${WEBKIT_DIR}/Shared/wpe"
"${WEBKIT_DIR}/UIProcess/API/C/cairo"
"${WEBKIT_DIR}/UIProcess/API/C/glib"
"${WEBKIT_DIR}/UIProcess/API/C/wpe"
Expand All @@ -380,10 +393,13 @@ list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES
"${WEBKIT_DIR}/UIProcess/linux"
"${WEBKIT_DIR}/UIProcess/soup"
"${WEBKIT_DIR}/UIProcess/wpe"
"${WEBKIT_DIR}/WPEPlatform"
"${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib"
"${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe"
"${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup"
"${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
"${WEBKIT_DIR}/WebProcess/WebPage/dmabuf"
"${WEBKIT_DIR}/WebProcess/WebPage/glib"
"${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
"${WEBKIT_DIR}/WebProcess/WebPage/wpe"
"${WEBKIT_DIR}/WebProcess/glib"
Expand Down Expand Up @@ -449,6 +465,10 @@ if (USE_LIBDRM)
)
endif ()

list(APPEND WebKit_PRIVATE_LIBRARIES
WPEPlatform-${WPE_API_VERSION}
)

list(APPEND WebKit_INTERFACE_INCLUDE_DIRECTORIES
${FORWARDING_HEADERS_WPE_DIR}
${WebKit_DERIVED_SOURCES_DIR}
Expand Down Expand Up @@ -629,10 +649,13 @@ GI_INTROSPECT(WPEWebKit ${WPE_API_VERSION} wpe/webkit.h
SYMBOL_PREFIX webkit
DEPENDENCIES
WPEJavaScriptCore
WPEPlatform
Soup-${SOUP_API_VERSION}:libsoup-${SOUP_API_VERSION}
OPTIONS
-I${JavaScriptCoreGLib_FRAMEWORK_HEADERS_DIR}
-I${JavaScriptCoreGLib_DERIVED_SOURCES_DIR}
-I${WPEPlatform_DERIVED_SOURCES_DIR}
-I${WEBKIT_DIR}/WPEPlatform
SOURCES
${WPE_API_INSTALLED_HEADERS}
Shared/API/glib
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/Scripts/webkit/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def types_that_cannot_be_forward_declared():

def conditions_for_header(header):
conditions = {
'"DMABufRendererBufferFormat.h"': ["USE(GBM)"],
'"GestureTypes.h"': ["PLATFORM(IOS_FAMILY)"],
'"InputMethodState.h"': ["PLATFORM(GTK)", "PLATFORM(WPE)"],
'"RemoteAudioSessionIdentifier.h"': ["ENABLE(GPU_PROCESS) && USE(AUDIO_SESSION)"],
Expand Down
7 changes: 7 additions & 0 deletions Source/WebKit/Shared/NativeWebKeyboardEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ typedef union _GdkEvent GdkEvent;
#endif
#endif

#if PLATFORM(WPE)
typedef struct _WPEEvent WPEEvent;
#endif

#if PLATFORM(IOS_FAMILY)
#include <wtf/RetainPtr.h>
OBJC_CLASS WebEvent;
Expand Down Expand Up @@ -77,6 +81,9 @@ class NativeWebKeyboardEvent : public WebKeyboardEvent {
#elif USE(LIBWPE)
enum class HandledByInputMethod : bool { No, Yes };
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*, const String&, bool isAutoRepeat, HandledByInputMethod, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
#if PLATFORM(WPE)
NativeWebKeyboardEvent(WPEEvent*, const String&, bool isAutoRepeat);
#endif
#elif PLATFORM(WIN)
NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM, Vector<MSG>&& pendingCharEvents);
#endif
Expand Down
7 changes: 7 additions & 0 deletions Source/WebKit/Shared/NativeWebMouseEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ typedef union _GdkEvent GdkEvent;
#endif
#endif

#if PLATFORM(WPE)
typedef struct _WPEEvent WPEEvent;
#endif

#if PLATFORM(IOS_FAMILY)
#include <wtf/RetainPtr.h>
OBJC_CLASS WebEvent;
Expand Down Expand Up @@ -75,6 +79,9 @@ class NativeWebMouseEvent : public WebMouseEvent {
NativeWebMouseEvent(const NativeWebMouseEvent&, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ);
#elif USE(LIBWPE)
NativeWebMouseEvent(struct wpe_input_pointer_event*, float deviceScaleFactor, WebMouseEventSyntheticClickType = WebMouseEventSyntheticClickType::NoTap);
#if PLATFORM(WPE)
explicit NativeWebMouseEvent(WPEEvent*);
#endif
#elif PLATFORM(WIN)
NativeWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool);
#endif
Expand Down
7 changes: 7 additions & 0 deletions Source/WebKit/Shared/NativeWebTouchEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include <wpe/wpe.h>
#endif

#if PLATFORM(WPE)
typedef struct _WPEEvent WPEEvent;
#endif

#endif // ENABLE(TOUCH_EVENTS)

namespace WebKit {
Expand All @@ -63,6 +67,9 @@ class NativeWebTouchEvent : public WebTouchEvent {
#elif USE(LIBWPE)
NativeWebTouchEvent(struct wpe_input_touch_event*, float deviceScaleFactor);
const struct wpe_input_touch_event_raw* nativeFallbackTouchPoint() const { return &m_fallbackTouchPoint; }
#if PLATFORM(WPE)
NativeWebTouchEvent(WPEEvent*, Vector<WebPlatformTouchPoint>&&);
#endif
#elif PLATFORM(WIN)
NativeWebTouchEvent();
#endif
Expand Down
8 changes: 8 additions & 0 deletions Source/WebKit/Shared/NativeWebWheelEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ typedef union _GdkEvent GdkEvent;
#endif
#endif

#if PLATFORM(WPE)
typedef struct _WPEEvent WPEEvent;
#endif

#if USE(LIBWPE)
struct wpe_input_axis_event;
#endif
Expand All @@ -62,6 +66,10 @@ class NativeWebWheelEvent : public WebWheelEvent {
NativeWebWheelEvent(GdkEvent*, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, WebWheelEvent::Phase, WebWheelEvent::Phase momentumPhase, bool hasPreciseDeltas = false);
#elif USE(LIBWPE)
NativeWebWheelEvent(struct wpe_input_axis_event*, float deviceScaleFactor, WebWheelEvent::Phase, WebWheelEvent::Phase momentumPhase);
#if PLATFORM(WPE)
explicit NativeWebWheelEvent(WPEEvent*);
#endif

#elif PLATFORM(WIN)
NativeWebWheelEvent(HWND, UINT message, WPARAM, LPARAM);
#endif
Expand Down
8 changes: 8 additions & 0 deletions Source/WebKit/Shared/WebKeyboardEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class WebKeyboardEvent : public WebEvent {

static bool isKeyboardEventType(WebEventType);

#if PLATFORM(WPE)
static String keyValueStringForWPEKeyval(unsigned);
static String keyCodeStringForWPEKeycode(unsigned);
static String keyIdentifierForWPEKeyval(unsigned);
static int32_t windowsKeyCodeForWPEKeyval(unsigned);
static String singleCharacterStringForWPEKeyval(unsigned);
#endif

private:
String m_text;
String m_unmodifiedText;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/Shared/WebPageCreationParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#include "WebExtensionControllerParameters.h"
#endif

#if PLATFORM(GTK) && USE(GBM)
#if (PLATFORM(GTK) || PLATFORM(WPE)) && USE(GBM)
#include "DMABufRendererBufferFormat.h"
#endif

Expand Down Expand Up @@ -313,7 +313,7 @@ struct WebPageCreationParameters {
SandboxExtension::Handle machBootstrapHandle;
#endif

#if PLATFORM(GTK) && USE(GBM)
#if (PLATFORM(GTK) || PLATFORM(WPE)) && USE(GBM)
Vector<DMABufRendererBufferFormat> preferredBufferFormats;
#endif
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ headers: "ArgumentCoders.h"
WebKit::SandboxExtension::Handle machBootstrapHandle;
#endif

#if PLATFORM(GTK) && USE(GBM)
#if (PLATFORM(GTK) || PLATFORM(WPE)) && USE(GBM)
Vector<WebKit::DMABufRendererBufferFormat> preferredBufferFormats;
#endif
}
Expand Down
7 changes: 5 additions & 2 deletions Source/WebKit/Shared/WebProcessCreationParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
#endif

#if PLATFORM(GTK) || PLATFORM(WPE)
#include "DMABufRendererBufferMode.h"
#include <wtf/MemoryPressureHandler.h>
#endif

#if PLATFORM(GTK)
#include "DMABufRendererBufferMode.h"
#include "GtkSettingsState.h"
#endif

Expand Down Expand Up @@ -230,8 +230,11 @@ struct WebProcessCreationParameters {
String renderDeviceFile;
#endif

#if PLATFORM(GTK)
#if PLATFORM(GTK) || PLATFORM(WPE)
OptionSet<DMABufRendererBufferMode> dmaBufRendererBufferMode;
#endif

#if PLATFORM(GTK)
bool useSystemAppearanceForScrollbars { false };
GtkSettingsState gtkSettings;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@
String renderDeviceFile;
#endif

#if PLATFORM(GTK)
#if PLATFORM(GTK) || PLATFORM(WPE)
OptionSet<WebKit::DMABufRendererBufferMode> dmaBufRendererBufferMode;
#endif

#if PLATFORM(GTK)
bool useSystemAppearanceForScrollbars;
WebKit::GtkSettingsState gtkSettings;
#endif
Expand Down
13 changes: 13 additions & 0 deletions Source/WebKit/Shared/libwpe/WebEventFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ struct wpe_input_pointer_event;
struct wpe_input_touch_event;
#endif

#if PLATFORM(WPE)
typedef struct _WPEEvent WPEEvent;
#endif

namespace WebKit {

class WebEventFactory {
Expand All @@ -50,6 +54,15 @@ class WebEventFactory {
#if ENABLE(TOUCH_EVENTS)
static WebTouchEvent createWebTouchEvent(struct wpe_input_touch_event*, float deviceScaleFactor);
#endif

#if PLATFORM(WPE)
static WebMouseEvent createWebMouseEvent(WPEEvent*);
static WebWheelEvent createWebWheelEvent(WPEEvent*);
static WebKeyboardEvent createWebKeyboardEvent(WPEEvent*, const String&, bool isAutoRepeat);
#if ENABLE(TOUCH_EVENTS)
static WebTouchEvent createWebTouchEvent(WPEEvent*, Vector<WebPlatformTouchPoint>&&);
#endif
#endif
};

} // namespace WebKit

0 comments on commit b12e7ed

Please sign in to comment.