diff --git a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp index 89a116604a..45c1b6fbd7 100644 --- a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp @@ -51,7 +51,7 @@ JS::ThrowCompletionOr> OptionConstructor::construct // 3. If text is not the empty string, then append to option a new Text node whose data is text. if (vm.argument_count() > 0) { - auto text = TRY(vm.argument(0).to_deprecated_string(vm)); + auto text = TRY(vm.argument(0).to_string(vm)); if (!text.is_empty()) { auto new_text_node = vm.heap().allocate(realm, document, text); MUST(option_element->append_child(*new_text_node)); diff --git a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp index d738f2fd4e..f48255ae2d 100644 --- a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp +++ b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp @@ -9,7 +9,7 @@ namespace Web::DOM { -CDATASection::CDATASection(Document& document, DeprecatedString const& data) +CDATASection::CDATASection(Document& document, String const& data) : Text(document, NodeType::CDATA_SECTION_NODE, data) { } diff --git a/Userland/Libraries/LibWeb/DOM/CDATASection.h b/Userland/Libraries/LibWeb/DOM/CDATASection.h index 148dad1c8d..e15f308826 100644 --- a/Userland/Libraries/LibWeb/DOM/CDATASection.h +++ b/Userland/Libraries/LibWeb/DOM/CDATASection.h @@ -21,7 +21,7 @@ public: virtual DeprecatedFlyString node_name() const override { return "#cdata-section"; } private: - CDATASection(Document&, DeprecatedString const&); + CDATASection(Document&, String const&); virtual void initialize(JS::Realm&) override; }; diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp index 366c4e99cd..d01cb7df65 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp @@ -118,7 +118,7 @@ JS::NonnullGCPtr DOMImplementation::create_html_document(Optionalappend_child(title_element)); // 2. Append a new Text node, with its data set to title (which could be the empty string) and its node document set to doc, to the title element created earlier. - auto text_node = heap().allocate(realm(), html_document, title->to_deprecated_string()); + auto text_node = heap().allocate(realm(), html_document, title.value()); MUST(title_element->append_child(*text_node)); } diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 8f2e905074..c667d71d6e 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1422,7 +1422,7 @@ JS::NonnullGCPtr Document::create_document_fragment() JS::NonnullGCPtr Document::create_text_node(DeprecatedString const& data) { - return heap().allocate(realm(), *this, data); + return heap().allocate(realm(), *this, MUST(String::from_deprecated_string(data))); } JS::NonnullGCPtr Document::create_comment(DeprecatedString const& data) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp index e54e8d226e..5f7132e33f 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp @@ -119,7 +119,7 @@ static bool build_image_document(DOM::Document& document, ByteBuffer const& data MUST(head_element->append_child(title_element)); auto basename = LexicalPath::basename(document.url().serialize_path()); - auto title_text = document.heap().allocate(document.realm(), document, DeprecatedString::formatted("{} [{}x{}]", basename, bitmap->width(), bitmap->height())); + auto title_text = document.heap().allocate(document.realm(), document, MUST(String::formatted("{} [{}x{}]", basename, bitmap->width(), bitmap->height()))); MUST(title_element->append_child(*title_text)); auto body_element = DOM::create_element(document, HTML::TagNames::body, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index e053c8727e..6a2e3f483a 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1424,7 +1424,7 @@ WebIDL::ExceptionOr> Element::insert_adjacent_element(Depreca WebIDL::ExceptionOr Element::insert_adjacent_text(DeprecatedString const& where, DeprecatedString const& data) { // 1. Let text be a new Text node whose data is data and node document is this’s node document. - auto text = heap().allocate(realm(), document(), data); + auto text = heap().allocate(realm(), document(), MUST(String::from_deprecated_string(data))); // 2. Run insert adjacent, given this, where, and text. // Spec Note: This method returns nothing because it existed before we had a chance to design it. diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 593fdae415..17ecb782ac 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -805,7 +805,7 @@ JS::NonnullGCPtr Node::clone_node(Document* document, bool clone_children) auto text = verify_cast(this); // Set copy’s data to that of node. - auto text_copy = heap().allocate(realm(), *document, text->data()); + auto text_copy = heap().allocate(realm(), *document, MUST(String::from_deprecated_string(text->data()))); copy = move(text_copy); } else if (is(this)) { // Comment @@ -1257,7 +1257,7 @@ void Node::string_replace_all(DeprecatedString const& string) // 2. If string is not the empty string, then set node to a new Text node whose data is string and node document is parent’s node document. if (!string.is_empty()) - node = heap().allocate(realm(), document(), string); + node = heap().allocate(realm(), document(), MUST(String::from_deprecated_string(string))); // 3. Replace all with node within parent. replace_all(node); diff --git a/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp b/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp index 1ebd908e0b..576d9d113e 100644 --- a/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp +++ b/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp @@ -26,7 +26,7 @@ WebIDL::ExceptionOr> convert_nodes_to_single_node(Vector< if (node.has>()) return *node.get>(); - return document.heap().allocate(document.realm(), document, node.get()); + return document.heap().allocate(document.realm(), document, MUST(String::from_deprecated_string(node.get()))); }; if (nodes.size() == 1) diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 0a86ebe852..483d24e3e5 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -14,13 +14,13 @@ namespace Web::DOM { -Text::Text(Document& document, DeprecatedString const& data) - : CharacterData(document, NodeType::TEXT_NODE, data) +Text::Text(Document& document, String const& data) + : CharacterData(document, NodeType::TEXT_NODE, data.to_deprecated_string()) { } -Text::Text(Document& document, NodeType type, DeprecatedString const& data) - : CharacterData(document, type, data) +Text::Text(Document& document, NodeType type, String const& data) + : CharacterData(document, type, data.to_deprecated_string()) { } @@ -37,7 +37,7 @@ void Text::visit_edges(Cell::Visitor& visitor) } // https://dom.spec.whatwg.org/#dom-text-text -WebIDL::ExceptionOr> Text::construct_impl(JS::Realm& realm, DeprecatedString const& data) +WebIDL::ExceptionOr> Text::construct_impl(JS::Realm& realm, String const& data) { // The new Text(data) constructor steps are to set this’s data to data and this’s node document to current global object’s associated Document. auto& window = verify_cast(HTML::current_global_object()); @@ -67,7 +67,7 @@ WebIDL::ExceptionOr> Text::split_text(size_t offset) auto new_data = TRY(substring_data(offset, count)); // 5. Let new node be a new Text node, with the same node document as node. Set new node’s data to new data. - auto new_node = heap().allocate(realm(), document(), new_data); + auto new_node = heap().allocate(realm(), document(), MUST(String::from_deprecated_string(new_data))); // 6. Let parent be node’s parent. JS::GCPtr parent = this->parent(); diff --git a/Userland/Libraries/LibWeb/DOM/Text.h b/Userland/Libraries/LibWeb/DOM/Text.h index 2bf65a05be..dd941ca37b 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.h +++ b/Userland/Libraries/LibWeb/DOM/Text.h @@ -18,7 +18,7 @@ class Text : public CharacterData { public: virtual ~Text() override = default; - static WebIDL::ExceptionOr> construct_impl(JS::Realm& realm, DeprecatedString const& data); + static WebIDL::ExceptionOr> construct_impl(JS::Realm& realm, String const& data); // ^Node virtual DeprecatedFlyString node_name() const override { return "#text"; } @@ -35,8 +35,8 @@ public: void set_is_password_input(Badge, bool b) { m_is_password_input = b; } protected: - Text(Document&, DeprecatedString const&); - Text(Document&, NodeType, DeprecatedString const&); + Text(Document&, String const&); + Text(Document&, NodeType, String const&); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; diff --git a/Userland/Libraries/LibWeb/DOM/Text.idl b/Userland/Libraries/LibWeb/DOM/Text.idl index 0479e8a1f7..4093e6fdac 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.idl +++ b/Userland/Libraries/LibWeb/DOM/Text.idl @@ -1,7 +1,7 @@ #import // https://dom.spec.whatwg.org/#text -[Exposed=Window, UseDeprecatedAKString] +[Exposed=Window] interface Text : CharacterData { constructor(optional DOMString data = ""); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index dabf6d3d66..4777ad32e0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -502,7 +502,7 @@ void HTMLInputElement::create_shadow_tree_if_needed() m_placeholder_element = heap().allocate(realm(), document()); MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Height, "1lh"sv)); - m_placeholder_text_node = heap().allocate(realm(), document(), initial_value); + m_placeholder_text_node = heap().allocate(realm(), document(), MUST(String::from_deprecated_string(initial_value))); m_placeholder_text_node->set_data(deprecated_attribute(HTML::AttributeNames::placeholder)); m_placeholder_text_node->set_owner_input_element({}, *this); MUST(m_placeholder_element->append_child(*m_placeholder_text_node)); @@ -511,7 +511,7 @@ void HTMLInputElement::create_shadow_tree_if_needed() m_inner_text_element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); MUST(m_inner_text_element->style_for_bindings()->set_property(CSS::PropertyID::Height, "1lh"sv)); - m_text_node = heap().allocate(realm(), document(), initial_value); + m_text_node = heap().allocate(realm(), document(), MUST(String::from_deprecated_string(initial_value))); if (m_type == TypeAttributeState::FileUpload) { // NOTE: file upload state is mutable, but we don't allow the text node to be modifed m_text_node->set_always_editable(false); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index d451f2804f..70fc9b000d 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -1009,7 +1009,7 @@ DOM::Text* HTMLParser::find_character_insertion_node() if (adjusted_insertion_location.insert_before_sibling) { if (is_empty_text_node(adjusted_insertion_location.insert_before_sibling->previous_sibling())) return static_cast(adjusted_insertion_location.insert_before_sibling->previous_sibling()); - auto new_text_node = realm().heap().allocate(realm(), document(), ""); + auto new_text_node = realm().heap().allocate(realm(), document(), String {}); adjusted_insertion_location.parent->insert_before(*new_text_node, *adjusted_insertion_location.insert_before_sibling); return new_text_node; } @@ -1017,7 +1017,7 @@ DOM::Text* HTMLParser::find_character_insertion_node() return nullptr; if (is_empty_text_node(adjusted_insertion_location.parent->last_child())) return static_cast(adjusted_insertion_location.parent->last_child()); - auto new_text_node = realm().heap().allocate(realm(), document(), ""); + auto new_text_node = realm().heap().allocate(realm(), document(), String {}); MUST(adjusted_insertion_location.parent->append_child(*new_text_node)); return new_text_node; } diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index e020ab393f..30a2c95c2f 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -206,7 +206,7 @@ ErrorOr TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element // FIXME: Handle images, and multiple values if (pseudo_element_content.type == CSS::ContentData::Type::String) { - auto text = document.heap().allocate(document.realm(), document, pseudo_element_content.data.to_deprecated_string()); + auto text = document.heap().allocate(document.realm(), document, pseudo_element_content.data); auto text_node = document.heap().allocate_without_realm(document, *text); text_node->set_generated_for(generated_for, element);