1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:17:45 +00:00

LibWeb: Make factory methods of UIEvents::WheelEvent fallible

This commit is contained in:
Kenneth Myhra 2023-02-19 10:48:02 +01:00 committed by Andreas Kling
parent 587cf355ed
commit e57461b89e
3 changed files with 7 additions and 6 deletions

View file

@ -8,6 +8,7 @@
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/WheelEvent.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::UIEvents {
@ -30,12 +31,12 @@ JS::ThrowCompletionOr<void> WheelEvent::initialize(JS::Realm& realm)
return {};
}
WheelEvent* WheelEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WheelEventInit const& event_init)
WebIDL::ExceptionOr<JS::NonnullGCPtr<WheelEvent>> WheelEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WheelEventInit const& event_init)
{
return realm.heap().allocate<WheelEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<WheelEvent>(realm, realm, event_name, event_init));
}
WheelEvent* WheelEvent::create_from_platform_event(JS::Realm& realm, DeprecatedFlyString const& event_name, CSSPixels offset_x, CSSPixels offset_y, CSSPixels client_x, CSSPixels client_y, double delta_x, double delta_y, unsigned buttons, unsigned button)
WebIDL::ExceptionOr<JS::NonnullGCPtr<WheelEvent>> WheelEvent::create_from_platform_event(JS::Realm& realm, DeprecatedFlyString const& event_name, CSSPixels offset_x, CSSPixels offset_y, CSSPixels client_x, CSSPixels client_y, double delta_x, double delta_y, unsigned buttons, unsigned button)
{
WheelEventInit event_init {};
event_init.offset_x = static_cast<double>(offset_x.value());