Skip to content

Commit ba76fcf

Browse files
committed
[WPE] Add build option ENABLE_WPE_LEGACY_API
https://bugs.webkit.org/show_bug.cgi?id=304237 Reviewed by Alejandro G. Castro. Enabled by default, but allows to build without the legacy api. Canonical link: https://commits.webkit.org/304671@main
1 parent e935d39 commit ba76fcf

File tree

73 files changed

+418
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+418
-129
lines changed

‎Source/WebCore/PlatformWPE.cmake‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ list(APPEND WebCore_PRIVATE_LIBRARIES
7777

7878
list(APPEND WebCore_LIBRARIES
7979
GLib::Module
80-
WPE::libwpe
8180
${UPOWERGLIB_LIBRARIES}
8281
)
8382

83+
if (ENABLE_WPE_LEGACY_API)
84+
list(APPEND WebCore_LIBRARIES WPE::libwpe)
85+
endif ()
86+
8487
list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
8588
${UPOWERGLIB_INCLUDE_DIRS}
8689
)

‎Source/WebCore/platform/PlatformKeyboardEvent.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ void PlatformKeyboardEvent::setCurrentModifierState(OptionSet<Modifier> modifier
6060
s_currentModifiers = modifiers;
6161
}
6262

63+
#if PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
64+
OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys()
65+
{
66+
if (s_currentModifiers)
67+
return *s_currentModifiers;
68+
return { };
69+
}
70+
#endif
71+
6372
struct KeyEventData {
6473
String text;
6574
int keyCode { 0 };

‎Source/WebCore/platform/PlatformKeyboardEvent.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ namespace WebCore {
9595
void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
9696
int windowsVirtualKeyCodeWithoutKeyPressOverride() const { return m_windowsVirtualKeyCode; }
9797

98-
#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
98+
#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
9999
bool handledByInputMethod() const { return m_handledByInputMethod; }
100100
#endif
101-
#if PLATFORM(GTK) || USE(LIBWPE)
101+
#if PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
102102
const std::optional<Vector<WebCore::CompositionUnderline>>& preeditUnderlines() const { return m_preeditUnderlines; }
103103
const std::optional<uint64_t>& preeditSelectionRangeStart() const { return m_preeditSelectionRangeStart; }
104104
const std::optional<uint64_t>& preeditSelectionRangeLength() const { return m_preeditSelectionRangeLength; }
@@ -150,10 +150,10 @@ namespace WebCore {
150150
int m_windowsVirtualKeyCode { 0 };
151151

152152
bool m_isSyntheticEvent { false };
153-
#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
153+
#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
154154
bool m_handledByInputMethod { false };
155155
#endif
156-
#if PLATFORM(GTK) || USE(LIBWPE)
156+
#if PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
157157
std::optional<Vector<WebCore::CompositionUnderline>> m_preeditUnderlines;
158158
std::optional<uint64_t> m_preeditSelectionRangeStart;
159159
std::optional<uint64_t> m_preeditSelectionRangeLength;

‎Source/WebCore/platform/StaticPasteboard.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void StaticPasteboard::write(const PasteboardWebContent& content)
148148
#if PLATFORM(COCOA)
149149
markup = content.dataInHTMLFormat;
150150
text = content.dataInStringFormat;
151-
#elif PLATFORM(GTK) || USE(LIBWPE)
151+
#elif PLATFORM(GTK) || USE(LIBWPE) || ENABLE(WPE_PLATFORM)
152152
markup = content.markup;
153153
text = content.text;
154154
#else

‎Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,4 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom
5050
}
5151
}
5252

53-
OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys()
54-
{
55-
if (s_currentModifiers)
56-
return *s_currentModifiers;
57-
58-
return { };
59-
}
60-
6153
} // namespace WebCore

‎Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@
2727
#include "PlatformKeyboardEvent.h"
2828

2929
#if USE(LIBWPE)
30-
3130
#include "WindowsKeyboardCodes.h"
3231
#include <wpe/wpe.h>
3332
#include <wtf/HexNumber.h>
3433
#include <wtf/text/MakeString.h>
3534
#include <wtf/text/StringBuilder.h>
35+
#endif
3636

3737
namespace WebCore {
3838

39+
#if USE(LIBWPE)
3940
// FIXME: This is incomplete. We should change this to mirror
4041
// more like what Firefox does, and generate these switch statements
4142
// at build time.
@@ -1324,6 +1325,7 @@ String PlatformKeyboardEvent::singleCharacterString(unsigned val)
13241325

13251326
return { };
13261327
}
1328+
#endif // USE(LIBWPE)
13271329

13281330
void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardsCompatibility)
13291331
{
@@ -1340,13 +1342,4 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardsCo
13401342
}
13411343
}
13421344

1343-
OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys()
1344-
{
1345-
if (s_currentModifiers)
1346-
return *s_currentModifiers;
1347-
return { };
1348-
}
1349-
13501345
} // namespace WebCore
1351-
1352-
#endif // USE(LIBWPE)

‎Source/WebKit/PlatformWPE.cmake‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DIR})
2525
file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_EXTENSION_DIR})
2626
file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_JSC_DIR})
2727

28+
if (ENABLE_WPE_LEGACY_API)
29+
set(LIBWPE_PC_REQUIRES wpe-1.0)
30+
set(LIBWPE_PC_UNINSTALLED_REQUIRES wpe-1.0)
31+
endif ()
32+
2833
if (ENABLE_WPE_PLATFORM)
2934
set(WPE_PLATFORM_PC_REQUIRES wpe-platform-${WPE_API_VERSION})
3035
set(WPE_PLATFORM_PC_UNINSTALLED_REQUIRES wpe-platform-${WPE_API_VERSION}-uninstalled)
@@ -249,9 +254,14 @@ set(WPE_API_INSTALLED_HEADERS
249254
${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h
250255
${WEBKIT_DIR}/UIProcess/API/wpe/WebKitColor.h
251256
${WEBKIT_DIR}/UIProcess/API/wpe/WebKitRectangle.h
252-
${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
253257
)
254258

259+
if (ENABLE_WPE_LEGACY_API)
260+
list(APPEND WPE_API_INSTALLED_HEADERS
261+
${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
262+
)
263+
endif ()
264+
255265
set(WPE_WEB_PROCESS_EXTENSION_API_INSTALLED_HEADERS
256266
${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
257267
)
@@ -458,9 +468,12 @@ list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES
458468
list(APPEND WebKit_LIBRARIES
459469
GLib::Module
460470
Soup3::Soup3
461-
WPE::libwpe
462471
)
463472

473+
if (ENABLE_WPE_LEGACY_API)
474+
list(APPEND WebKit_LIBRARIES WPE::libwpe)
475+
endif ()
476+
464477
if (ANDROID)
465478
list(APPEND WebKit_PRIVATE_LIBRARIES intl)
466479
endif ()
@@ -757,7 +770,6 @@ set(WPE_SOURCES_FOR_INTROSPECTION
757770
UIProcess/API/wpe/WebKitColor.cpp
758771
UIProcess/API/wpe/WebKitInputMethodContextWPE.cpp
759772
UIProcess/API/wpe/WebKitRectangle.cpp
760-
UIProcess/API/wpe/WebKitWebViewBackend.cpp
761773
UIProcess/API/wpe/WebKitWebViewWPE.cpp
762774
)
763775

@@ -777,6 +789,12 @@ set(WPE_INCLUDE_DIRS_FOR_INTROSPECTION
777789
-I${JavaScriptCoreGLib_DERIVED_SOURCES_DIR}
778790
)
779791

792+
if (ENABLE_WPE_LEGACY_API)
793+
list(APPEND WPE_SOURCES_FOR_INTROSPECTION
794+
UIProcess/API/wpe/WebKitWebViewBackend.cpp
795+
)
796+
endif ()
797+
780798
if (ENABLE_WPE_PLATFORM)
781799
list(APPEND WPE_LIBRARIES_FOR_INTROSPECTION WPEPlatform)
782800

‎Source/WebKit/Shared/NativeWebKeyboardEvent.h‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ class NativeWebKeyboardEvent : public WebKeyboardEvent {
7878
#elif PLATFORM(IOS_FAMILY)
7979
enum class HandledByInputMethod : bool { No, Yes };
8080
NativeWebKeyboardEvent(::WebEvent *, HandledByInputMethod);
81-
#elif USE(LIBWPE)
81+
#elif PLATFORM(WPE)
82+
#if USE(LIBWPE)
8283
enum class HandledByInputMethod : bool { No, Yes };
8384
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*, const String&, bool isAutoRepeat, HandledByInputMethod, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
84-
#if PLATFORM(WPE) && ENABLE(WPE_PLATFORM)
85+
#endif
86+
#if ENABLE(WPE_PLATFORM)
8587
NativeWebKeyboardEvent(WPEEvent*, const String&, bool isAutoRepeat);
8688
NativeWebKeyboardEvent(const String&, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
8789
#endif
90+
#elif PLATFORM(PLAYSTATION)
91+
enum class HandledByInputMethod : bool { No, Yes };
92+
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*, const String&, bool isAutoRepeat, HandledByInputMethod, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
8893
#elif PLATFORM(WIN)
8994
NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM, Vector<MSG>&& pendingCharEvents);
9095
#endif

‎Source/WebKit/Shared/NativeWebMouseEvent.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ class NativeWebMouseEvent : public WebMouseEvent {
7878
NativeWebMouseEvent(::WebEvent *);
7979
NativeWebMouseEvent(WebEventType, WebMouseEventButton, unsigned short buttons, const WebCore::DoublePoint& position, const WebCore::DoublePoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<WebEventModifier>, MonotonicTime timestamp, double force, GestureWasCancelled, const String& pointerType);
8080
NativeWebMouseEvent(const NativeWebMouseEvent&, const WebCore::DoublePoint& position, const WebCore::DoublePoint& globalPosition, float deltaX, float deltaY, float deltaZ);
81-
#elif USE(LIBWPE)
81+
#elif PLATFORM(WPE)
82+
#if USE(LIBWPE)
8283
NativeWebMouseEvent(struct wpe_input_pointer_event*, float deviceScaleFactor, WebMouseEventSyntheticClickType = WebMouseEventSyntheticClickType::NoTap);
83-
#if PLATFORM(WPE) && ENABLE(WPE_PLATFORM)
84+
#endif
85+
#if ENABLE(WPE_PLATFORM)
8486
explicit NativeWebMouseEvent(WPEEvent*);
8587
#endif
88+
#elif PLATFORM(PLAYSTATION)
89+
NativeWebMouseEvent(struct wpe_input_pointer_event*, float deviceScaleFactor, WebMouseEventSyntheticClickType = WebMouseEventSyntheticClickType::NoTap);
8690
#elif PLATFORM(WIN)
8791
NativeWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool, float deviceScaleFactor);
8892
#endif

‎Source/WebKit/Shared/NativeWebWheelEvent.h‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ class NativeWebWheelEvent : public WebWheelEvent {
6565
#elif PLATFORM(GTK)
6666
NativeWebWheelEvent(const NativeWebWheelEvent&);
6767
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);
68-
#elif USE(LIBWPE)
68+
#elif PLATFORM(WPE)
69+
#if USE(LIBWPE)
6970
NativeWebWheelEvent(struct wpe_input_axis_event*, float deviceScaleFactor, WebWheelEvent::Phase, WebWheelEvent::Phase momentumPhase);
70-
#if PLATFORM(WPE) && ENABLE(WPE_PLATFORM)
71+
#endif
72+
#if ENABLE(WPE_PLATFORM)
7173
explicit NativeWebWheelEvent(WPEEvent*);
7274
NativeWebWheelEvent(WPEEvent*, WebWheelEvent::Phase);
7375
#endif
74-
76+
#elif PLATFORM(PLAYSTATION)
77+
NativeWebWheelEvent(struct wpe_input_axis_event*, float deviceScaleFactor, WebWheelEvent::Phase, WebWheelEvent::Phase momentumPhase);
7578
#elif PLATFORM(WIN)
7679
NativeWebWheelEvent(HWND, UINT message, WPARAM, LPARAM, float deviceScaleFactor);
7780
#endif

0 commit comments

Comments
 (0)