LibWeb: Prefer using equals_ignoring_ascii_case

Which has an optmization if both size of the string being passed
through are FlyStrings, which actually ends up being the case
in some places during selector matching comparing attribute names.
Instead of maintaining more overloads of
Infra::is_ascii_case_insensitive_match, switch
everything over to equals_ignoring_ascii_case instead.
This commit is contained in:
Shannon Booth 2025-05-18 15:04:56 +12:00 committed by Sam Atkins
parent cfc241f61d
commit 579730d861
Notes: github-actions[bot] 2025-05-21 12:46:04 +00:00
24 changed files with 78 additions and 87 deletions

View file

@ -432,8 +432,8 @@ String HTMLFormElement::action_from_form_element(GC::Ref<HTMLElement> element) c
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-attributes:attr-fs-method-2
static HTMLFormElement::MethodAttributeState method_attribute_to_method_state(StringView method)
{
#define __ENUMERATE_FORM_METHOD_ATTRIBUTE(keyword, state) \
if (Infra::is_ascii_case_insensitive_match(#keyword##sv, method)) \
#define __ENUMERATE_FORM_METHOD_ATTRIBUTE(keyword, state) \
if (#keyword##sv.equals_ignoring_ascii_case(method)) \
return HTMLFormElement::MethodAttributeState::state;
ENUMERATE_FORM_METHOD_ATTRIBUTES
#undef __ENUMERATE_FORM_METHOD_ATTRIBUTE
@ -467,8 +467,8 @@ HTMLFormElement::MethodAttributeState HTMLFormElement::method_state_from_form_el
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-attributes:attr-fs-enctype-2
static HTMLFormElement::EncodingTypeAttributeState encoding_type_attribute_to_encoding_type_state(StringView encoding_type)
{
#define __ENUMERATE_FORM_METHOD_ENCODING_TYPE(keyword, state) \
if (Infra::is_ascii_case_insensitive_match(keyword##sv, encoding_type)) \
#define __ENUMERATE_FORM_METHOD_ENCODING_TYPE(keyword, state) \
if (keyword##sv.equals_ignoring_ascii_case(encoding_type)) \
return HTMLFormElement::EncodingTypeAttributeState::state;
ENUMERATE_FORM_METHOD_ENCODING_TYPES
#undef __ENUMERATE_FORM_METHOD_ENCODING_TYPE