From dc188329df2077ccc4e248ba9971f02b3574fba6 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 2 Nov 2024 21:12:52 -0400 Subject: [PATCH] LibWeb: Use C-style function pointers for ActionsOptions callbacks This is a bit unfortunate, but if a function provided to this struct is overloaded, the C++ compiler cannot distinguish which overload should be assigned to the Function object. This is explained in detail here: https://stackoverflow.com/a/30394755 C-style function pointers do work, however, and are fine here because we only ever assign global free functions to these members. --- Userland/Libraries/LibWeb/WebDriver/Actions.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/WebDriver/Actions.h b/Userland/Libraries/LibWeb/WebDriver/Actions.h index c2c775ba08c..3e93ff2ab76 100644 --- a/Userland/Libraries/LibWeb/WebDriver/Actions.h +++ b/Userland/Libraries/LibWeb/WebDriver/Actions.h @@ -6,7 +6,6 @@ #pragma once -#include #include #include #include @@ -118,8 +117,11 @@ struct ActionObject { // https://w3c.github.io/webdriver/#dfn-actions-options struct ActionsOptions { - Function is_element_origin; - Function, WebDriver::Error>(HTML::BrowsingContext const&, StringView)> get_element_origin; + using IsElementOrigin = bool (*)(JsonValue const&); + using GetElementOrigin = ErrorOr, WebDriver::Error> (*)(HTML::BrowsingContext const&, StringView); + + IsElementOrigin is_element_origin { nullptr }; + GetElementOrigin get_element_origin { nullptr }; }; using OnActionsComplete = JS::NonnullGCPtr>;