mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -291,7 +291,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
|||
|
||||
// 3. If referrer is a URL record, then set document's referrer to the serialization of referrer.
|
||||
if (referrer.has<AK::URL>()) {
|
||||
document->m_referrer = MUST(String::from_deprecated_string(referrer.get<AK::URL>().serialize()));
|
||||
document->m_referrer = MUST(String::from_byte_string(referrer.get<AK::URL>().serialize()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@ WebIDL::ExceptionOr<void> Document::set_title(String const& title)
|
|||
}
|
||||
|
||||
if (browsing_context() == &page().top_level_browsing_context())
|
||||
page().client().page_did_change_title(title.to_deprecated_string());
|
||||
page().client().page_did_change_title(title.to_byte_string());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -1206,7 +1206,7 @@ void Document::set_hovered_node(Node* node)
|
|||
|
||||
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_name(String const& name)
|
||||
{
|
||||
auto deprecated_name = name.to_deprecated_string();
|
||||
auto deprecated_name = name.to_byte_string();
|
||||
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [deprecated_name](Element const& element) {
|
||||
return element.name() == deprecated_name;
|
||||
});
|
||||
|
@ -1349,7 +1349,7 @@ HTML::EnvironmentSettingsObject& Document::relevant_settings_object() const
|
|||
// https://dom.spec.whatwg.org/#dom-document-createelement
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(String const& a_local_name, Variant<String, ElementCreationOptions> const& options)
|
||||
{
|
||||
auto local_name = a_local_name.to_deprecated_string();
|
||||
auto local_name = a_local_name.to_byte_string();
|
||||
|
||||
// 1. If localName does not match the Name production, then throw an "InvalidCharacterError" DOMException.
|
||||
if (!is_valid_name(a_local_name))
|
||||
|
@ -1427,7 +1427,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> Document::create_pr
|
|||
// FIXME: 2. If data contains the string "?>", then throw an "InvalidCharacterError" DOMException.
|
||||
|
||||
// 3. Return a new ProcessingInstruction node, with target set to target, data set to data, and node document set to this.
|
||||
return heap().allocate<ProcessingInstruction>(realm(), *this, data.to_deprecated_string(), target.to_deprecated_string());
|
||||
return heap().allocate<ProcessingInstruction>(realm(), *this, data.to_byte_string(), target.to_byte_string());
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Document::create_range()
|
||||
|
@ -1974,7 +1974,7 @@ void Document::completely_finish_loading()
|
|||
|
||||
String Document::cookie(Cookie::Source source)
|
||||
{
|
||||
return MUST(String::from_deprecated_string(page().client().page_did_request_cookie(m_url, source)));
|
||||
return MUST(String::from_byte_string(page().client().page_did_request_cookie(m_url, source)));
|
||||
}
|
||||
|
||||
void Document::set_cookie(StringView cookie_string, Cookie::Source source)
|
||||
|
@ -3021,7 +3021,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Attr>> Document::create_attribute(String co
|
|||
|
||||
// 2. If this is an HTML document, then set localName to localName in ASCII lowercase.
|
||||
// 3. Return a new attribute whose local name is localName and node document is this.
|
||||
auto deprecated_local_name = local_name.to_deprecated_string();
|
||||
auto deprecated_local_name = local_name.to_byte_string();
|
||||
return Attr::create(*this, MUST(FlyString::from_deprecated_fly_string(is_html_document() ? deprecated_local_name.to_lowercase() : deprecated_local_name)));
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static bool build_text_document(DOM::Document& document, ByteBuffer const& data)
|
|||
auto title_element = DOM::create_element(document, HTML::TagNames::title, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
|
||||
MUST(head_element->append_child(title_element));
|
||||
|
||||
auto title_text = document.create_text_node(MUST(String::from_deprecated_string(document.url().basename())));
|
||||
auto title_text = document.create_text_node(MUST(String::from_byte_string(document.url().basename())));
|
||||
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();
|
||||
|
@ -137,7 +137,7 @@ static bool build_gemini_document(DOM::Document& document, ByteBuffer const& dat
|
|||
{
|
||||
StringView gemini_data { data };
|
||||
auto gemini_document = Gemini::Document::parse(gemini_data, document.url());
|
||||
DeprecatedString html_data = gemini_document->render_to_html();
|
||||
ByteString html_data = gemini_document->render_to_html();
|
||||
|
||||
dbgln_if(GEMINI_DEBUG, "Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
|
||||
dbgln_if(GEMINI_DEBUG, "Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
|
||||
|
|
|
@ -120,27 +120,27 @@ Optional<String> Element::get_attribute(StringView name) const
|
|||
return attribute->value();
|
||||
}
|
||||
|
||||
DeprecatedString Element::deprecated_get_attribute(StringView name) const
|
||||
ByteString Element::deprecated_get_attribute(StringView name) const
|
||||
{
|
||||
auto maybe_attribute = get_attribute(name);
|
||||
if (!maybe_attribute.has_value())
|
||||
return DeprecatedString::empty();
|
||||
return ByteString::empty();
|
||||
|
||||
return maybe_attribute->to_deprecated_string();
|
||||
return maybe_attribute->to_byte_string();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-get-value
|
||||
DeprecatedString Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
|
||||
ByteString Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
|
||||
{
|
||||
// 1. Let attr be the result of getting an attribute given namespace, localName, and element.
|
||||
auto const* attribute = m_attributes->get_attribute_ns(namespace_, local_name);
|
||||
|
||||
// 2. If attr is null, then return the empty string.
|
||||
if (!attribute)
|
||||
return DeprecatedString::empty();
|
||||
return ByteString::empty();
|
||||
|
||||
// 3. Return attr’s value.
|
||||
return attribute->value().to_deprecated_string();
|
||||
return attribute->value().to_byte_string();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattributenode
|
||||
|
@ -247,7 +247,7 @@ void Element::append_attribute(Attr& attribute)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-set-value
|
||||
void Element::set_attribute_value(FlyString const& local_name, DeprecatedString const& value, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_)
|
||||
void Element::set_attribute_value(FlyString const& local_name, ByteString const& value, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_)
|
||||
{
|
||||
// 1. Let attribute be the result of getting an attribute given namespace, localName, and element.
|
||||
auto* attribute = m_attributes->get_attribute_ns(namespace_, local_name);
|
||||
|
@ -258,14 +258,14 @@ void Element::set_attribute_value(FlyString const& local_name, DeprecatedString
|
|||
if (!attribute) {
|
||||
QualifiedName name { local_name, prefix, namespace_ };
|
||||
|
||||
auto new_attribute = Attr::create(document(), move(name), MUST(String::from_deprecated_string(value)));
|
||||
auto new_attribute = Attr::create(document(), move(name), MUST(String::from_byte_string(value)));
|
||||
m_attributes->append_attribute(new_attribute);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Change attribute to value.
|
||||
attribute->change_attribute(MUST(String::from_deprecated_string(value)));
|
||||
attribute->change_attribute(MUST(String::from_byte_string(value)));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-setattributenode
|
||||
|
@ -1457,7 +1457,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position,
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#insert-adjacent
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node)
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node)
|
||||
{
|
||||
// To insert adjacent, given an element element, string where, and a node node, run the steps associated with the first ASCII case-insensitive match for where:
|
||||
if (Infra::is_ascii_case_insensitive_match(where, "beforebegin"sv)) {
|
||||
|
@ -1501,7 +1501,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(DeprecatedString c
|
|||
WebIDL::ExceptionOr<JS::GCPtr<Element>> Element::insert_adjacent_element(String const& where, JS::NonnullGCPtr<Element> element)
|
||||
{
|
||||
// The insertAdjacentElement(where, element) method steps are to return the result of running insert adjacent, give this, where, and element.
|
||||
auto returned_node = TRY(insert_adjacent(where.to_deprecated_string(), move(element)));
|
||||
auto returned_node = TRY(insert_adjacent(where.to_byte_string(), move(element)));
|
||||
if (!returned_node)
|
||||
return JS::GCPtr<Element> { nullptr };
|
||||
return JS::GCPtr<Element> { verify_cast<Element>(*returned_node) };
|
||||
|
@ -1515,7 +1515,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_text(String const& where, Str
|
|||
|
||||
// 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.
|
||||
(void)TRY(insert_adjacent(where.to_deprecated_string(), text));
|
||||
(void)TRY(insert_adjacent(where.to_byte_string(), text));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -2019,10 +2019,10 @@ void Element::for_each_attribute(Function<void(Attr const&)> callback) const
|
|||
callback(*m_attributes->item(i));
|
||||
}
|
||||
|
||||
void Element::for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)> callback) const
|
||||
void Element::for_each_attribute(Function<void(FlyString const&, ByteString const&)> callback) const
|
||||
{
|
||||
for_each_attribute([&callback](Attr const& attr) {
|
||||
callback(attr.name(), attr.value().to_deprecated_string());
|
||||
callback(attr.name(), attr.value().to_byte_string());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <LibWeb/ARIA/ARIAMixin.h>
|
||||
#include <LibWeb/Bindings/ElementPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
// NOTE: This is for the JS bindings
|
||||
FlyString const& tag_name() const { return html_uppercased_qualified_name(); }
|
||||
DeprecatedString deprecated_tag_name() const { return html_uppercased_qualified_name().to_deprecated_fly_string(); }
|
||||
ByteString deprecated_tag_name() const { return html_uppercased_qualified_name().to_deprecated_fly_string(); }
|
||||
|
||||
Optional<FlyString> const& prefix() const { return m_qualified_name.prefix(); }
|
||||
|
||||
|
@ -97,19 +97,19 @@ public:
|
|||
bool has_attributes() const;
|
||||
|
||||
// FIXME: This should be taking a 'FlyString const&'
|
||||
DeprecatedString deprecated_attribute(StringView name) const { return deprecated_get_attribute(name); }
|
||||
ByteString deprecated_attribute(StringView name) const { return deprecated_get_attribute(name); }
|
||||
Optional<String> attribute(StringView name) const { return get_attribute(name); }
|
||||
|
||||
// FIXME: This should be taking a 'FlyString const&' / 'Optional<FlyString> const&'
|
||||
Optional<String> get_attribute(StringView name) const;
|
||||
DeprecatedString deprecated_get_attribute(StringView name) const;
|
||||
DeprecatedString get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_ = {}) const;
|
||||
ByteString deprecated_get_attribute(StringView name) const;
|
||||
ByteString get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_ = {}) const;
|
||||
|
||||
WebIDL::ExceptionOr<void> set_attribute(FlyString const& name, String const& value);
|
||||
|
||||
// FIXME: This should be taking an Optional<FlyString>
|
||||
WebIDL::ExceptionOr<void> set_attribute_ns(Optional<String> const& namespace_, FlyString const& qualified_name, FlyString const& value);
|
||||
void set_attribute_value(FlyString const& local_name, DeprecatedString const& value, Optional<FlyString> const& prefix = {}, Optional<FlyString> const& namespace_ = {});
|
||||
void set_attribute_value(FlyString const& local_name, ByteString const& value, Optional<FlyString> const& prefix = {}, Optional<FlyString> const& namespace_ = {});
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node(Attr&);
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node_ns(Attr&);
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
void for_each_attribute(Function<void(Attr const&)>) const;
|
||||
|
||||
void for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)>) const;
|
||||
void for_each_attribute(Function<void(FlyString const&, ByteString const&)>) const;
|
||||
|
||||
bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
Vector<FlyString> const& class_names() const { return m_classes; }
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
Layout::NodeWithStyle* layout_node();
|
||||
Layout::NodeWithStyle const* layout_node() const;
|
||||
|
||||
DeprecatedString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
|
||||
ByteString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
|
||||
|
||||
CSS::StyleProperties* computed_css_values() { return m_computed_css_values.ptr(); }
|
||||
CSS::StyleProperties const* computed_css_values() const { return m_computed_css_values.ptr(); }
|
||||
|
@ -395,7 +395,7 @@ private:
|
|||
|
||||
void invalidate_style_after_attribute_change(FlyString const& attribute_name);
|
||||
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node);
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node);
|
||||
|
||||
void enqueue_an_element_on_the_appropriate_element_queue();
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
|
|||
auto& event_handler = event_handler_iterator->value;
|
||||
|
||||
// 3. If eventHandler's value is an internal raw uncompiled handler, then:
|
||||
if (event_handler->value.has<DeprecatedString>()) {
|
||||
if (event_handler->value.has<ByteString>()) {
|
||||
// 1. If eventTarget is an element, then let element be eventTarget, and document be element's node document.
|
||||
// Otherwise, eventTarget is a Window object, let element be null, and document be eventTarget's associated Document.
|
||||
JS::GCPtr<Element> element;
|
||||
|
@ -387,7 +387,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
|
|||
return nullptr;
|
||||
|
||||
// 3. Let body be the uncompiled script body in eventHandler's value.
|
||||
auto& body = event_handler->value.get<DeprecatedString>();
|
||||
auto& body = event_handler->value.get<ByteString>();
|
||||
|
||||
// FIXME: 4. Let location be the location where the script body originated, as given by eventHandler's value.
|
||||
|
||||
|
@ -418,7 +418,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
|
|||
builder.appendff("function {}(event) {{\n{}\n}}", name, body);
|
||||
}
|
||||
|
||||
auto source_text = builder.to_deprecated_string();
|
||||
auto source_text = builder.to_byte_string();
|
||||
|
||||
auto parser = JS::Parser(JS::Lexer(source_text));
|
||||
|
||||
|
@ -486,7 +486,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
|
|||
|
||||
// 6. Return scope. (NOTE: Not necessary)
|
||||
|
||||
auto function = JS::ECMAScriptFunctionObject::create(realm, name.to_deprecated_fly_string(), builder.to_deprecated_string(), program->body(), program->parameters(), program->function_length(), program->local_variables_names(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
|
||||
auto function = JS::ECMAScriptFunctionObject::create(realm, name.to_deprecated_fly_string(), builder.to_byte_string(), program->body(), program->parameters(), program->function_length(), program->local_variables_names(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
|
||||
|
||||
// 10. Remove settings object's realm execution context from the JavaScript execution context stack.
|
||||
VERIFY(vm.execution_context_stack().last() == &settings_object.realm_execution_context());
|
||||
|
@ -747,7 +747,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
|
|||
// NOTE: See the optimization comments in set_event_handler_attribute.
|
||||
|
||||
if (event_handler_iterator == handler_map.end()) {
|
||||
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value->to_deprecated_string());
|
||||
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value->to_byte_string());
|
||||
|
||||
// 6. Activate an event handler given eventTarget and name.
|
||||
event_target->activate_event_handler(local_name, *new_event_handler);
|
||||
|
@ -759,7 +759,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
|
|||
auto& event_handler = event_handler_iterator->value;
|
||||
|
||||
// 6. Activate an event handler given eventTarget and name.
|
||||
event_handler->value = value->to_deprecated_string();
|
||||
event_handler->value = value->to_byte_string();
|
||||
event_target->activate_event_handler(local_name, *event_handler);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Attr>> NamedNodeMap::set_attribute(Attr& attribute
|
|||
|
||||
// 2. Let oldAttr be the result of getting an attribute given attr’s namespace, attr’s local name, and element.
|
||||
size_t old_attribute_index = 0;
|
||||
DeprecatedString deprecated_namespace_uri;
|
||||
ByteString deprecated_namespace_uri;
|
||||
if (attribute.namespace_uri().has_value())
|
||||
deprecated_namespace_uri = attribute.namespace_uri().value().to_deprecated_fly_string();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibWeb/Bindings/LegacyPlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
|
|
@ -819,7 +819,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
element.for_each_attribute([&](auto& name, auto& value) {
|
||||
// 1. Let copyAttribute be a clone of attribute.
|
||||
// 2. Append copyAttribute to copy.
|
||||
MUST(element_copy->set_attribute(name, MUST(String::from_deprecated_string(value))));
|
||||
MUST(element_copy->set_attribute(name, MUST(String::from_byte_string(value))));
|
||||
});
|
||||
copy = move(element_copy);
|
||||
|
||||
|
@ -872,7 +872,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
|
||||
|
||||
// Set copy’s target and data to those of node.
|
||||
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data().to_deprecated_string(), processing_instruction->target());
|
||||
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data().to_byte_string(), processing_instruction->target());
|
||||
copy = processing_instruction_copy;
|
||||
}
|
||||
// Otherwise, Do nothing.
|
||||
|
@ -1783,8 +1783,8 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
|||
// process its IDREFs in the order they occur:
|
||||
auto aria_labelled_by = element->aria_labelled_by();
|
||||
auto aria_described_by = element->aria_described_by();
|
||||
if ((target == NameOrDescription::Name && aria_labelled_by.has_value() && Node::first_valid_id(aria_labelled_by->to_deprecated_string(), document).has_value())
|
||||
|| (target == NameOrDescription::Description && aria_described_by.has_value() && Node::first_valid_id(aria_described_by->to_deprecated_string(), document).has_value())) {
|
||||
if ((target == NameOrDescription::Name && aria_labelled_by.has_value() && Node::first_valid_id(aria_labelled_by->to_byte_string(), document).has_value())
|
||||
|| (target == NameOrDescription::Description && aria_described_by.has_value() && Node::first_valid_id(aria_described_by->to_byte_string(), document).has_value())) {
|
||||
|
||||
// i. Set the accumulated text to the empty string.
|
||||
total_accumulated_text.clear();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentFragment.h>
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace Web::DOM {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(ProcessingInstruction);
|
||||
|
||||
ProcessingInstruction::ProcessingInstruction(Document& document, DeprecatedString const& data, DeprecatedString const& target)
|
||||
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, MUST(String::from_deprecated_string(data)))
|
||||
ProcessingInstruction::ProcessingInstruction(Document& document, ByteString const& data, ByteString const& target)
|
||||
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, MUST(String::from_byte_string(data)))
|
||||
, m_target(target)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -19,14 +19,14 @@ public:
|
|||
|
||||
virtual FlyString node_name() const override { return MUST(FlyString::from_deprecated_fly_string(m_target)); }
|
||||
|
||||
DeprecatedString const& target() const { return m_target; }
|
||||
ByteString const& target() const { return m_target; }
|
||||
|
||||
private:
|
||||
ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target);
|
||||
ProcessingInstruction(Document&, ByteString const& data, ByteString const& target);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
DeprecatedString m_target;
|
||||
ByteString m_target;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -1187,7 +1187,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::create_contextual
|
|||
}
|
||||
|
||||
// 3. Let fragment node be the result of invoking the fragment parsing algorithm with fragment as markup, and element as the context element.
|
||||
auto fragment_node = TRY(DOMParsing::parse_fragment(fragment.to_deprecated_string(), *element));
|
||||
auto fragment_node = TRY(DOMParsing::parse_fragment(fragment.to_byte_string(), *element));
|
||||
|
||||
// 4. Unmark all scripts in fragment node as "already started" and as "parser-inserted".
|
||||
fragment_node->for_each_in_subtree_of_type<HTML::HTMLScriptElement>([&](HTML::HTMLScriptElement& script_element) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue