diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventHandler.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventHandler.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/MessagePort.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/MessagePort.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Window.cpp | 58 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Window.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Worker.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Worker.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h | 6 |
14 files changed, 81 insertions, 81 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/EventHandler.cpp b/Userland/Libraries/LibWeb/HTML/EventHandler.cpp index 612df30041..230d94e1d2 100644 --- a/Userland/Libraries/LibWeb/HTML/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventHandler.cpp @@ -15,7 +15,7 @@ EventHandler::EventHandler(String s) { } -EventHandler::EventHandler(Bindings::CallbackType& c) +EventHandler::EventHandler(WebIDL::CallbackType& c) : value(&c) { } @@ -25,7 +25,7 @@ void EventHandler::visit_edges(Cell::Visitor& visitor) Cell::visit_edges(visitor); visitor.visit(listener); - if (auto* callback = value.get_pointer<Bindings::CallbackType*>()) + if (auto* callback = value.get_pointer<WebIDL::CallbackType*>()) visitor.visit(*callback); } diff --git a/Userland/Libraries/LibWeb/HTML/EventHandler.h b/Userland/Libraries/LibWeb/HTML/EventHandler.h index a7be161c6e..3014aceac8 100644 --- a/Userland/Libraries/LibWeb/HTML/EventHandler.h +++ b/Userland/Libraries/LibWeb/HTML/EventHandler.h @@ -9,21 +9,21 @@ #include <AK/String.h> #include <AK/Variant.h> #include <LibJS/Heap/Cell.h> -#include <LibWeb/Bindings/CallbackType.h> +#include <LibWeb/WebIDL/CallbackType.h> namespace Web::HTML { class EventHandler final : public JS::Cell { public: explicit EventHandler(String); - explicit EventHandler(Bindings::CallbackType&); + explicit EventHandler(WebIDL::CallbackType&); // Either uncompiled source code or a callback. // https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-value // NOTE: This does not contain Empty as part of the optimization of not allocating all event handler attributes up front. // FIXME: The string should actually be an "internal raw uncompiled handler" struct. This struct is just the uncompiled source code plus a source location for reporting parse errors. // https://html.spec.whatwg.org/multipage/webappapis.html#internal-raw-uncompiled-handler - Variant<String, Bindings::CallbackType*> value; + Variant<String, WebIDL::CallbackType*> value; // https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-listener DOM::DOMEventListener* listener { nullptr }; diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp index 76eb8c2edb..8bef4f4d21 100644 --- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp +++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp @@ -13,11 +13,11 @@ namespace Web::HTML { #undef __ENUMERATE #define __ENUMERATE(attribute_name, event_name) \ - void GlobalEventHandlers::set_##attribute_name(Bindings::CallbackType* value) \ + void GlobalEventHandlers::set_##attribute_name(WebIDL::CallbackType* value) \ { \ global_event_handlers_to_event_target(event_name).set_event_handler_attribute(event_name, value); \ } \ - Bindings::CallbackType* GlobalEventHandlers::attribute_name() \ + WebIDL::CallbackType* GlobalEventHandlers::attribute_name() \ { \ return global_event_handlers_to_event_target(event_name).event_handler_attribute(event_name); \ } diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h index 11c99dddee..23c1908be2 100644 --- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h +++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h @@ -84,9 +84,9 @@ public: virtual ~GlobalEventHandlers(); #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void set_##attribute_name(Bindings::CallbackType*); \ - Bindings::CallbackType* attribute_name(); +#define __ENUMERATE(attribute_name, event_name) \ + void set_##attribute_name(WebIDL::CallbackType*); \ + WebIDL::CallbackType* attribute_name(); ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp index aceb172125..7774931e9c 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp @@ -112,14 +112,14 @@ void MessagePort::close() } #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void MessagePort::set_##attribute_name(Bindings::CallbackType* value) \ - { \ - set_event_handler_attribute(event_name, value); \ - } \ - Bindings::CallbackType* MessagePort::attribute_name() \ - { \ - return event_handler_attribute(event_name); \ +#define __ENUMERATE(attribute_name, event_name) \ + void MessagePort::set_##attribute_name(WebIDL::CallbackType* value) \ + { \ + set_event_handler_attribute(event_name, value); \ + } \ + WebIDL::CallbackType* MessagePort::attribute_name() \ + { \ + return event_handler_attribute(event_name); \ } ENUMERATE_MESSAGE_PORT_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.h b/Userland/Libraries/LibWeb/HTML/MessagePort.h index 53b61eaac6..6a6b1334fc 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.h +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.h @@ -37,9 +37,9 @@ public: void close(); #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void set_##attribute_name(Bindings::CallbackType*); \ - Bindings::CallbackType* attribute_name(); +#define __ENUMERATE(attribute_name, event_name) \ + void set_##attribute_name(WebIDL::CallbackType*); \ + WebIDL::CallbackType* attribute_name(); ENUMERATE_MESSAGE_PORT_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 7f5bb6396c..a118896283 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -213,7 +213,7 @@ i32 Window::run_timer_initialization_steps(TimerHandler handler, i32 timeout, JS handler.visit( // 2. If handler is a Function, then invoke handler given arguments with the callback this value set to thisArg. If this throws an exception, catch it, and report the exception. - [&](JS::Handle<Bindings::CallbackType> callback) { + [&](JS::Handle<WebIDL::CallbackType> callback) { if (auto result = Bindings::IDL::invoke_callback(*callback, window.ptr(), arguments); result.is_error()) HTML::report_exception(result); }, @@ -277,7 +277,7 @@ i32 Window::run_timer_initialization_steps(TimerHandler handler, i32 timeout, JS } // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#run-the-animation-frame-callbacks -i32 Window::request_animation_frame_impl(Bindings::CallbackType& js_callback) +i32 Window::request_animation_frame_impl(WebIDL::CallbackType& js_callback) { return m_animation_frame_callback_driver.add([this, js_callback = JS::make_handle(js_callback)](auto) mutable { // 3. Invoke callback, passing now as the only argument, @@ -506,7 +506,7 @@ void Window::fire_a_page_transition_event(FlyString const& event_name, bool pers } // https://html.spec.whatwg.org/#dom-queuemicrotask -void Window::queue_microtask_impl(Bindings::CallbackType& callback) +void Window::queue_microtask_impl(WebIDL::CallbackType& callback) { // The queueMicrotask(callback) method must queue a microtask to invoke callback, HTML::queue_a_microtask(&associated_document(), [&callback]() mutable { @@ -686,7 +686,7 @@ void Window::invoke_idle_callbacks() } // https://w3c.github.io/requestidlecallback/#the-requestidlecallback-method -u32 Window::request_idle_callback_impl(Bindings::CallbackType& callback) +u32 Window::request_idle_callback_impl(WebIDL::CallbackType& callback) { // 1. Let window be this Window object. auto& window = *this; @@ -696,7 +696,7 @@ u32 Window::request_idle_callback_impl(Bindings::CallbackType& callback) auto handle = window.m_idle_callback_identifier; // 4. Push callback to the end of window's list of idle request callbacks, associated with handle. auto handler = [callback = JS::make_handle(callback)](JS::NonnullGCPtr<RequestIdleCallback::IdleDeadline> deadline) -> JS::Completion { - return Bindings::IDL::invoke_callback(const_cast<Bindings::CallbackType&>(*callback), {}, deadline.ptr()); + return Bindings::IDL::invoke_callback(const_cast<WebIDL::CallbackType&>(*callback), {}, deadline.ptr()); }; window.m_idle_request_callbacks.append(adopt_ref(*new IdleCallback(move(handler), handle))); // 5. Return handle and then continue running this algorithm asynchronously. @@ -914,7 +914,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::prompt) static JS::ThrowCompletionOr<TimerHandler> make_timer_handler(JS::VM& vm, JS::Value handler) { if (handler.is_function()) - return JS::make_handle(vm.heap().allocate_without_realm<Bindings::CallbackType>(handler.as_function(), HTML::incumbent_settings_object())); + return JS::make_handle(vm.heap().allocate_without_realm<WebIDL::CallbackType>(handler.as_function(), HTML::incumbent_settings_object())); return TRY(handler.to_string(vm)); } @@ -996,7 +996,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_animation_frame) auto* callback_object = TRY(vm.argument(0).to_object(vm)); if (!callback_object->is_function()) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam); - auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object()); + auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object()); return JS::Value(impl->request_animation_frame_impl(*callback)); } @@ -1019,7 +1019,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::queue_microtask) if (!callback_object->is_function()) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam); - auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object()); + auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object()); impl->queue_microtask_impl(*callback); return JS::js_undefined(); @@ -1035,7 +1035,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_idle_callback) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam); // FIXME: accept options object - auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object()); + auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object()); return JS::Value(impl->request_idle_callback_impl(*callback)); } @@ -1461,26 +1461,26 @@ JS_DEFINE_NATIVE_FUNCTION(Window::name_setter) return JS::js_undefined(); } -#define __ENUMERATE(attribute, event_name) \ - JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_getter) \ - { \ - auto* impl = TRY(impl_from(vm)); \ - auto retval = impl->attribute(); \ - if (!retval) \ - return JS::js_null(); \ - return &retval->callback; \ - } \ - JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_setter) \ - { \ - auto* impl = TRY(impl_from(vm)); \ - auto value = vm.argument(0); \ - Bindings::CallbackType* cpp_value = nullptr; \ - if (value.is_object()) { \ - cpp_value = vm.heap().allocate_without_realm<Bindings::CallbackType>( \ - value.as_object(), HTML::incumbent_settings_object()); \ - } \ - impl->set_##attribute(cpp_value); \ - return JS::js_undefined(); \ +#define __ENUMERATE(attribute, event_name) \ + JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_getter) \ + { \ + auto* impl = TRY(impl_from(vm)); \ + auto retval = impl->attribute(); \ + if (!retval) \ + return JS::js_null(); \ + return &retval->callback; \ + } \ + JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_setter) \ + { \ + auto* impl = TRY(impl_from(vm)); \ + auto value = vm.argument(0); \ + WebIDL::CallbackType* cpp_value = nullptr; \ + if (value.is_object()) { \ + cpp_value = vm.heap().allocate_without_realm<WebIDL::CallbackType>( \ + value.as_object(), HTML::incumbent_settings_object()); \ + } \ + impl->set_##attribute(cpp_value); \ + return JS::js_undefined(); \ } ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE) ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE) diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index 85a50d2213..16e0799415 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -25,7 +25,7 @@ namespace Web::HTML { class IdleCallback; // https://html.spec.whatwg.org/#timerhandler -using TimerHandler = Variant<JS::Handle<Bindings::CallbackType>, String>; +using TimerHandler = Variant<JS::Handle<WebIDL::CallbackType>, String>; class Window final : public DOM::EventTarget @@ -57,7 +57,7 @@ public: void alert_impl(String const&); bool confirm_impl(String const&); String prompt_impl(String const&, String const&); - i32 request_animation_frame_impl(Bindings::CallbackType& js_callback); + i32 request_animation_frame_impl(WebIDL::CallbackType& js_callback); void cancel_animation_frame_impl(i32); bool has_animation_frame_callbacks() const { return m_animation_frame_callback_driver.has_callbacks(); } @@ -66,7 +66,7 @@ public: void clear_timeout_impl(i32); void clear_interval_impl(i32); - void queue_microtask_impl(Bindings::CallbackType& callback); + void queue_microtask_impl(WebIDL::CallbackType& callback); int inner_width() const; int inner_height() const; @@ -115,7 +115,7 @@ public: void start_an_idle_period(); - u32 request_idle_callback_impl(Bindings::CallbackType& callback); + u32 request_idle_callback_impl(WebIDL::CallbackType& callback); void cancel_idle_callback_impl(u32); AnimationFrameCallbackDriver& animation_frame_callback_driver() { return m_animation_frame_callback_driver; } diff --git a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp index b33318e45d..c80c4847c3 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp @@ -12,11 +12,11 @@ namespace Web::HTML { #undef __ENUMERATE #define __ENUMERATE(attribute_name, event_name) \ - void WindowEventHandlers::set_##attribute_name(Bindings::CallbackType* value) \ + void WindowEventHandlers::set_##attribute_name(WebIDL::CallbackType* value) \ { \ window_event_handlers_to_event_target().set_event_handler_attribute(event_name, value); \ } \ - Bindings::CallbackType* WindowEventHandlers::attribute_name() \ + WebIDL::CallbackType* WindowEventHandlers::attribute_name() \ { \ return window_event_handlers_to_event_target().event_handler_attribute(event_name); \ } diff --git a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h index a6d0009b7a..e5e8ce5f75 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h +++ b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h @@ -34,9 +34,9 @@ public: virtual ~WindowEventHandlers(); #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void set_##attribute_name(Bindings::CallbackType*); \ - Bindings::CallbackType* attribute_name(); +#define __ENUMERATE(attribute_name, event_name) \ + void set_##attribute_name(WebIDL::CallbackType*); \ + WebIDL::CallbackType* attribute_name(); ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index aab54be5d5..d8c4dc9c53 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -333,14 +333,14 @@ void Worker::post_message(JS::Value message, JS::Value) } #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void Worker::set_##attribute_name(Bindings::CallbackType* value) \ - { \ - set_event_handler_attribute(event_name, move(value)); \ - } \ - Bindings::CallbackType* Worker::attribute_name() \ - { \ - return event_handler_attribute(event_name); \ +#define __ENUMERATE(attribute_name, event_name) \ + void Worker::set_##attribute_name(WebIDL::CallbackType* value) \ + { \ + set_event_handler_attribute(event_name, move(value)); \ + } \ + WebIDL::CallbackType* Worker::attribute_name() \ + { \ + return event_handler_attribute(event_name); \ } ENUMERATE_WORKER_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 9c92120240..bcc1a447bd 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -52,9 +52,9 @@ public: JS::GCPtr<MessagePort> outside_message_port() { return m_outside_port; } #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void set_##attribute_name(Bindings::CallbackType*); \ - Bindings::CallbackType* attribute_name(); +#define __ENUMERATE(attribute_name, event_name) \ + void set_##attribute_name(WebIDL::CallbackType*); \ + WebIDL::CallbackType* attribute_name(); ENUMERATE_WORKER_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp index c1b6d069b0..93d4e39827 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp @@ -85,14 +85,14 @@ JS::NonnullGCPtr<WorkerNavigator> WorkerGlobalScope::navigator() const } #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void WorkerGlobalScope::set_##attribute_name(Bindings::CallbackType* value) \ - { \ - set_event_handler_attribute(event_name, move(value)); \ - } \ - Bindings::CallbackType* WorkerGlobalScope::attribute_name() \ - { \ - return event_handler_attribute(event_name); \ +#define __ENUMERATE(attribute_name, event_name) \ + void WorkerGlobalScope::set_##attribute_name(WebIDL::CallbackType* value) \ + { \ + set_event_handler_attribute(event_name, move(value)); \ + } \ + WebIDL::CallbackType* WorkerGlobalScope::attribute_name() \ + { \ + return event_handler_attribute(event_name); \ } ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h index 30cf2d070f..66d571f1d1 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h @@ -45,9 +45,9 @@ public: DOM::ExceptionOr<void> import_scripts(Vector<String> urls); #undef __ENUMERATE -#define __ENUMERATE(attribute_name, event_name) \ - void set_##attribute_name(Bindings::CallbackType*); \ - Bindings::CallbackType* attribute_name(); +#define __ENUMERATE(attribute_name, event_name) \ + void set_##attribute_name(WebIDL::CallbackType*); \ + WebIDL::CallbackType* attribute_name(); ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE |