1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:17:36 +00:00

LibWeb: Port Text interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-06 15:17:20 +12:00 committed by Tim Flynn
parent 6789a2dd8e
commit bcb6851c07
15 changed files with 25 additions and 25 deletions

View file

@ -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<JS::NonnullGCPtr<Text>> Text::construct_impl(JS::Realm& realm, DeprecatedString const& data)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> Text::construct_impl(JS::Realm& realm, String const& data)
{
// The new Text(data) constructor steps are to set thiss data to data and thiss node document to current global objects associated Document.
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
@ -67,7 +67,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> 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 nodes data to new data.
auto new_node = heap().allocate<Text>(realm(), document(), new_data);
auto new_node = heap().allocate<Text>(realm(), document(), MUST(String::from_deprecated_string(new_data)));
// 6. Let parent be nodes parent.
JS::GCPtr<Node> parent = this->parent();