mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibWeb: Change HTMLParser's factory to accept the encoding as StringView
No need to force an allocation. This makes a future patch a bit simpler, where we will have the encoding as a String. With this patch, we won't have to convert it to a ByteString.
This commit is contained in:
parent
683c08744a
commit
48fb343230
Notes:
sideshowbarker
2024-07-17 05:18:58 +09:00
Author: https://github.com/trflynn89
Commit: 48fb343230
Pull-request: https://github.com/SerenityOS/serenity/pull/23830
Reviewed-by: https://github.com/shannonbooth ✅
5 changed files with 8 additions and 8 deletions
|
@ -132,7 +132,7 @@ static bool is_html_integration_point(DOM::Element const& element)
|
|||
return false;
|
||||
}
|
||||
|
||||
HTMLParser::HTMLParser(DOM::Document& document, StringView input, ByteString const& encoding)
|
||||
HTMLParser::HTMLParser(DOM::Document& document, StringView input, StringView encoding)
|
||||
: m_tokenizer(input, encoding)
|
||||
, m_scripting_enabled(document.is_scripting_enabled())
|
||||
, m_document(JS::make_handle(document))
|
||||
|
@ -4144,7 +4144,7 @@ Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& cont
|
|||
temp_document->set_quirks_mode(context_element.document().mode());
|
||||
|
||||
// 3. Create a new HTML parser, and associate it with the just created Document node.
|
||||
auto parser = HTMLParser::create(*temp_document, markup, "utf-8");
|
||||
auto parser = HTMLParser::create(*temp_document, markup, "utf-8"sv);
|
||||
parser->m_context_element = JS::make_handle(context_element);
|
||||
parser->m_parsing_fragment = true;
|
||||
|
||||
|
@ -4239,7 +4239,7 @@ JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Doc
|
|||
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, ByteString const& encoding)
|
||||
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, StringView encoding)
|
||||
{
|
||||
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue