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

LibWeb: Port FocusEvent to new String

This commit is contained in:
Kenneth Myhra 2023-03-09 21:17:20 +01:00 committed by Andreas Kling
parent d527edf0ab
commit e14be3927a
3 changed files with 7 additions and 6 deletions

View file

@ -9,13 +9,13 @@
namespace Web::UIEvents { namespace Web::UIEvents {
WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, FocusEventInit const& event_init) WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
{ {
return MUST_OR_THROW_OOM(realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init)); return MUST_OR_THROW_OOM(realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init));
} }
FocusEvent::FocusEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, FocusEventInit const& event_init) FocusEvent::FocusEvent(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
: UIEvent(realm, event_name) : UIEvent(realm, event_name.to_deprecated_fly_string())
{ {
set_related_target(const_cast<DOM::EventTarget*>(event_init.related_target.ptr())); set_related_target(const_cast<DOM::EventTarget*>(event_init.related_target.ptr()));
} }

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <AK/FlyString.h>
#include <LibWeb/UIEvents/UIEvent.h> #include <LibWeb/UIEvents/UIEvent.h>
namespace Web::UIEvents { namespace Web::UIEvents {
@ -18,12 +19,12 @@ class FocusEvent final : public UIEvent {
WEB_PLATFORM_OBJECT(FocusEvent, UIEvent); WEB_PLATFORM_OBJECT(FocusEvent, UIEvent);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, FocusEventInit const& event_init); static WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> construct_impl(JS::Realm&, FlyString const& event_name, FocusEventInit const& event_init);
virtual ~FocusEvent() override; virtual ~FocusEvent() override;
private: private:
FocusEvent(JS::Realm&, DeprecatedFlyString const& event_name, FocusEventInit const&); FocusEvent(JS::Realm&, FlyString const& event_name, FocusEventInit const&);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
}; };

View file

@ -1,6 +1,6 @@
#import <UIEvents/UIEvent.idl> #import <UIEvents/UIEvent.idl>
[Exposed=Window] [Exposed=Window, UseNewAKString]
interface FocusEvent : UIEvent { interface FocusEvent : UIEvent {
constructor(DOMString type, optional FocusEventInit eventInitDict = {}); constructor(DOMString type, optional FocusEventInit eventInitDict = {});