LibWeb: Port HTML parser quirk public IDs to StringView

These were DeprecatedFlyStrings, but had no reason to be. We were not
making use of the O(1) lookup, so instead of porting it over to a
FlyString, just make it a StringView.
This commit is contained in:
Shannon Booth 2023-11-05 11:50:00 +13:00 committed by Andreas Kling
parent 1f8d72da8e
commit c8a4fc6c1a
Notes: sideshowbarker 2024-07-17 03:30:41 +09:00

View file

@ -49,62 +49,62 @@ static inline void log_parse_error(SourceLocation const& location = SourceLocati
dbgln_if(HTML_PARSER_DEBUG, "Parse error! {}", location); dbgln_if(HTML_PARSER_DEBUG, "Parse error! {}", location);
} }
static Vector<DeprecatedFlyString> s_quirks_public_ids = { static Vector<StringView> const s_quirks_public_ids = {
"+//Silmaril//dtd html Pro v0r11 19970101//", "+//Silmaril//dtd html Pro v0r11 19970101//"sv,
"-//AS//DTD HTML 3.0 asWedit + extensions//", "-//AS//DTD HTML 3.0 asWedit + extensions//"sv,
"-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//", "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//"sv,
"-//IETF//DTD HTML 2.0 Level 1//", "-//IETF//DTD HTML 2.0 Level 1//"sv,
"-//IETF//DTD HTML 2.0 Level 2//", "-//IETF//DTD HTML 2.0 Level 2//"sv,
"-//IETF//DTD HTML 2.0 Strict Level 1//", "-//IETF//DTD HTML 2.0 Strict Level 1//"sv,
"-//IETF//DTD HTML 2.0 Strict Level 2//", "-//IETF//DTD HTML 2.0 Strict Level 2//"sv,
"-//IETF//DTD HTML 2.0 Strict//", "-//IETF//DTD HTML 2.0 Strict//"sv,
"-//IETF//DTD HTML 2.0//", "-//IETF//DTD HTML 2.0//"sv,
"-//IETF//DTD HTML 2.1E//", "-//IETF//DTD HTML 2.1E//"sv,
"-//IETF//DTD HTML 3.0//", "-//IETF//DTD HTML 3.0//"sv,
"-//IETF//DTD HTML 3.2 Final//", "-//IETF//DTD HTML 3.2 Final//"sv,
"-//IETF//DTD HTML 3.2//", "-//IETF//DTD HTML 3.2//"sv,
"-//IETF//DTD HTML 3//", "-//IETF//DTD HTML 3//"sv,
"-//IETF//DTD HTML Level 0//", "-//IETF//DTD HTML Level 0//"sv,
"-//IETF//DTD HTML Level 1//", "-//IETF//DTD HTML Level 1//"sv,
"-//IETF//DTD HTML Level 2//", "-//IETF//DTD HTML Level 2//"sv,
"-//IETF//DTD HTML Level 3//", "-//IETF//DTD HTML Level 3//"sv,
"-//IETF//DTD HTML Strict Level 0//", "-//IETF//DTD HTML Strict Level 0//"sv,
"-//IETF//DTD HTML Strict Level 1//", "-//IETF//DTD HTML Strict Level 1//"sv,
"-//IETF//DTD HTML Strict Level 2//", "-//IETF//DTD HTML Strict Level 2//"sv,
"-//IETF//DTD HTML Strict Level 3//", "-//IETF//DTD HTML Strict Level 3//"sv,
"-//IETF//DTD HTML Strict//", "-//IETF//DTD HTML Strict//"sv,
"-//IETF//DTD HTML//", "-//IETF//DTD HTML//"sv,
"-//Metrius//DTD Metrius Presentational//", "-//Metrius//DTD Metrius Presentational//"sv,
"-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//", "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//"sv,
"-//Microsoft//DTD Internet Explorer 2.0 HTML//", "-//Microsoft//DTD Internet Explorer 2.0 HTML//"sv,
"-//Microsoft//DTD Internet Explorer 2.0 Tables//", "-//Microsoft//DTD Internet Explorer 2.0 Tables//"sv,
"-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//", "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//"sv,
"-//Microsoft//DTD Internet Explorer 3.0 HTML//", "-//Microsoft//DTD Internet Explorer 3.0 HTML//"sv,
"-//Microsoft//DTD Internet Explorer 3.0 Tables//", "-//Microsoft//DTD Internet Explorer 3.0 Tables//"sv,
"-//Netscape Comm. Corp.//DTD HTML//", "-//Netscape Comm. Corp.//DTD HTML//"sv,
"-//Netscape Comm. Corp.//DTD Strict HTML//", "-//Netscape Comm. Corp.//DTD Strict HTML//"sv,
"-//O'Reilly and Associates//DTD HTML 2.0//", "-//O'Reilly and Associates//DTD HTML 2.0//"sv,
"-//O'Reilly and Associates//DTD HTML Extended 1.0//", "-//O'Reilly and Associates//DTD HTML Extended 1.0//"sv,
"-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//", "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//"sv,
"-//SQ//DTD HTML 2.0 HoTMetaL + extensions//", "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//"sv,
"-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//", "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//"sv,
"-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//", "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//"sv,
"-//Spyglass//DTD HTML 2.0 Extended//", "-//Spyglass//DTD HTML 2.0 Extended//"sv,
"-//Sun Microsystems Corp.//DTD HotJava HTML//", "-//Sun Microsystems Corp.//DTD HotJava HTML//"sv,
"-//Sun Microsystems Corp.//DTD HotJava Strict HTML//", "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//"sv,
"-//W3C//DTD HTML 3 1995-03-24//", "-//W3C//DTD HTML 3 1995-03-24//"sv,
"-//W3C//DTD HTML 3.2 Draft//", "-//W3C//DTD HTML 3.2 Draft//"sv,
"-//W3C//DTD HTML 3.2 Final//", "-//W3C//DTD HTML 3.2 Final//"sv,
"-//W3C//DTD HTML 3.2//", "-//W3C//DTD HTML 3.2//"sv,
"-//W3C//DTD HTML 3.2S Draft//", "-//W3C//DTD HTML 3.2S Draft//"sv,
"-//W3C//DTD HTML 4.0 Frameset//", "-//W3C//DTD HTML 4.0 Frameset//"sv,
"-//W3C//DTD HTML 4.0 Transitional//", "-//W3C//DTD HTML 4.0 Transitional//"sv,
"-//W3C//DTD HTML Experimental 19960712//", "-//W3C//DTD HTML Experimental 19960712//"sv,
"-//W3C//DTD HTML Experimental 970421//", "-//W3C//DTD HTML Experimental 970421//"sv,
"-//W3C//DTD W3 HTML//", "-//W3C//DTD W3 HTML//"sv,
"-//W3O//DTD W3 HTML 3.0//", "-//W3O//DTD W3 HTML 3.0//"sv,
"-//WebTechs//DTD Mozilla HTML 2.0//", "-//WebTechs//DTD Mozilla HTML 2.0//"sv,
"-//WebTechs//DTD Mozilla HTML//" "-//WebTechs//DTD Mozilla HTML//"sv,
}; };
// https://html.spec.whatwg.org/multipage/parsing.html#mathml-text-integration-point // https://html.spec.whatwg.org/multipage/parsing.html#mathml-text-integration-point
@ -456,7 +456,7 @@ DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) co
if (system_identifier.equals_ignoring_ascii_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"sv)) if (system_identifier.equals_ignoring_ascii_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"sv))
return DOM::QuirksMode::Yes; return DOM::QuirksMode::Yes;
for (auto& public_id : s_quirks_public_ids) { for (auto const& public_id : s_quirks_public_ids) {
if (public_identifier.starts_with_bytes(public_id, CaseSensitivity::CaseInsensitive)) if (public_identifier.starts_with_bytes(public_id, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Yes; return DOM::QuirksMode::Yes;
} }