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.
This commit is contained in:
parent
6fb8500a7a
commit
dc188329df
Notes:
github-actions[bot]
2024-11-03 17:08:38 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/dc188329df2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2137
1 changed files with 5 additions and 3 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Time.h>
|
||||
|
@ -118,8 +117,11 @@ struct ActionObject {
|
|||
|
||||
// https://w3c.github.io/webdriver/#dfn-actions-options
|
||||
struct ActionsOptions {
|
||||
Function<bool(JsonObject const&)> is_element_origin;
|
||||
Function<ErrorOr<JS::NonnullGCPtr<DOM::Element>, WebDriver::Error>(HTML::BrowsingContext const&, StringView)> get_element_origin;
|
||||
using IsElementOrigin = bool (*)(JsonValue const&);
|
||||
using GetElementOrigin = ErrorOr<JS::NonnullGCPtr<DOM::Element>, WebDriver::Error> (*)(HTML::BrowsingContext const&, StringView);
|
||||
|
||||
IsElementOrigin is_element_origin { nullptr };
|
||||
GetElementOrigin get_element_origin { nullptr };
|
||||
};
|
||||
|
||||
using OnActionsComplete = JS::NonnullGCPtr<JS::HeapFunction<void(Web::WebDriver::Response)>>;
|
||||
|
|
Loading…
Add table
Reference in a new issue