summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/CustomEvent.cpp12
-rw-r--r--Userland/Libraries/LibWeb/DOM/CustomEvent.h9
-rw-r--r--Userland/Libraries/LibWeb/DOM/CustomEvent.idl2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp2
4 files changed, 13 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp
index 7852fbabc1..ec0cd7318b 100644
--- a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp
+++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp
@@ -11,18 +11,18 @@
namespace Web::DOM {
-WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::create(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
{
return MUST_OR_THROW_OOM(realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init));
}
-WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> CustomEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
-CustomEvent::CustomEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
- : Event(realm, event_name, event_init)
+CustomEvent::CustomEvent(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
+ : Event(realm, event_name.to_deprecated_fly_string(), event_init)
, m_detail(event_init.detail)
{
}
@@ -44,14 +44,14 @@ void CustomEvent::visit_edges(JS::Cell::Visitor& visitor)
}
// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
-void CustomEvent::init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail)
+void CustomEvent::init_custom_event(String const& type, bool bubbles, bool cancelable, JS::Value detail)
{
// 1. If this’s dispatch flag is set, then return.
if (dispatched())
return;
// 2. Initialize this with type, bubbles, and cancelable.
- initialize_event(type, bubbles, cancelable);
+ initialize_event(type.to_deprecated_string(), bubbles, cancelable);
// 3. Set this’s detail attribute to detail.
m_detail = detail;
diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.h b/Userland/Libraries/LibWeb/DOM/CustomEvent.h
index 84c5bf4306..f4165ab321 100644
--- a/Userland/Libraries/LibWeb/DOM/CustomEvent.h
+++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.h
@@ -7,6 +7,7 @@
#pragma once
+#include <AK/FlyString.h>
#include <LibWeb/DOM/Event.h>
namespace Web::DOM {
@@ -20,8 +21,8 @@ class CustomEvent : public Event {
WEB_PLATFORM_OBJECT(CustomEvent, Event);
public:
- static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init = {});
- static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> create(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init = {});
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<CustomEvent>> construct_impl(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init);
virtual ~CustomEvent() override;
@@ -31,10 +32,10 @@ public:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
- void init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail);
+ void init_custom_event(String const& type, bool bubbles, bool cancelable, JS::Value detail);
private:
- CustomEvent(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init);
+ CustomEvent(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init);
// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-detail
JS::Value m_detail { JS::js_null() };
diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.idl b/Userland/Libraries/LibWeb/DOM/CustomEvent.idl
index 17e69acd07..2a70941fcf 100644
--- a/Userland/Libraries/LibWeb/DOM/CustomEvent.idl
+++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.idl
@@ -1,6 +1,6 @@
#import <DOM/Event.idl>
-[Exposed=(Window,Worker)]
+[Exposed=(Window,Worker), UseNewAKString]
interface CustomEvent : Event {
constructor(DOMString type, optional CustomEventInit eventInitDict = {});
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index eec643d26a..4408440f6b 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -1296,7 +1296,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Event>> Document::create_event(DeprecatedSt
} else if (Infra::is_ascii_case_insensitive_match(interface, "compositionevent"sv)) {
event = TRY(Event::create(realm, "")); // FIXME: Create CompositionEvent
} else if (Infra::is_ascii_case_insensitive_match(interface, "customevent"sv)) {
- event = TRY(CustomEvent::create(realm, ""));
+ event = TRY(CustomEvent::create(realm, FlyString {}));
} else if (Infra::is_ascii_case_insensitive_match(interface, "devicemotionevent"sv)) {
event = TRY(Event::create(realm, "")); // FIXME: Create DeviceMotionEvent
} else if (Infra::is_ascii_case_insensitive_match(interface, "deviceorientationevent"sv)) {