mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
LibTextCodec: Don't allocate Strings on encoding normalisation
This ripples down to LibWeb's HTML and XHR decoders, which therefore become less allocation heavy.
This commit is contained in:
parent
820e03e8d4
commit
6a95df2526
6 changed files with 48 additions and 48 deletions
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue