diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/DOMParsing')
-rw-r--r-- | Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp | 22 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h | 5 |
2 files changed, 13 insertions, 14 deletions
diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp index 869401c5c8..6274ede44a 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp @@ -42,7 +42,7 @@ JS::ThrowCompletionOr<void> XMLSerializer::initialize(JS::Realm& realm) } // https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring -WebIDL::ExceptionOr<DeprecatedString> XMLSerializer::serialize_to_string(JS::NonnullGCPtr<DOM::Node> root) +WebIDL::ExceptionOr<DeprecatedString> XMLSerializer::serialize_to_string(JS::NonnullGCPtr<DOM::Node const> root) { // The serializeToString(root) method must produce an XML serialization of root passing a value of false for the require well-formed parameter, and return the result. return serialize_node_to_xml_string(root, RequireWellFormed::No); @@ -121,10 +121,10 @@ static bool prefix_is_in_prefix_map(DeprecatedString const& prefix, HashMap<Depr return candidates_list_iterator->value.contains_slow(prefix); } -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); +WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::NonnullGCPtr<DOM::Node const> 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) +WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node const> root, RequireWellFormed require_well_formed) { // 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 @@ -157,7 +157,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_document_type(DOM::Docume 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<DeprecatedFlyString>& namespace_, HashMap<DeprecatedFlyString, 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 const> 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 @@ -173,43 +173,43 @@ WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string_impl(JS::Nonn if (is<DOM::Element>(*root)) { // -> Element // Run the algorithm for XML serializing an Element node node. - return serialize_element(static_cast<DOM::Element&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); + return serialize_element(static_cast<DOM::Element const&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); } if (is<DOM::Document>(*root)) { // -> Document // Run the algorithm for XML serializing a Document node node. - return serialize_document(static_cast<DOM::Document&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); + return serialize_document(static_cast<DOM::Document const&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); } if (is<DOM::Comment>(*root)) { // -> Comment // Run the algorithm for XML serializing a Comment node node. - return serialize_comment(static_cast<DOM::Comment&>(*root), require_well_formed); + return serialize_comment(static_cast<DOM::Comment const&>(*root), require_well_formed); } if (is<DOM::Text>(*root) || is<DOM::CDATASection>(*root)) { // -> Text // Run the algorithm for XML serializing a Text node node. - return serialize_text(static_cast<DOM::Text&>(*root), require_well_formed); + return serialize_text(static_cast<DOM::Text const&>(*root), require_well_formed); } if (is<DOM::DocumentFragment>(*root)) { // -> DocumentFragment // Run the algorithm for XML serializing a DocumentFragment node node. - return serialize_document_fragment(static_cast<DOM::DocumentFragment&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); + return serialize_document_fragment(static_cast<DOM::DocumentFragment const&>(*root), namespace_, namespace_prefix_map, prefix_index, require_well_formed); } if (is<DOM::DocumentType>(*root)) { // -> DocumentType // Run the algorithm for XML serializing a DocumentType node node. - return serialize_document_type(static_cast<DOM::DocumentType&>(*root), require_well_formed); + return serialize_document_type(static_cast<DOM::DocumentType const&>(*root), require_well_formed); } if (is<DOM::ProcessingInstruction>(*root)) { // -> ProcessingInstruction // Run the algorithm for XML serializing a ProcessingInstruction node node. - return serialize_processing_instruction(static_cast<DOM::ProcessingInstruction&>(*root), require_well_formed); + return serialize_processing_instruction(static_cast<DOM::ProcessingInstruction const&>(*root), require_well_formed); } if (is<DOM::Attr>(*root)) { diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h index 2f82d0d073..411ce23d17 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h @@ -18,7 +18,7 @@ public: virtual ~XMLSerializer() override; - WebIDL::ExceptionOr<DeprecatedString> serialize_to_string(JS::NonnullGCPtr<DOM::Node> root); + WebIDL::ExceptionOr<DeprecatedString> serialize_to_string(JS::NonnullGCPtr<DOM::Node const> root); private: explicit XMLSerializer(JS::Realm&); @@ -31,6 +31,5 @@ enum class RequireWellFormed { Yes, }; -WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node> root, RequireWellFormed require_well_formed); - +WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node const> root, RequireWellFormed require_well_formed); } |