Skip to content

Truly independent web browser

LibWebCommon: Validate event types and accessibility states over IPC

Andreas Kling94d64060d33f
diff --git a/Libraries/LibWebCommon/Forward.h b/Libraries/LibWebCommon/Forward.h
index dabf97a3d89..54fe66a70d4 100644
--- a/Libraries/LibWebCommon/Forward.h
+++ b/Libraries/LibWebCommon/Forward.h
@@ -8,6 +8,8 @@
#include <AK/DistinctNumeric.h>
#include <AK/Types.h>
+#include <LibIPC/Forward.h>
+#include <LibWebCommon/Export.h>
namespace Web {
@@ -136,3 +138,21 @@ struct Mutation;
struct ProcessHandle;
}
+
+// NB: These enums are complete types here, so a file can encode one without seeing the header that defines it. Their
+// generated codecs are declared here as well, so that such a file uses them and not LibIPC's codec for any enum.
+namespace IPC {
+
+template<>
+WEBCOMMON_API ErrorOr<void> encode(Encoder&, Web::ScrollGesturePhase const&);
+
+template<>
+WEBCOMMON_API ErrorOr<Web::ScrollGesturePhase> decode(Decoder&);
+
+template<>
+WEBCOMMON_API ErrorOr<void> encode(Encoder&, Web::WheelDeltaPrecision const&);
+
+template<>
+WEBCOMMON_API ErrorOr<Web::WheelDeltaPrecision> decode(Decoder&);
+
+}
diff --git a/Libraries/LibWebCommon/Page/InputEvent.ipc b/Libraries/LibWebCommon/Page/InputEvent.ipc
index 3f138c19de2..2f9c62f88bf 100644
--- a/Libraries/LibWebCommon/Page/InputEvent.ipc
+++ b/Libraries/LibWebCommon/Page/InputEvent.ipc
@@ -5,6 +5,36 @@
#include <LibWebCommon/Page/InputEvent.h>
+[ExistingCpp]
+enum Web::KeyEvent::Type : u8 {
+ KeyDown,
+ KeyUp,
+}
+
+[ExistingCpp]
+enum Web::MouseEvent::Type : u8 {
+ MouseDown,
+ MouseUp,
+ MouseMove,
+ MouseLeave,
+ MouseCancel,
+ MouseWheel,
+}
+
+[ExistingCpp]
+enum Web::WheelDeltaPrecision : u8 {
+ Discrete,
+ Precise,
+}
+
+[ExistingCpp]
+enum Web::ScrollGesturePhase : u8 {
+ None,
+ Ongoing,
+ Momentum,
+ Ended,
+}
+
[ExistingCpp]
struct Web::KeyEvent {
Web::KeyEvent::Type type;
diff --git a/Libraries/LibWebCommon/WebView/AccessibilityNodeData.ipc b/Libraries/LibWebCommon/WebView/AccessibilityNodeData.ipc
index ad682c650ec..917dd551dd1 100644
--- a/Libraries/LibWebCommon/WebView/AccessibilityNodeData.ipc
+++ b/Libraries/LibWebCommon/WebView/AccessibilityNodeData.ipc
@@ -5,6 +5,29 @@
#include <LibWebCommon/WebView/AccessibilityNodeData.h>
+[ExistingCpp]
+enum WebView::AccessibilityNodeData::CheckedState : u8 {
+ NotApplicable,
+ Unchecked,
+ Checked,
+ Mixed,
+}
+
+[ExistingCpp]
+enum WebView::AccessibilityNodeData::ExpandedState : u8 {
+ NotApplicable,
+ Collapsed,
+ Expanded,
+}
+
+[ExistingCpp]
+enum WebView::AccessibilityNodeData::PressedState : u8 {
+ NotApplicable,
+ NotPressed,
+ Pressed,
+ Mixed,
+}
+
[ExistingCpp]
struct WebView::AccessibilityNodeData {
i64 id;