diff options
author | Hendiadyoin1 <leon.a@serenityos.org> | 2022-03-21 00:09:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-21 10:48:17 +0100 |
commit | 6a95df25264b4f5e616608dd02826b61e25e1112 (patch) | |
tree | f224c66d2303df5f29ab4e3b4bc65ee170b1a4a1 /Userland/Libraries/LibWeb/HTML/Parser | |
parent | 820e03e8d4e197063be409c39d582800e98d0259 (diff) | |
download | serenity-6a95df25264b4f5e616608dd02826b61e25e1112.zip |
LibTextCodec: Don't allocate Strings on encoding normalisation
This ripples down to LibWeb's HTML and XHR decoders, which therefore
become less allocation heavy.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index f0c5c524b1..2a9b622df5 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -34,7 +34,7 @@ bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& positi } // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#algorithm-for-extracting-a-character-encoding-from-a-meta-element -Optional<String> extract_character_encoding_from_meta_element(String const& string) +Optional<StringView> extract_character_encoding_from_meta_element(String const& string) { // Checking for "charset" is case insensitive, as is getting an encoding. // Therefore, stick to lowercase from the start for simplicity. diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h index 52784e8d7c..e388b68d99 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h @@ -15,7 +15,7 @@ namespace Web::HTML { bool prescan_should_abort(const ByteBuffer& input, const size_t& position); bool prescan_is_whitespace_or_slash(const u8& byte); bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position); -Optional<String> extract_character_encoding_from_meta_element(String const&); +Optional<StringView> extract_character_encoding_from_meta_element(String const&); RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, const ByteBuffer& input, size_t& position); Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, const ByteBuffer& input); String run_encoding_sniffing_algorithm(DOM::Document&, const ByteBuffer& input); |