mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 21:02:07 +00:00
AK+Everywhere: Rename FlyString to DeprecatedFlyString
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so let's rename it to A) match the name of DeprecatedString, B) write a new FlyString class that is tied to String.
This commit is contained in:
parent
2eacc7aec1
commit
f3db548a3d
316 changed files with 1177 additions and 1177 deletions
|
@ -41,7 +41,7 @@ WebIDL::ExceptionOr<DeprecatedString> XMLSerializer::serialize_to_string(JS::Non
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-add
|
||||
static void add_prefix_to_namespace_prefix_map(HashMap<FlyString, Vector<DeprecatedString>>& prefix_map, DeprecatedString const& prefix, FlyString const& namespace_)
|
||||
static void add_prefix_to_namespace_prefix_map(HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& prefix_map, DeprecatedString const& prefix, DeprecatedFlyString const& namespace_)
|
||||
{
|
||||
// 1. Let candidates list be the result of retrieving a list from map where there exists a key in map that matches the value of ns or if there is no such key, then let candidates list be null.
|
||||
auto candidates_list_iterator = prefix_map.find(namespace_);
|
||||
|
@ -59,7 +59,7 @@ static void add_prefix_to_namespace_prefix_map(HashMap<FlyString, Vector<Depreca
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string
|
||||
static Optional<DeprecatedString> retrieve_a_preferred_prefix_string(DeprecatedString const& preferred_prefix, HashMap<FlyString, Vector<DeprecatedString>> const& namespace_prefix_map, FlyString const& namespace_)
|
||||
static Optional<DeprecatedString> retrieve_a_preferred_prefix_string(DeprecatedString const& preferred_prefix, HashMap<DeprecatedFlyString, Vector<DeprecatedString>> const& namespace_prefix_map, DeprecatedFlyString const& namespace_)
|
||||
{
|
||||
// 1. Let candidates list be the result of retrieving a list from map where there exists a key in map that matches the value of ns or if there is no such key,
|
||||
// then stop running these steps, and return the null value.
|
||||
|
@ -85,7 +85,7 @@ static Optional<DeprecatedString> retrieve_a_preferred_prefix_string(DeprecatedS
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-generating-a-prefix
|
||||
static DeprecatedString generate_a_prefix(HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, FlyString const& new_namespace, u64& prefix_index)
|
||||
static DeprecatedString generate_a_prefix(HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, DeprecatedFlyString const& new_namespace, u64& prefix_index)
|
||||
{
|
||||
// 1. Let generated prefix be the concatenation of the string "ns" and the current numerical value of prefix index.
|
||||
auto generated_prefix = DeprecatedString::formatted("ns{}", prefix_index);
|
||||
|
@ -101,7 +101,7 @@ static DeprecatedString generate_a_prefix(HashMap<FlyString, Vector<DeprecatedSt
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-found
|
||||
static bool prefix_is_in_prefix_map(DeprecatedString const& prefix, HashMap<FlyString, Vector<DeprecatedString>> const& namespace_prefix_map, FlyString const& namespace_)
|
||||
static bool prefix_is_in_prefix_map(DeprecatedString const& prefix, HashMap<DeprecatedFlyString, Vector<DeprecatedString>> const& namespace_prefix_map, DeprecatedFlyString const& namespace_)
|
||||
{
|
||||
// 1. Let candidates list be the result of retrieving a list from map where there exists a key in map that matches the value of ns
|
||||
// or if there is no such key, then stop running these steps, and return false.
|
||||
|
@ -113,7 +113,7 @@ static bool prefix_is_in_prefix_map(DeprecatedString const& prefix, HashMap<FlyS
|
|||
return candidates_list_iterator->value.contains_slow(prefix);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::NonnullGCPtr<DOM::Node> root, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::NonnullGCPtr<DOM::Node> root, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization
|
||||
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node> root, RequireWellFormed require_well_formed)
|
||||
|
@ -121,10 +121,10 @@ WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGC
|
|||
// 1. Let namespace be a context namespace with value null. The context namespace tracks the XML serialization algorithm's current default namespace.
|
||||
// The context namespace is changed when either an Element Node has a default namespace declaration, or the algorithm generates a default namespace declaration
|
||||
// for the Element Node to match its own namespace. The algorithm assumes no namespace (null) to start.
|
||||
Optional<FlyString> namespace_;
|
||||
Optional<DeprecatedFlyString> namespace_;
|
||||
|
||||
// 2. Let prefix map be a new namespace prefix map.
|
||||
HashMap<FlyString, Vector<DeprecatedString>> prefix_map;
|
||||
HashMap<DeprecatedFlyString, Vector<DeprecatedString>> prefix_map;
|
||||
|
||||
// 3. Add the XML namespace with prefix value "xml" to prefix map.
|
||||
add_prefix_to_namespace_prefix_map(prefix_map, "xml"sv, Namespace::XML);
|
||||
|
@ -140,16 +140,16 @@ WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGC
|
|||
return serialize_node_to_xml_string_impl(root, namespace_, prefix_map, prefix_index, require_well_formed);
|
||||
}
|
||||
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element const& element, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document(DOM::Document const& document, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element const& element, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document(DOM::Document const& document, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_comment(DOM::Comment const& comment, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_text(DOM::Text const& text, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document_fragment(DOM::DocumentFragment const& document_fragment, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document_fragment(DOM::DocumentFragment const& document_fragment, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document_type(DOM::DocumentType const& document_type, RequireWellFormed require_well_formed);
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_processing_instruction(DOM::ProcessingInstruction const& processing_instruction, RequireWellFormed require_well_formed);
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization-algorithm
|
||||
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::NonnullGCPtr<DOM::Node> root, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::NonnullGCPtr<DOM::Node> root, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
{
|
||||
// Each of the following algorithms for producing an XML serialization of a DOM node take as input a node to serialize and the following arguments:
|
||||
// - A context namespace namespace
|
||||
|
@ -216,7 +216,7 @@ WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::Nonn
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-recording-the-namespace-information
|
||||
static Optional<DeprecatedString> record_namespace_information(DOM::Element const& element, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, HashMap<DeprecatedString, DeprecatedString>& local_prefix_map)
|
||||
static Optional<DeprecatedString> record_namespace_information(DOM::Element const& element, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, HashMap<DeprecatedString, DeprecatedString>& local_prefix_map)
|
||||
{
|
||||
// 1. Let default namespace attr value be null.
|
||||
Optional<DeprecatedString> default_namespace_attribute_value;
|
||||
|
@ -306,7 +306,7 @@ struct LocalNameSetEntry {
|
|||
};
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization-of-the-attributes
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element_attributes(DOM::Element const& element, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, HashMap<DeprecatedString, DeprecatedString> const& local_prefixes_map, bool ignore_namespace_definition_attribute, RequireWellFormed require_well_formed)
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element_attributes(DOM::Element const& element, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, HashMap<DeprecatedString, DeprecatedString> const& local_prefixes_map, bool ignore_namespace_definition_attribute, RequireWellFormed require_well_formed)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
|
||||
|
@ -459,7 +459,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element_attributes(DOM::E
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element const& element, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element const& element, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
|
||||
|
@ -486,7 +486,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
|
|||
bool ignore_namespace_definition_attribute = false;
|
||||
|
||||
// 6. Given prefix map, copy a namespace prefix map and let map be the result.
|
||||
HashMap<FlyString, Vector<DeprecatedString>> map;
|
||||
HashMap<DeprecatedFlyString, Vector<DeprecatedString>> map;
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dfn-copy-a-namespace-prefix-map
|
||||
// NOTE: This is only used here.
|
||||
|
@ -701,7 +701,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#xml-serializing-a-document-node
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document(DOM::Document const& document, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document(DOM::Document const& document, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
{
|
||||
// If the require well-formed flag is set (its value is true), and this node has no documentElement (the documentElement attribute's value is null),
|
||||
// then throw an exception; the serialization of this node would not be a well-formed document.
|
||||
|
@ -763,7 +763,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_text(DOM::Text const& tex
|
|||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#xml-serializing-a-documentfragment-node
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document_fragment(DOM::DocumentFragment const& document_fragment, Optional<FlyString>& namespace_, HashMap<FlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
static WebIDL::ExceptionOr<DeprecatedString> serialize_document_fragment(DOM::DocumentFragment const& document_fragment, Optional<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, Vector<DeprecatedString>>& namespace_prefix_map, u64& prefix_index, RequireWellFormed require_well_formed)
|
||||
{
|
||||
// 1. Let markup the empty string.
|
||||
StringBuilder markup;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue