diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp index 9fe81a39b3..4474115470 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp @@ -12,12 +12,12 @@ namespace Web::DOM { -WebIDL::ExceptionOr> MutationRecord::create(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value) +WebIDL::ExceptionOr> MutationRecord::create(JS::Realm& realm, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value) { return MUST_OR_THROW_OOM(realm.heap().allocate(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value)); } -MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value) +MutationRecord::MutationRecord(JS::Realm& realm, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value) : PlatformObject(realm) , m_type(type) , m_target(JS::make_handle(target)) diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.h b/Userland/Libraries/LibWeb/DOM/MutationRecord.h index 14c99a5826..273ce80602 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationRecord.h +++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.h @@ -6,6 +6,7 @@ #pragma once +#include #include namespace Web::DOM { @@ -15,11 +16,11 @@ class MutationRecord : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject); public: - static WebIDL::ExceptionOr> create(JS::Realm&, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value); + static WebIDL::ExceptionOr> create(JS::Realm&, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value); virtual ~MutationRecord() override; - DeprecatedFlyString const& type() const { return m_type; } + FlyString const& type() const { return m_type; } Node const* target() const { return m_target; } NodeList const* added_nodes() const { return m_added_nodes; } NodeList const* removed_nodes() const { return m_removed_nodes; } @@ -30,12 +31,12 @@ public: DeprecatedString const& old_value() const { return m_old_value; } private: - MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value); + MutationRecord(JS::Realm& realm, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; - DeprecatedFlyString m_type; + FlyString m_type; JS::GCPtr m_target; JS::GCPtr m_added_nodes; JS::GCPtr m_removed_nodes; diff --git a/Userland/Libraries/LibWeb/DOM/MutationType.cpp b/Userland/Libraries/LibWeb/DOM/MutationType.cpp index b14516dfb2..41ec95e2c8 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationType.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationType.cpp @@ -8,7 +8,7 @@ namespace Web::DOM::MutationType { -#define __ENUMERATE_MUTATION_TYPE(name) DeprecatedFlyString name; +#define __ENUMERATE_MUTATION_TYPE(name) FlyString name; ENUMERATE_MUTATION_TYPES #undef __ENUMERATE_MUTATION_TYPE @@ -17,7 +17,7 @@ ErrorOr initialize_strings() static bool s_initialized = false; VERIFY(!s_initialized); -#define __ENUMERATE_MUTATION_TYPE(name) name = #name; +#define __ENUMERATE_MUTATION_TYPE(name) name = TRY(#name##_fly_string); ENUMERATE_MUTATION_TYPES #undef __ENUMERATE_MUTATION_TYPE diff --git a/Userland/Libraries/LibWeb/DOM/MutationType.h b/Userland/Libraries/LibWeb/DOM/MutationType.h index 709a596e30..961c306843 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationType.h +++ b/Userland/Libraries/LibWeb/DOM/MutationType.h @@ -6,8 +6,8 @@ #pragma once -#include #include +#include namespace Web::DOM::MutationType { @@ -16,7 +16,7 @@ namespace Web::DOM::MutationType { __ENUMERATE_MUTATION_TYPE(characterData) \ __ENUMERATE_MUTATION_TYPE(childList) -#define __ENUMERATE_MUTATION_TYPE(name) extern DeprecatedFlyString name; +#define __ENUMERATE_MUTATION_TYPE(name) extern FlyString name; ENUMERATE_MUTATION_TYPES #undef __ENUMERATE_MUTATION_TYPE diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 7d104ad9e7..171f74f7f2 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -1390,7 +1390,7 @@ Painting::PaintableBox const* Node::paint_box() const } // https://dom.spec.whatwg.org/#queue-a-mutation-record -void Node::queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr added_nodes, JS::NonnullGCPtr removed_nodes, Node* previous_sibling, Node* next_sibling) const +void Node::queue_mutation_record(FlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr added_nodes, JS::NonnullGCPtr removed_nodes, Node* previous_sibling, Node* next_sibling) const { // NOTE: We defer garbage collection until the end of the scope, since we can't safely use MutationObserver* as a hashmap key otherwise. // FIXME: This is a total hack. diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 2387894852..85d81e5a20 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -227,7 +228,7 @@ public: void add_registered_observer(RegisteredObserver& registered_observer) { m_registered_observer_list.append(registered_observer); } - void queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr added_nodes, JS::NonnullGCPtr removed_nodes, Node* previous_sibling, Node* next_sibling) const; + void queue_mutation_record(FlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr added_nodes, JS::NonnullGCPtr removed_nodes, Node* previous_sibling, Node* next_sibling) const; // https://dom.spec.whatwg.org/#concept-shadow-including-descendant template