mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:07:45 +00:00
Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
This commit is contained in:
parent
03cc45e5a2
commit
a504ac3e2a
76 changed files with 480 additions and 476 deletions
|
@ -28,13 +28,13 @@ StringView role_name(Role role)
|
|||
Optional<Role> role_from_string(StringView role_name)
|
||||
{
|
||||
// Note: "switch" is mapped to Role::switch_ (due to C++ keyword clash)
|
||||
#define __ENUMERATE_ARIA_ROLE(name) \
|
||||
if constexpr (Role::name == Role::switch_) { \
|
||||
if (role_name.equals_ignoring_case("switch"sv)) \
|
||||
return Role::switch_; \
|
||||
} else { \
|
||||
if (role_name.equals_ignoring_case(#name##sv)) \
|
||||
return Role::name; \
|
||||
#define __ENUMERATE_ARIA_ROLE(name) \
|
||||
if constexpr (Role::name == Role::switch_) { \
|
||||
if (role_name.equals_ignoring_ascii_case("switch"sv)) \
|
||||
return Role::switch_; \
|
||||
} else { \
|
||||
if (role_name.equals_ignoring_ascii_case(#name##sv)) \
|
||||
return Role::name; \
|
||||
}
|
||||
ENUMERATE_ARIA_ROLES
|
||||
#undef __ENUMERATE_ARIA_ROLE
|
||||
|
|
|
@ -84,13 +84,16 @@ StringView Angle::unit_name() const
|
|||
|
||||
Optional<Angle::Type> Angle::unit_from_name(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("deg"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("deg"sv)) {
|
||||
return Type::Deg;
|
||||
} else if (name.equals_ignoring_case("grad"sv)) {
|
||||
}
|
||||
if (name.equals_ignoring_ascii_case("grad"sv)) {
|
||||
return Type::Grad;
|
||||
} else if (name.equals_ignoring_case("rad"sv)) {
|
||||
}
|
||||
if (name.equals_ignoring_ascii_case("rad"sv)) {
|
||||
return Type::Rad;
|
||||
} else if (name.equals_ignoring_case("turn"sv)) {
|
||||
}
|
||||
if (name.equals_ignoring_ascii_case("turn"sv)) {
|
||||
return Type::Turn;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -75,9 +75,9 @@ StringView Frequency::unit_name() const
|
|||
|
||||
Optional<Frequency::Type> Frequency::unit_from_name(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("hz"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("hz"sv)) {
|
||||
return Type::Hz;
|
||||
} else if (name.equals_ignoring_case("khz"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("khz"sv)) {
|
||||
return Type::kHz;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -164,35 +164,35 @@ char const* Length::unit_name() const
|
|||
|
||||
Optional<Length::Type> Length::unit_from_name(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("px"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("px"sv)) {
|
||||
return Length::Type::Px;
|
||||
} else if (name.equals_ignoring_case("pt"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("pt"sv)) {
|
||||
return Length::Type::Pt;
|
||||
} else if (name.equals_ignoring_case("pc"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("pc"sv)) {
|
||||
return Length::Type::Pc;
|
||||
} else if (name.equals_ignoring_case("mm"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("mm"sv)) {
|
||||
return Length::Type::Mm;
|
||||
} else if (name.equals_ignoring_case("rem"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("rem"sv)) {
|
||||
return Length::Type::Rem;
|
||||
} else if (name.equals_ignoring_case("em"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("em"sv)) {
|
||||
return Length::Type::Em;
|
||||
} else if (name.equals_ignoring_case("ex"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("ex"sv)) {
|
||||
return Length::Type::Ex;
|
||||
} else if (name.equals_ignoring_case("ch"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("ch"sv)) {
|
||||
return Length::Type::Ch;
|
||||
} else if (name.equals_ignoring_case("vw"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vw"sv)) {
|
||||
return Length::Type::Vw;
|
||||
} else if (name.equals_ignoring_case("vh"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vh"sv)) {
|
||||
return Length::Type::Vh;
|
||||
} else if (name.equals_ignoring_case("vmax"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vmax"sv)) {
|
||||
return Length::Type::Vmax;
|
||||
} else if (name.equals_ignoring_case("vmin"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vmin"sv)) {
|
||||
return Length::Type::Vmin;
|
||||
} else if (name.equals_ignoring_case("cm"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("cm"sv)) {
|
||||
return Length::Type::Cm;
|
||||
} else if (name.equals_ignoring_case("in"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("in"sv)) {
|
||||
return Length::Type::In;
|
||||
} else if (name.equals_ignoring_case("Q"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("Q"sv)) {
|
||||
return Length::Type::Q;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,51 +393,51 @@ ErrorOr<String> serialize_a_media_query_list(Vector<NonnullRefPtr<MediaQuery>> c
|
|||
bool is_media_feature_name(StringView name)
|
||||
{
|
||||
// MEDIAQUERIES-4 - https://www.w3.org/TR/mediaqueries-4/#media-descriptor-table
|
||||
if (name.equals_ignoring_case("any-hover"sv))
|
||||
if (name.equals_ignoring_ascii_case("any-hover"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("any-pointer"sv))
|
||||
if (name.equals_ignoring_ascii_case("any-pointer"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("aspect-ratio"sv))
|
||||
if (name.equals_ignoring_ascii_case("aspect-ratio"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("color"sv))
|
||||
if (name.equals_ignoring_ascii_case("color"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("color-gamut"sv))
|
||||
if (name.equals_ignoring_ascii_case("color-gamut"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("color-index"sv))
|
||||
if (name.equals_ignoring_ascii_case("color-index"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("device-aspect-ratio"sv))
|
||||
if (name.equals_ignoring_ascii_case("device-aspect-ratio"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("device-height"sv))
|
||||
if (name.equals_ignoring_ascii_case("device-height"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("device-width"sv))
|
||||
if (name.equals_ignoring_ascii_case("device-width"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("grid"sv))
|
||||
if (name.equals_ignoring_ascii_case("grid"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("height"sv))
|
||||
if (name.equals_ignoring_ascii_case("height"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("hover"sv))
|
||||
if (name.equals_ignoring_ascii_case("hover"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("monochrome"sv))
|
||||
if (name.equals_ignoring_ascii_case("monochrome"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("orientation"sv))
|
||||
if (name.equals_ignoring_ascii_case("orientation"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("overflow-block"sv))
|
||||
if (name.equals_ignoring_ascii_case("overflow-block"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("overflow-inline"sv))
|
||||
if (name.equals_ignoring_ascii_case("overflow-inline"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("pointer"sv))
|
||||
if (name.equals_ignoring_ascii_case("pointer"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("resolution"sv))
|
||||
if (name.equals_ignoring_ascii_case("resolution"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("scan"sv))
|
||||
if (name.equals_ignoring_ascii_case("scan"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("update"sv))
|
||||
if (name.equals_ignoring_ascii_case("update"sv))
|
||||
return true;
|
||||
if (name.equals_ignoring_case("width"sv))
|
||||
if (name.equals_ignoring_ascii_case("width"sv))
|
||||
return true;
|
||||
|
||||
// MEDIAQUERIES-5 - https://www.w3.org/TR/mediaqueries-5/#media-descriptor-table
|
||||
if (name.equals_ignoring_case("prefers-color-scheme"sv))
|
||||
if (name.equals_ignoring_ascii_case("prefers-color-scheme"sv))
|
||||
return true;
|
||||
// FIXME: Add other level 5 feature names
|
||||
|
||||
|
@ -446,27 +446,27 @@ bool is_media_feature_name(StringView name)
|
|||
|
||||
MediaQuery::MediaType media_type_from_string(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("all"sv))
|
||||
if (name.equals_ignoring_ascii_case("all"sv))
|
||||
return MediaQuery::MediaType::All;
|
||||
if (name.equals_ignoring_case("aural"sv))
|
||||
if (name.equals_ignoring_ascii_case("aural"sv))
|
||||
return MediaQuery::MediaType::Aural;
|
||||
if (name.equals_ignoring_case("braille"sv))
|
||||
if (name.equals_ignoring_ascii_case("braille"sv))
|
||||
return MediaQuery::MediaType::Braille;
|
||||
if (name.equals_ignoring_case("embossed"sv))
|
||||
if (name.equals_ignoring_ascii_case("embossed"sv))
|
||||
return MediaQuery::MediaType::Embossed;
|
||||
if (name.equals_ignoring_case("handheld"sv))
|
||||
if (name.equals_ignoring_ascii_case("handheld"sv))
|
||||
return MediaQuery::MediaType::Handheld;
|
||||
if (name.equals_ignoring_case("print"sv))
|
||||
if (name.equals_ignoring_ascii_case("print"sv))
|
||||
return MediaQuery::MediaType::Print;
|
||||
if (name.equals_ignoring_case("projection"sv))
|
||||
if (name.equals_ignoring_ascii_case("projection"sv))
|
||||
return MediaQuery::MediaType::Projection;
|
||||
if (name.equals_ignoring_case("screen"sv))
|
||||
if (name.equals_ignoring_ascii_case("screen"sv))
|
||||
return MediaQuery::MediaType::Screen;
|
||||
if (name.equals_ignoring_case("speech"sv))
|
||||
if (name.equals_ignoring_ascii_case("speech"sv))
|
||||
return MediaQuery::MediaType::Speech;
|
||||
if (name.equals_ignoring_case("tty"sv))
|
||||
if (name.equals_ignoring_ascii_case("tty"sv))
|
||||
return MediaQuery::MediaType::TTY;
|
||||
if (name.equals_ignoring_case("tv"sv))
|
||||
if (name.equals_ignoring_ascii_case("tv"sv))
|
||||
return MediaQuery::MediaType::TV;
|
||||
return MediaQuery::MediaType::Unknown;
|
||||
}
|
||||
|
|
|
@ -360,9 +360,9 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_attribute_simple_se
|
|||
auto const& case_sensitivity_part = attribute_tokens.next_token();
|
||||
if (case_sensitivity_part.is(Token::Type::Ident)) {
|
||||
auto case_sensitivity = case_sensitivity_part.token().ident();
|
||||
if (case_sensitivity.equals_ignoring_case("i"sv)) {
|
||||
if (case_sensitivity.equals_ignoring_ascii_case("i"sv)) {
|
||||
simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseInsensitiveMatch;
|
||||
} else if (case_sensitivity.equals_ignoring_case("s"sv)) {
|
||||
} else if (case_sensitivity.equals_ignoring_ascii_case("s"sv)) {
|
||||
simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseSensitiveMatch;
|
||||
} else {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Expected a \"i\" or \"s\" attribute selector case sensitivity identifier, got: '{}'", case_sensitivity_part.to_debug_string());
|
||||
|
@ -443,39 +443,39 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
};
|
||||
};
|
||||
|
||||
if (pseudo_name.equals_ignoring_case("active"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("active"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Active);
|
||||
if (pseudo_name.equals_ignoring_case("checked"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("checked"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Checked);
|
||||
if (pseudo_name.equals_ignoring_case("disabled"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("disabled"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Disabled);
|
||||
if (pseudo_name.equals_ignoring_case("empty"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("empty"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Empty);
|
||||
if (pseudo_name.equals_ignoring_case("enabled"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("enabled"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Enabled);
|
||||
if (pseudo_name.equals_ignoring_case("first-child"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("first-child"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstChild);
|
||||
if (pseudo_name.equals_ignoring_case("first-of-type"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("first-of-type"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstOfType);
|
||||
if (pseudo_name.equals_ignoring_case("focus"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("focus"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Focus);
|
||||
if (pseudo_name.equals_ignoring_case("focus-within"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("focus-within"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FocusWithin);
|
||||
if (pseudo_name.equals_ignoring_case("hover"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("hover"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Hover);
|
||||
if (pseudo_name.equals_ignoring_case("last-child"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("last-child"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastChild);
|
||||
if (pseudo_name.equals_ignoring_case("last-of-type"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("last-of-type"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastOfType);
|
||||
if (pseudo_name.equals_ignoring_case("link"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("link"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Link);
|
||||
if (pseudo_name.equals_ignoring_case("only-child"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("only-child"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyChild);
|
||||
if (pseudo_name.equals_ignoring_case("only-of-type"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("only-of-type"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyOfType);
|
||||
if (pseudo_name.equals_ignoring_case("root"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("root"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Root);
|
||||
if (pseudo_name.equals_ignoring_case("visited"sv))
|
||||
if (pseudo_name.equals_ignoring_ascii_case("visited"sv))
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Visited);
|
||||
|
||||
// Single-colon syntax allowed for ::after, ::before, ::first-letter and ::first-line for compatibility.
|
||||
|
@ -523,7 +523,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
|
||||
// Parse the `of <selector-list>` syntax
|
||||
auto const& maybe_of = tokens.next_token();
|
||||
if (!(maybe_of.is(Token::Type::Ident) && maybe_of.token().ident().equals_ignoring_case("of"sv)))
|
||||
if (!(maybe_of.is(Token::Type::Ident) && maybe_of.token().ident().equals_ignoring_ascii_case("of"sv)))
|
||||
return ParseError::SyntaxError;
|
||||
|
||||
tokens.skip_whitespace();
|
||||
|
@ -543,8 +543,8 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
};
|
||||
|
||||
auto const& pseudo_function = pseudo_class_token.function();
|
||||
if (pseudo_function.name().equals_ignoring_case("is"sv)
|
||||
|| pseudo_function.name().equals_ignoring_case("where"sv)) {
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("is"sv)
|
||||
|| pseudo_function.name().equals_ignoring_ascii_case("where"sv)) {
|
||||
auto function_token_stream = TokenStream(pseudo_function.values());
|
||||
// NOTE: Because it's forgiving, even complete garbage will parse OK as an empty selector-list.
|
||||
auto argument_selector_list = MUST(parse_a_selector_list(function_token_stream, SelectorType::Standalone, SelectorParsingMode::Forgiving));
|
||||
|
@ -552,13 +552,13 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
return Selector::SimpleSelector {
|
||||
.type = Selector::SimpleSelector::Type::PseudoClass,
|
||||
.value = Selector::SimpleSelector::PseudoClass {
|
||||
.type = pseudo_function.name().equals_ignoring_case("is"sv)
|
||||
.type = pseudo_function.name().equals_ignoring_ascii_case("is"sv)
|
||||
? Selector::SimpleSelector::PseudoClass::Type::Is
|
||||
: Selector::SimpleSelector::PseudoClass::Type::Where,
|
||||
.argument_selector_list = move(argument_selector_list) }
|
||||
};
|
||||
}
|
||||
if (pseudo_function.name().equals_ignoring_case("not"sv)) {
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("not"sv)) {
|
||||
auto function_token_stream = TokenStream(pseudo_function.values());
|
||||
auto not_selector = TRY(parse_a_selector_list(function_token_stream, SelectorType::Standalone));
|
||||
|
||||
|
@ -569,7 +569,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
.argument_selector_list = move(not_selector) }
|
||||
};
|
||||
}
|
||||
if (pseudo_function.name().equals_ignoring_case("lang"sv)) {
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("lang"sv)) {
|
||||
if (pseudo_function.values().is_empty()) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Empty :lang() selector");
|
||||
return ParseError::SyntaxError;
|
||||
|
@ -584,13 +584,13 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
.languages = move(languages) }
|
||||
};
|
||||
}
|
||||
if (pseudo_function.name().equals_ignoring_case("nth-child"sv))
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("nth-child"sv))
|
||||
return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthChild, pseudo_function.values(), true);
|
||||
if (pseudo_function.name().equals_ignoring_case("nth-last-child"sv))
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("nth-last-child"sv))
|
||||
return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthLastChild, pseudo_function.values(), true);
|
||||
if (pseudo_function.name().equals_ignoring_case("nth-of-type"sv))
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("nth-of-type"sv))
|
||||
return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthOfType, pseudo_function.values(), false);
|
||||
if (pseudo_function.name().equals_ignoring_case("nth-last-of-type"sv))
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("nth-last-of-type"sv))
|
||||
return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthLastOfType, pseudo_function.values(), false);
|
||||
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-class function: ':{}'()", pseudo_function.name());
|
||||
|
@ -720,11 +720,11 @@ NonnullRefPtr<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
return {};
|
||||
|
||||
auto ident = token.token().ident();
|
||||
if (ident.equals_ignoring_case("not"sv)) {
|
||||
if (ident.equals_ignoring_ascii_case("not"sv)) {
|
||||
transaction.commit();
|
||||
return true;
|
||||
}
|
||||
if (ident.equals_ignoring_case("only"sv)) {
|
||||
if (ident.equals_ignoring_ascii_case("only"sv)) {
|
||||
transaction.commit();
|
||||
return false;
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ NonnullRefPtr<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
return media_query;
|
||||
|
||||
// `[ and <media-condition-without-or> ]?`
|
||||
if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_case("and"sv)) {
|
||||
if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_ascii_case("and"sv)) {
|
||||
if (auto media_condition = parse_media_condition(tokens, MediaCondition::AllowOr::No)) {
|
||||
tokens.skip_whitespace();
|
||||
if (tokens.has_next_token())
|
||||
|
@ -800,7 +800,7 @@ OwnPtr<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
|
|||
tokens.skip_whitespace();
|
||||
|
||||
auto& first_token = tokens.next_token();
|
||||
if (first_token.is(Token::Type::Ident) && first_token.token().ident().equals_ignoring_case("not"sv)) {
|
||||
if (first_token.is(Token::Type::Ident) && first_token.token().ident().equals_ignoring_ascii_case("not"sv)) {
|
||||
if (auto child_condition = parse_media_condition(tokens, MediaCondition::AllowOr::Yes)) {
|
||||
local_transaction.commit();
|
||||
return MediaCondition::from_not(child_condition.release_nonnull());
|
||||
|
@ -815,7 +815,7 @@ OwnPtr<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
|
|||
tokens.skip_whitespace();
|
||||
|
||||
auto& first = tokens.next_token();
|
||||
if (first.is(Token::Type::Ident) && first.token().ident().equals_ignoring_case(combinator)) {
|
||||
if (first.is(Token::Type::Ident) && first.token().ident().equals_ignoring_ascii_case(combinator)) {
|
||||
tokens.skip_whitespace();
|
||||
if (auto media_in_parens = parse_media_in_parens(tokens)) {
|
||||
local_transaction.commit();
|
||||
|
@ -1296,7 +1296,7 @@ OwnPtr<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
|
||||
auto const& peeked_token = tokens.peek_token();
|
||||
// `not <supports-in-parens>`
|
||||
if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_case("not"sv)) {
|
||||
if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_ascii_case("not"sv)) {
|
||||
tokens.next_token();
|
||||
tokens.skip_whitespace();
|
||||
auto child = parse_supports_in_parens(tokens);
|
||||
|
@ -1318,9 +1318,9 @@ OwnPtr<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto ident = token.token().ident();
|
||||
if (ident.equals_ignoring_case("and"sv))
|
||||
if (ident.equals_ignoring_ascii_case("and"sv))
|
||||
return Supports::Condition::Type::And;
|
||||
if (ident.equals_ignoring_case("or"sv))
|
||||
if (ident.equals_ignoring_ascii_case("or"sv))
|
||||
return Supports::Condition::Type::Or;
|
||||
return {};
|
||||
};
|
||||
|
@ -1415,7 +1415,7 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
|
|||
}
|
||||
|
||||
// `<supports-selector-fn>`
|
||||
if (first_token.is_function() && first_token.function().name().equals_ignoring_case("selector"sv)) {
|
||||
if (first_token.is_function() && first_token.function().name().equals_ignoring_ascii_case("selector"sv)) {
|
||||
// FIXME: Parsing and then converting back to a string is weird.
|
||||
StringBuilder builder;
|
||||
for (auto const& item : first_token.function().values())
|
||||
|
@ -2291,7 +2291,7 @@ Optional<AK::URL> Parser::parse_url_function(ComponentValue const& component_val
|
|||
auto url_string = component_value.token().url();
|
||||
return convert_string_to_url(url_string);
|
||||
}
|
||||
if (component_value.is_function() && component_value.function().name().equals_ignoring_case("url"sv)) {
|
||||
if (component_value.is_function() && component_value.function().name().equals_ignoring_ascii_case("url"sv)) {
|
||||
auto const& function_values = component_value.function().values();
|
||||
// FIXME: Handle url-modifiers. https://www.w3.org/TR/css-values-4/#url-modifiers
|
||||
for (size_t i = 0; i < function_values.size(); ++i) {
|
||||
|
@ -2453,7 +2453,7 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const&
|
|||
repeating_gradient = GradientRepeating::Yes;
|
||||
});
|
||||
|
||||
if (!function_name.equals_ignoring_case("linear-gradient"sv))
|
||||
if (!function_name.equals_ignoring_ascii_case("linear-gradient"sv))
|
||||
return {};
|
||||
|
||||
// linear-gradient() = linear-gradient([ <angle> | to <side-or-corner> ]?, <color-stop-list>)
|
||||
|
@ -2470,13 +2470,13 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const&
|
|||
: SideOrCorner::Top;
|
||||
|
||||
auto to_side = [](StringView value) -> Optional<SideOrCorner> {
|
||||
if (value.equals_ignoring_case("top"sv))
|
||||
if (value.equals_ignoring_ascii_case("top"sv))
|
||||
return SideOrCorner::Top;
|
||||
if (value.equals_ignoring_case("bottom"sv))
|
||||
if (value.equals_ignoring_ascii_case("bottom"sv))
|
||||
return SideOrCorner::Bottom;
|
||||
if (value.equals_ignoring_case("left"sv))
|
||||
if (value.equals_ignoring_ascii_case("left"sv))
|
||||
return SideOrCorner::Left;
|
||||
if (value.equals_ignoring_case("right"sv))
|
||||
if (value.equals_ignoring_ascii_case("right"sv))
|
||||
return SideOrCorner::Right;
|
||||
return {};
|
||||
};
|
||||
|
@ -2486,7 +2486,7 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const&
|
|||
return false;
|
||||
if (gradient_type == GradientType::WebKit)
|
||||
return to_side(token.token().ident()).has_value();
|
||||
return token.token().ident().equals_ignoring_case("to"sv);
|
||||
return token.token().ident().equals_ignoring_ascii_case("to"sv);
|
||||
};
|
||||
|
||||
auto const& first_param = tokens.peek_token();
|
||||
|
@ -2574,7 +2574,7 @@ RefPtr<StyleValue> Parser::parse_conic_gradient_function(ComponentValue const& c
|
|||
repeating_gradient = GradientRepeating::Yes;
|
||||
});
|
||||
|
||||
if (!function_name.equals_ignoring_case("conic-gradient"sv))
|
||||
if (!function_name.equals_ignoring_ascii_case("conic-gradient"sv))
|
||||
return {};
|
||||
|
||||
TokenStream tokens { component_value.function().values() };
|
||||
|
@ -2595,7 +2595,7 @@ RefPtr<StyleValue> Parser::parse_conic_gradient_function(ComponentValue const& c
|
|||
while (token.is(Token::Type::Ident)) {
|
||||
auto consume_identifier = [&](auto identifier) {
|
||||
auto token_string = token.token().ident();
|
||||
if (token_string.equals_ignoring_case(identifier)) {
|
||||
if (token_string.equals_ignoring_ascii_case(identifier)) {
|
||||
(void)tokens.next_token();
|
||||
tokens.skip_whitespace();
|
||||
return true;
|
||||
|
@ -2677,7 +2677,7 @@ RefPtr<StyleValue> Parser::parse_radial_gradient_function(ComponentValue const&
|
|||
repeating_gradient = GradientRepeating::Yes;
|
||||
});
|
||||
|
||||
if (!function_name.equals_ignoring_case("radial-gradient"sv))
|
||||
if (!function_name.equals_ignoring_ascii_case("radial-gradient"sv))
|
||||
return {};
|
||||
|
||||
TokenStream tokens { component_value.function().values() };
|
||||
|
@ -2705,21 +2705,21 @@ RefPtr<StyleValue> Parser::parse_radial_gradient_function(ComponentValue const&
|
|||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto ident = token.token().ident();
|
||||
if (ident.equals_ignoring_case("circle"sv))
|
||||
if (ident.equals_ignoring_ascii_case("circle"sv))
|
||||
return commit_value(EndingShape::Circle, transaction);
|
||||
if (ident.equals_ignoring_case("ellipse"sv))
|
||||
if (ident.equals_ignoring_ascii_case("ellipse"sv))
|
||||
return commit_value(EndingShape::Ellipse, transaction);
|
||||
return {};
|
||||
};
|
||||
|
||||
auto parse_extent_keyword = [](StringView keyword) -> Optional<Extent> {
|
||||
if (keyword.equals_ignoring_case("closest-corner"sv))
|
||||
if (keyword.equals_ignoring_ascii_case("closest-corner"sv))
|
||||
return Extent::ClosestCorner;
|
||||
if (keyword.equals_ignoring_case("closest-side"sv))
|
||||
if (keyword.equals_ignoring_ascii_case("closest-side"sv))
|
||||
return Extent::ClosestSide;
|
||||
if (keyword.equals_ignoring_case("farthest-corner"sv))
|
||||
if (keyword.equals_ignoring_ascii_case("farthest-corner"sv))
|
||||
return Extent::FarthestCorner;
|
||||
if (keyword.equals_ignoring_case("farthest-side"sv))
|
||||
if (keyword.equals_ignoring_ascii_case("farthest-side"sv))
|
||||
return Extent::FarthestSide;
|
||||
return {};
|
||||
};
|
||||
|
@ -2786,7 +2786,7 @@ RefPtr<StyleValue> Parser::parse_radial_gradient_function(ComponentValue const&
|
|||
return {};
|
||||
|
||||
auto& token = tokens.peek_token();
|
||||
if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("at"sv)) {
|
||||
if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("at"sv)) {
|
||||
(void)tokens.next_token();
|
||||
auto position = parse_position(tokens);
|
||||
if (!position.has_value())
|
||||
|
@ -2817,37 +2817,37 @@ Optional<PositionValue> Parser::parse_position(TokenStream<ComponentValue>& toke
|
|||
return {};
|
||||
|
||||
auto parse_horizontal_preset = [&](auto ident) -> Optional<PositionValue::HorizontalPreset> {
|
||||
if (ident.equals_ignoring_case("left"sv))
|
||||
if (ident.equals_ignoring_ascii_case("left"sv))
|
||||
return PositionValue::HorizontalPreset::Left;
|
||||
if (ident.equals_ignoring_case("center"sv))
|
||||
if (ident.equals_ignoring_ascii_case("center"sv))
|
||||
return PositionValue::HorizontalPreset::Center;
|
||||
if (ident.equals_ignoring_case("right"sv))
|
||||
if (ident.equals_ignoring_ascii_case("right"sv))
|
||||
return PositionValue::HorizontalPreset::Right;
|
||||
return {};
|
||||
};
|
||||
|
||||
auto parse_vertical_preset = [&](auto ident) -> Optional<PositionValue::VerticalPreset> {
|
||||
if (ident.equals_ignoring_case("top"sv))
|
||||
if (ident.equals_ignoring_ascii_case("top"sv))
|
||||
return PositionValue::VerticalPreset::Top;
|
||||
if (ident.equals_ignoring_case("center"sv))
|
||||
if (ident.equals_ignoring_ascii_case("center"sv))
|
||||
return PositionValue::VerticalPreset::Center;
|
||||
if (ident.equals_ignoring_case("bottom"sv))
|
||||
if (ident.equals_ignoring_ascii_case("bottom"sv))
|
||||
return PositionValue::VerticalPreset::Bottom;
|
||||
return {};
|
||||
};
|
||||
|
||||
auto parse_horizontal_edge = [&](auto ident) -> Optional<PositionValue::HorizontalEdge> {
|
||||
if (ident.equals_ignoring_case("left"sv))
|
||||
if (ident.equals_ignoring_ascii_case("left"sv))
|
||||
return PositionValue::HorizontalEdge::Left;
|
||||
if (ident.equals_ignoring_case("right"sv))
|
||||
if (ident.equals_ignoring_ascii_case("right"sv))
|
||||
return PositionValue::HorizontalEdge::Right;
|
||||
return {};
|
||||
};
|
||||
|
||||
auto parse_vertical_edge = [&](auto ident) -> Optional<PositionValue::VerticalEdge> {
|
||||
if (ident.equals_ignoring_case("top"sv))
|
||||
if (ident.equals_ignoring_ascii_case("top"sv))
|
||||
return PositionValue::VerticalEdge::Top;
|
||||
if (ident.equals_ignoring_case("bottom"sv))
|
||||
if (ident.equals_ignoring_ascii_case("bottom"sv))
|
||||
return PositionValue::VerticalEdge::Bottom;
|
||||
return {};
|
||||
};
|
||||
|
@ -3028,7 +3028,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
|||
if (rule->is_at_rule()) {
|
||||
if (has_ignored_vendor_prefix(rule->at_rule_name()))
|
||||
return {};
|
||||
if (rule->at_rule_name().equals_ignoring_case("font-face"sv)) {
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("font-face"sv)) {
|
||||
if (!rule->block() || !rule->block()->is_curly()) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "@font-face rule is malformed.");
|
||||
return {};
|
||||
|
@ -3036,7 +3036,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
|||
TokenStream tokens { rule->block()->values() };
|
||||
return parse_font_face_rule(tokens);
|
||||
}
|
||||
if (rule->at_rule_name().equals_ignoring_case("import"sv) && !rule->prelude().is_empty()) {
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("import"sv) && !rule->prelude().is_empty()) {
|
||||
Optional<AK::URL> url;
|
||||
for (auto const& token : rule->prelude()) {
|
||||
if (token.is(Token::Type::Whitespace))
|
||||
|
@ -3058,7 +3058,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
|||
dbgln_if(CSS_PARSER_DEBUG, "Unable to parse url from @import rule");
|
||||
return {};
|
||||
}
|
||||
if (rule->at_rule_name().equals_ignoring_case("media"sv)) {
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("media"sv)) {
|
||||
auto media_query_tokens = TokenStream { rule->prelude() };
|
||||
auto media_query_list = parse_a_media_query_list(media_query_tokens);
|
||||
if (media_query_list.is_empty() || !rule->block())
|
||||
|
@ -3075,7 +3075,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
|||
auto rule_list = CSSRuleList::create(m_context.realm(), child_rules).release_value_but_fixme_should_propagate_errors();
|
||||
return CSSMediaRule::create(m_context.realm(), media_list, rule_list).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
if (rule->at_rule_name().equals_ignoring_case("supports"sv)) {
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("supports"sv)) {
|
||||
auto supports_tokens = TokenStream { rule->prelude() };
|
||||
auto supports = parse_a_supports(supports_tokens);
|
||||
if (!supports) {
|
||||
|
@ -3205,11 +3205,11 @@ RefPtr<StyleValue> Parser::parse_builtin_value(ComponentValue const& component_v
|
|||
{
|
||||
if (component_value.is(Token::Type::Ident)) {
|
||||
auto ident = component_value.token().ident();
|
||||
if (ident.equals_ignoring_case("inherit"sv))
|
||||
if (ident.equals_ignoring_ascii_case("inherit"sv))
|
||||
return InheritStyleValue::the();
|
||||
if (ident.equals_ignoring_case("initial"sv))
|
||||
if (ident.equals_ignoring_ascii_case("initial"sv))
|
||||
return InitialStyleValue::the();
|
||||
if (ident.equals_ignoring_case("unset"sv))
|
||||
if (ident.equals_ignoring_ascii_case("unset"sv))
|
||||
return UnsetStyleValue::the();
|
||||
// FIXME: Implement `revert` and `revert-layer` keywords, from Cascade4 and Cascade5 respectively
|
||||
}
|
||||
|
@ -3258,10 +3258,10 @@ RefPtr<StyleValue> Parser::parse_dynamic_value(ComponentValue const& component_v
|
|||
if (component_value.is_function()) {
|
||||
auto const& function = component_value.function();
|
||||
|
||||
if (function.name().equals_ignoring_case("calc"sv))
|
||||
if (function.name().equals_ignoring_ascii_case("calc"sv))
|
||||
return parse_calculated_value(function.values());
|
||||
|
||||
if (function.name().equals_ignoring_case("var"sv)) {
|
||||
if (function.name().equals_ignoring_ascii_case("var"sv)) {
|
||||
// Declarations using `var()` should already be parsed as an UnresolvedStyleValue before this point.
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -3321,7 +3321,7 @@ Optional<Length> Parser::parse_length(ComponentValue const& component_value)
|
|||
return dimension->length();
|
||||
|
||||
// FIXME: auto isn't a length!
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv))
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv))
|
||||
return Length::make_auto();
|
||||
|
||||
return {};
|
||||
|
@ -3414,7 +3414,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(TokenStream<ComponentValue>&
|
|||
|
||||
// All options start with 'u'/'U'.
|
||||
auto const& u = tokens.next_token();
|
||||
if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_case("u"sv))) {
|
||||
if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_ascii_case("u"sv))) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: <urange> does not start with 'u'");
|
||||
return {};
|
||||
}
|
||||
|
@ -3628,7 +3628,7 @@ RefPtr<StyleValue> Parser::parse_dimension_value(ComponentValue const& component
|
|||
if (component_value.is(Token::Type::Number) && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength)))
|
||||
return {};
|
||||
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv))
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv))
|
||||
return LengthStyleValue::create(Length::make_auto());
|
||||
|
||||
auto dimension = parse_dimension(component_value);
|
||||
|
@ -3728,8 +3728,8 @@ Optional<Color> Parser::parse_rgb_or_hsl_color(StringView function_name, Vector<
|
|||
if (tokens.has_next_token())
|
||||
return {};
|
||||
|
||||
if (function_name.equals_ignoring_case("rgb"sv)
|
||||
|| function_name.equals_ignoring_case("rgba"sv)) {
|
||||
if (function_name.equals_ignoring_ascii_case("rgb"sv)
|
||||
|| function_name.equals_ignoring_ascii_case("rgba"sv)) {
|
||||
|
||||
// https://www.w3.org/TR/css-color-4/#rgb-functions
|
||||
|
||||
|
@ -3760,8 +3760,8 @@ Optional<Color> Parser::parse_rgb_or_hsl_color(StringView function_name, Vector<
|
|||
|
||||
return Color(r_val, g_val, b_val, a_val);
|
||||
}
|
||||
} else if (function_name.equals_ignoring_case("hsl"sv)
|
||||
|| function_name.equals_ignoring_case("hsla"sv)) {
|
||||
} else if (function_name.equals_ignoring_ascii_case("hsl"sv)
|
||||
|| function_name.equals_ignoring_ascii_case("hsla"sv)) {
|
||||
|
||||
// https://www.w3.org/TR/css-color-4/#the-hsl-notation
|
||||
|
||||
|
@ -3812,7 +3812,7 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
|
|||
if (!component_value.is_function())
|
||||
return {};
|
||||
auto const& function = component_value.function();
|
||||
if (!function.name().equals_ignoring_case("rect"sv))
|
||||
if (!function.name().equals_ignoring_ascii_case("rect"sv))
|
||||
return {};
|
||||
|
||||
Vector<Length, 4> params;
|
||||
|
@ -3842,7 +3842,7 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
|
|||
// <top>, <right>, <bottom>, and <left> may either have a <length> value or 'auto'.
|
||||
// Negative lengths are permitted.
|
||||
auto current_token = tokens.next_token().token();
|
||||
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto"sv)) {
|
||||
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto"sv)) {
|
||||
params.append(Length::make_auto());
|
||||
} else {
|
||||
auto maybe_length = parse_length(current_token);
|
||||
|
@ -4732,7 +4732,7 @@ RefPtr<StyleValue> Parser::parse_single_shadow_value(TokenStream<ComponentValue>
|
|||
}
|
||||
|
||||
if (allow_inset_keyword == AllowInsetKeyword::Yes
|
||||
&& token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("inset"sv)) {
|
||||
&& token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("inset"sv)) {
|
||||
if (placement.has_value())
|
||||
return nullptr;
|
||||
placement = ShadowPlacement::Inner;
|
||||
|
@ -4870,25 +4870,25 @@ RefPtr<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue>
|
|||
};
|
||||
|
||||
auto parse_filter_function_name = [&](auto name) -> Optional<FilterToken> {
|
||||
if (name.equals_ignoring_case("blur"sv))
|
||||
if (name.equals_ignoring_ascii_case("blur"sv))
|
||||
return FilterToken::Blur;
|
||||
if (name.equals_ignoring_case("brightness"sv))
|
||||
if (name.equals_ignoring_ascii_case("brightness"sv))
|
||||
return FilterToken::Brightness;
|
||||
if (name.equals_ignoring_case("contrast"sv))
|
||||
if (name.equals_ignoring_ascii_case("contrast"sv))
|
||||
return FilterToken::Contrast;
|
||||
if (name.equals_ignoring_case("drop-shadow"sv))
|
||||
if (name.equals_ignoring_ascii_case("drop-shadow"sv))
|
||||
return FilterToken::DropShadow;
|
||||
if (name.equals_ignoring_case("grayscale"sv))
|
||||
if (name.equals_ignoring_ascii_case("grayscale"sv))
|
||||
return FilterToken::Grayscale;
|
||||
if (name.equals_ignoring_case("hue-rotate"sv))
|
||||
if (name.equals_ignoring_ascii_case("hue-rotate"sv))
|
||||
return FilterToken::HueRotate;
|
||||
if (name.equals_ignoring_case("invert"sv))
|
||||
if (name.equals_ignoring_ascii_case("invert"sv))
|
||||
return FilterToken::Invert;
|
||||
if (name.equals_ignoring_case("opacity"sv))
|
||||
if (name.equals_ignoring_ascii_case("opacity"sv))
|
||||
return FilterToken::Opacity;
|
||||
if (name.equals_ignoring_case("saturate"sv))
|
||||
if (name.equals_ignoring_ascii_case("saturate"sv))
|
||||
return FilterToken::Saturate;
|
||||
if (name.equals_ignoring_case("sepia"sv))
|
||||
if (name.equals_ignoring_ascii_case("sepia"sv))
|
||||
return FilterToken::Sepia;
|
||||
return {};
|
||||
};
|
||||
|
@ -5323,7 +5323,7 @@ CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& tokens)
|
|||
}
|
||||
|
||||
auto const& declaration = declaration_or_at_rule.declaration();
|
||||
if (declaration.name().equals_ignoring_case("font-family"sv)) {
|
||||
if (declaration.name().equals_ignoring_ascii_case("font-family"sv)) {
|
||||
// FIXME: This is very similar to, but different from, the logic in parse_font_family_value().
|
||||
// Ideally they could share code.
|
||||
Vector<DeprecatedString> font_family_parts;
|
||||
|
@ -5367,14 +5367,14 @@ CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& tokens)
|
|||
font_family = String::join(' ', font_family_parts).release_value_but_fixme_should_propagate_errors();
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_case("src"sv)) {
|
||||
if (declaration.name().equals_ignoring_ascii_case("src"sv)) {
|
||||
TokenStream token_stream { declaration.values() };
|
||||
Vector<FontFace::Source> supported_sources = parse_font_face_src(token_stream);
|
||||
if (!supported_sources.is_empty())
|
||||
src = move(supported_sources);
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_case("unicode-range"sv)) {
|
||||
if (declaration.name().equals_ignoring_ascii_case("unicode-range"sv)) {
|
||||
Vector<UnicodeRange> unicode_ranges;
|
||||
bool unicode_range_invalid = false;
|
||||
TokenStream all_tokens { declaration.values() };
|
||||
|
@ -5418,7 +5418,7 @@ Vector<FontFace::Source> Parser::parse_font_face_src(TokenStream<ComponentValue>
|
|||
// Format-name table: https://www.w3.org/TR/css-fonts-4/#font-format-definitions
|
||||
auto font_format_is_supported = [](StringView name) {
|
||||
// The spec requires us to treat opentype and truetype as synonymous.
|
||||
if (name.is_one_of_ignoring_case("opentype"sv, "truetype"sv, "woff"sv))
|
||||
if (name.is_one_of_ignoring_ascii_case("opentype"sv, "truetype"sv, "woff"sv))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
@ -5450,7 +5450,7 @@ Vector<FontFace::Source> Parser::parse_font_face_src(TokenStream<ComponentValue>
|
|||
}
|
||||
|
||||
auto const& function = maybe_function.function();
|
||||
if (function.name().equals_ignoring_case("format"sv)) {
|
||||
if (function.name().equals_ignoring_ascii_case("format"sv)) {
|
||||
TokenStream format_tokens { function.values() };
|
||||
format_tokens.skip_whitespace();
|
||||
auto const& format_name_token = format_tokens.next_token();
|
||||
|
@ -5700,7 +5700,7 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c
|
|||
tokens.skip_whitespace();
|
||||
auto const& part = tokens.next_token();
|
||||
|
||||
if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_case("none"sv)) {
|
||||
if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_ascii_case("none"sv)) {
|
||||
if (!transformations.is_empty())
|
||||
return nullptr;
|
||||
tokens.skip_whitespace();
|
||||
|
@ -5950,16 +5950,16 @@ Optional<CSS::GridSize> Parser::parse_grid_size(ComponentValue const& component_
|
|||
if (component_value.is_function())
|
||||
return {};
|
||||
auto token = component_value.token();
|
||||
if (token.is(Token::Type::Dimension) && token.dimension_unit().equals_ignoring_case("fr"sv)) {
|
||||
if (token.is(Token::Type::Dimension) && token.dimension_unit().equals_ignoring_ascii_case("fr"sv)) {
|
||||
float numeric_value = token.dimension_value();
|
||||
if (numeric_value)
|
||||
return GridSize(numeric_value);
|
||||
}
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("auto"sv))
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("auto"sv))
|
||||
return GridSize::make_auto();
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("max-content"sv))
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("max-content"sv))
|
||||
return GridSize(GridSize::Type::MaxContent);
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("min-content"sv))
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("min-content"sv))
|
||||
return GridSize(GridSize::Type::MinContent);
|
||||
auto dimension = parse_dimension(token);
|
||||
if (!dimension.has_value())
|
||||
|
@ -6029,9 +6029,9 @@ Optional<CSS::GridRepeat> Parser::parse_repeat(Vector<ComponentValue> const& com
|
|||
auto repeat_count = 0;
|
||||
if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() > 0)
|
||||
repeat_count = current_token.number_value();
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto-fill"sv))
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fill"sv))
|
||||
is_auto_fill = true;
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto-fit"sv))
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fit"sv))
|
||||
is_auto_fit = true;
|
||||
|
||||
// The second argument is a track list, which is repeated that number of times.
|
||||
|
@ -6113,13 +6113,13 @@ Optional<CSS::ExplicitGridTrack> Parser::parse_track_sizing_function(ComponentVa
|
|||
{
|
||||
if (token.is_function()) {
|
||||
auto const& function_token = token.function();
|
||||
if (function_token.name().equals_ignoring_case("repeat"sv)) {
|
||||
if (function_token.name().equals_ignoring_ascii_case("repeat"sv)) {
|
||||
auto maybe_repeat = parse_repeat(function_token.values());
|
||||
if (maybe_repeat.has_value())
|
||||
return CSS::ExplicitGridTrack(maybe_repeat.value());
|
||||
else
|
||||
return {};
|
||||
} else if (function_token.name().equals_ignoring_case("minmax"sv)) {
|
||||
} else if (function_token.name().equals_ignoring_ascii_case("minmax"sv)) {
|
||||
auto maybe_min_max_value = parse_min_max(function_token.values());
|
||||
if (maybe_min_max_value.has_value())
|
||||
return CSS::ExplicitGridTrack(maybe_min_max_value.value());
|
||||
|
@ -6127,7 +6127,7 @@ Optional<CSS::ExplicitGridTrack> Parser::parse_track_sizing_function(ComponentVa
|
|||
return {};
|
||||
}
|
||||
return {};
|
||||
} else if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("auto"sv)) {
|
||||
} else if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("auto"sv)) {
|
||||
return CSS::ExplicitGridTrack(GridSize(Length::make_auto()));
|
||||
} else if (token.is_block()) {
|
||||
return {};
|
||||
|
@ -6189,12 +6189,12 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
|
|||
// [ <integer> && <custom-ident>? ] |
|
||||
// [ span && [ <integer> || <custom-ident> ] ]
|
||||
auto is_auto = [](Token token) -> bool {
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("auto"sv))
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("auto"sv))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
auto is_span = [](Token token) -> bool {
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("span"sv))
|
||||
if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("span"sv))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
@ -6206,7 +6206,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
|
|||
};
|
||||
auto is_line_name = [](Token token) -> bool {
|
||||
// The <custom-ident> additionally excludes the keywords span and auto.
|
||||
if (token.is(Token::Type::Ident) && !token.ident().equals_ignoring_case("span"sv) && !token.ident().equals_ignoring_case("auto"sv))
|
||||
if (token.is(Token::Type::Ident) && !token.ident().equals_ignoring_ascii_case("span"sv) && !token.ident().equals_ignoring_ascii_case("auto"sv))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
@ -6410,7 +6410,7 @@ RefPtr<StyleValue> Parser::parse_grid_template_areas_value(Vector<ComponentValue
|
|||
Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(PropertyID property_id, TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
auto function_contains_var_or_attr = [](Function const& function, auto&& recurse) -> bool {
|
||||
if (function.name().equals_ignoring_case("var"sv) || function.name().equals_ignoring_case("attr"sv))
|
||||
if (function.name().equals_ignoring_ascii_case("var"sv) || function.name().equals_ignoring_ascii_case("attr"sv))
|
||||
return true;
|
||||
for (auto const& token : function.values()) {
|
||||
if (token.is_function() && recurse(token.function(), recurse))
|
||||
|
@ -6685,16 +6685,16 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt
|
|||
};
|
||||
|
||||
auto is_n = [](ComponentValue const& value) -> bool {
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("n"sv);
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("n"sv);
|
||||
};
|
||||
auto is_ndash = [](ComponentValue const& value) -> bool {
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("n-"sv);
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("n-"sv);
|
||||
};
|
||||
auto is_dashn = [](ComponentValue const& value) -> bool {
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n"sv);
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("-n"sv);
|
||||
};
|
||||
auto is_dashndash = [](ComponentValue const& value) -> bool {
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n-"sv);
|
||||
return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("-n-"sv);
|
||||
};
|
||||
auto is_delim = [](ComponentValue const& value, u32 delim) -> bool {
|
||||
return value.is(Token::Type::Delim) && value.token().delim() == delim;
|
||||
|
@ -6707,7 +6707,7 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt
|
|||
return false;
|
||||
if (!value.token().number().is_integer())
|
||||
return false;
|
||||
if (!value.token().dimension_unit().equals_ignoring_case("n"sv))
|
||||
if (!value.token().dimension_unit().equals_ignoring_ascii_case("n"sv))
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
|
@ -6716,7 +6716,7 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt
|
|||
return false;
|
||||
if (!value.token().number().is_integer())
|
||||
return false;
|
||||
if (!value.token().dimension_unit().equals_ignoring_case("n-"sv))
|
||||
if (!value.token().dimension_unit().equals_ignoring_ascii_case("n-"sv))
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
|
@ -6779,11 +6779,11 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt
|
|||
// odd | even
|
||||
if (first_value.is(Token::Type::Ident)) {
|
||||
auto ident = first_value.token().ident();
|
||||
if (ident.equals_ignoring_case("odd"sv)) {
|
||||
if (ident.equals_ignoring_ascii_case("odd"sv)) {
|
||||
transaction.commit();
|
||||
return Selector::SimpleSelector::ANPlusBPattern { 2, 1 };
|
||||
}
|
||||
if (ident.equals_ignoring_case("even"sv)) {
|
||||
if (ident.equals_ignoring_ascii_case("even"sv)) {
|
||||
transaction.commit();
|
||||
return Selector::SimpleSelector::ANPlusBPattern { 2, 0 };
|
||||
}
|
||||
|
@ -7263,9 +7263,9 @@ bool Parser::has_ignored_vendor_prefix(StringView string)
|
|||
|
||||
bool Parser::is_builtin(StringView name)
|
||||
{
|
||||
return name.equals_ignoring_case("inherit"sv)
|
||||
|| name.equals_ignoring_case("initial"sv)
|
||||
|| name.equals_ignoring_case("unset"sv);
|
||||
return name.equals_ignoring_ascii_case("inherit"sv)
|
||||
|| name.equals_ignoring_ascii_case("initial"sv)
|
||||
|| name.equals_ignoring_ascii_case("unset"sv);
|
||||
}
|
||||
|
||||
RefPtr<CalculatedStyleValue> Parser::parse_calculated_value(Badge<StyleComputer>, ParsingContext const& context, Vector<ComponentValue> const& tokens)
|
||||
|
|
|
@ -10,9 +10,9 @@ namespace Web::CSS {
|
|||
|
||||
PreferredColorScheme preferred_color_scheme_from_string(StringView value)
|
||||
{
|
||||
if (value.equals_ignoring_case("light"sv))
|
||||
if (value.equals_ignoring_ascii_case("light"sv))
|
||||
return PreferredColorScheme::Light;
|
||||
if (value.equals_ignoring_case("dark"sv))
|
||||
if (value.equals_ignoring_ascii_case("dark"sv))
|
||||
return PreferredColorScheme::Dark;
|
||||
return PreferredColorScheme::Auto;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ StringView Resolution::unit_name() const
|
|||
|
||||
Optional<Resolution::Type> Resolution::unit_from_name(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("dpi"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("dpi"sv)) {
|
||||
return Type::Dpi;
|
||||
} else if (name.equals_ignoring_case("dpcm"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("dpcm"sv)) {
|
||||
return Type::Dpcm;
|
||||
} else if (name.equals_ignoring_case("dppx"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("dppx"sv)) {
|
||||
return Type::Dppx;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -345,21 +345,21 @@ ErrorOr<String> serialize_a_group_of_selectors(Vector<NonnullRefPtr<Selector>> c
|
|||
|
||||
Optional<Selector::PseudoElement> pseudo_element_from_string(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("after"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("after"sv)) {
|
||||
return Selector::PseudoElement::After;
|
||||
} else if (name.equals_ignoring_case("before"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("before"sv)) {
|
||||
return Selector::PseudoElement::Before;
|
||||
} else if (name.equals_ignoring_case("first-letter"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("first-letter"sv)) {
|
||||
return Selector::PseudoElement::FirstLetter;
|
||||
} else if (name.equals_ignoring_case("first-line"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("first-line"sv)) {
|
||||
return Selector::PseudoElement::FirstLine;
|
||||
} else if (name.equals_ignoring_case("marker"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("marker"sv)) {
|
||||
return Selector::PseudoElement::Marker;
|
||||
} else if (name.equals_ignoring_case("-webkit-progress-bar"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("-webkit-progress-bar"sv)) {
|
||||
return Selector::PseudoElement::ProgressBar;
|
||||
} else if (name.equals_ignoring_case("-webkit-progress-value"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("-webkit-progress-value"sv)) {
|
||||
return Selector::PseudoElement::ProgressValue;
|
||||
} else if (name.equals_ignoring_case("placeholder"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("placeholder"sv)) {
|
||||
return Selector::PseudoElement::Placeholder;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -618,7 +618,7 @@ bool StyleComputer::expand_variables(DOM::Element& element, StringView property_
|
|||
dest.empend(value);
|
||||
continue;
|
||||
}
|
||||
if (!value.function().name().equals_ignoring_case("var"sv)) {
|
||||
if (!value.function().name().equals_ignoring_ascii_case("var"sv)) {
|
||||
auto const& source_function = value.function();
|
||||
Vector<Parser::ComponentValue> function_values;
|
||||
Parser::TokenStream source_function_contents { source_function.values() };
|
||||
|
@ -683,7 +683,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p
|
|||
while (source.has_next_token()) {
|
||||
auto const& value = source.next_token();
|
||||
if (value.is_function()) {
|
||||
if (value.function().name().equals_ignoring_case("attr"sv)) {
|
||||
if (value.function().name().equals_ignoring_ascii_case("attr"sv)) {
|
||||
// https://drafts.csswg.org/css-values-5/#attr-substitution
|
||||
Parser::TokenStream attr_contents { value.function().values() };
|
||||
attr_contents.skip_whitespace();
|
||||
|
@ -720,7 +720,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p
|
|||
return false;
|
||||
}
|
||||
|
||||
if (value.function().name().equals_ignoring_case("calc"sv)) {
|
||||
if (value.function().name().equals_ignoring_ascii_case("calc"sv)) {
|
||||
auto const& calc_function = value.function();
|
||||
if (auto calc_value = CSS::Parser::Parser::parse_calculated_value({}, Parser::ParsingContext { document() }, calc_function.values())) {
|
||||
switch (calc_value->resolved_type()) {
|
||||
|
|
|
@ -75,9 +75,9 @@ StringView Time::unit_name() const
|
|||
|
||||
Optional<Time::Type> Time::unit_from_name(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("s"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("s"sv)) {
|
||||
return Type::S;
|
||||
} else if (name.equals_ignoring_case("ms"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("ms"sv)) {
|
||||
return Type::Ms;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -50,11 +50,11 @@ StringView same_site_to_string(SameSite same_site)
|
|||
|
||||
SameSite same_site_from_string(StringView same_site_mode)
|
||||
{
|
||||
if (same_site_mode.equals_ignoring_case("None"sv))
|
||||
if (same_site_mode.equals_ignoring_ascii_case("None"sv))
|
||||
return SameSite::None;
|
||||
if (same_site_mode.equals_ignoring_case("Strict"sv))
|
||||
if (same_site_mode.equals_ignoring_ascii_case("Strict"sv))
|
||||
return SameSite::Strict;
|
||||
if (same_site_mode.equals_ignoring_case("Lax"sv))
|
||||
if (same_site_mode.equals_ignoring_ascii_case("Lax"sv))
|
||||
return SameSite::Lax;
|
||||
return SameSite::Default;
|
||||
}
|
||||
|
|
|
@ -133,19 +133,19 @@ void parse_attributes(ParsedCookie& parsed_cookie, StringView unparsed_attribute
|
|||
|
||||
void process_attribute(ParsedCookie& parsed_cookie, StringView attribute_name, StringView attribute_value)
|
||||
{
|
||||
if (attribute_name.equals_ignoring_case("Expires"sv)) {
|
||||
if (attribute_name.equals_ignoring_ascii_case("Expires"sv)) {
|
||||
on_expires_attribute(parsed_cookie, attribute_value);
|
||||
} else if (attribute_name.equals_ignoring_case("Max-Age"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("Max-Age"sv)) {
|
||||
on_max_age_attribute(parsed_cookie, attribute_value);
|
||||
} else if (attribute_name.equals_ignoring_case("Domain"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("Domain"sv)) {
|
||||
on_domain_attribute(parsed_cookie, attribute_value);
|
||||
} else if (attribute_name.equals_ignoring_case("Path"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("Path"sv)) {
|
||||
on_path_attribute(parsed_cookie, attribute_value);
|
||||
} else if (attribute_name.equals_ignoring_case("Secure"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("Secure"sv)) {
|
||||
on_secure_attribute(parsed_cookie);
|
||||
} else if (attribute_name.equals_ignoring_case("HttpOnly"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("HttpOnly"sv)) {
|
||||
on_http_only_attribute(parsed_cookie);
|
||||
} else if (attribute_name.equals_ignoring_case("SameSite"sv)) {
|
||||
} else if (attribute_name.equals_ignoring_ascii_case("SameSite"sv)) {
|
||||
on_same_site_attribute(parsed_cookie, attribute_value);
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ Optional<Time> parse_date_time(StringView date_string)
|
|||
|
||||
auto parse_month = [&](StringView token) {
|
||||
for (unsigned i = 0; i < 12; ++i) {
|
||||
if (token.equals_ignoring_case(short_month_names[i])) {
|
||||
if (token.equals_ignoring_ascii_case(short_month_names[i])) {
|
||||
month = i + 1;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,13 +55,13 @@ JS::NonnullGCPtr<JS::Promise> SubtleCrypto::digest(String const& algorithm, JS::
|
|||
// FIXME: This is way more generic than it needs to be right now, so we simplify it.
|
||||
::Crypto::Hash::HashKind hash_kind;
|
||||
auto algorithm_as_string_view = algorithm.bytes_as_string_view();
|
||||
if (algorithm_as_string_view.equals_ignoring_case("SHA-1"sv)) {
|
||||
if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-1"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA1;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-256"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-256"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA256;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-384"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-384"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA384;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-512"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-512"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA512;
|
||||
}
|
||||
// 4. If an error occurred, return a Promise rejected with normalizedAlgorithm.
|
||||
|
|
|
@ -266,15 +266,15 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(Document& document
|
|||
if (lowercase_tag_name == SVG::TagNames::svg)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name)));
|
||||
// FIXME: Support SVG's mixedCase tag names properly.
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::clipPath))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::clipPath))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::circle)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::defs))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::defs))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::ellipse)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::foreignObject))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::foreignObject))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::line)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name)));
|
||||
|
|
|
@ -153,7 +153,7 @@ Attr const* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_
|
|||
// 2. Return the first attribute in element’s attribute list whose qualified name is qualifiedName; otherwise null.
|
||||
for (auto const& attribute : m_attributes) {
|
||||
if (compare_as_lowercase) {
|
||||
if (attribute->name().equals_ignoring_case(qualified_name))
|
||||
if (attribute->name().equals_ignoring_ascii_case(qualified_name))
|
||||
return attribute.ptr();
|
||||
} else {
|
||||
if (attribute->name() == qualified_name)
|
||||
|
|
|
@ -1829,7 +1829,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
|
|||
bool is_in_header_names = false;
|
||||
|
||||
for (auto const& allowed_header_name : header_names) {
|
||||
if (StringView { allowed_header_name }.equals_ignoring_case(header.name)) {
|
||||
if (StringView { allowed_header_name }.equals_ignoring_ascii_case(header.name)) {
|
||||
is_in_header_names = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1850,7 +1850,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
|
|||
bool is_in_header_names = false;
|
||||
|
||||
for (auto const& header_name : header_names) {
|
||||
if (StringView { unsafe_name }.equals_ignoring_case(header_name)) {
|
||||
if (StringView { unsafe_name }.equals_ignoring_ascii_case(header_name)) {
|
||||
is_in_header_names = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ WebIDL::ExceptionOr<Vector<String>> Headers::get_set_cookie()
|
|||
// 2. Return the values of all headers in this’s header list whose name is a byte-case-insensitive match for
|
||||
// `Set-Cookie`, in order.
|
||||
for (auto const& header : *m_header_list) {
|
||||
if (StringView { header.name }.equals_ignoring_case("Set-Cookie"sv))
|
||||
if (StringView { header.name }.equals_ignoring_ascii_case("Set-Cookie"sv))
|
||||
TRY_OR_THROW_OOM(vm, values.try_append(TRY_OR_THROW_OOM(vm, String::from_utf8(header.value))));
|
||||
}
|
||||
return values;
|
||||
|
|
|
@ -28,7 +28,7 @@ template<typename T>
|
|||
requires(IsSameIgnoringCV<T, u8>) struct CaseInsensitiveBytesTraits : public Traits<Span<T>> {
|
||||
static constexpr bool equals(Span<T> const& a, Span<T> const& b)
|
||||
{
|
||||
return StringView { a }.equals_ignoring_case(StringView { b });
|
||||
return StringView { a }.equals_ignoring_ascii_case(StringView { b });
|
||||
}
|
||||
|
||||
static constexpr unsigned hash(Span<T> const& span)
|
||||
|
@ -57,7 +57,7 @@ bool HeaderList::contains(ReadonlyBytes name) const
|
|||
{
|
||||
// A header list list contains a header name name if list contains a header whose name is a byte-case-insensitive match for name.
|
||||
return any_of(*this, [&](auto const& header) {
|
||||
return StringView { header.name }.equals_ignoring_case(name);
|
||||
return StringView { header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ ErrorOr<Optional<ByteBuffer>> HeaderList::get(ReadonlyBytes name) const
|
|||
ByteBuffer buffer;
|
||||
auto first = true;
|
||||
for (auto const& header : *this) {
|
||||
if (!StringView { header.name }.equals_ignoring_case(name))
|
||||
if (!StringView { header.name }.equals_ignoring_ascii_case(name))
|
||||
continue;
|
||||
if (first) {
|
||||
first = false;
|
||||
|
@ -172,7 +172,7 @@ ErrorOr<void> HeaderList::append(Header header)
|
|||
// NOTE: This reuses the casing of the name of the header already in list, if any. If there are multiple matched headers their names will all be identical.
|
||||
if (contains(name)) {
|
||||
auto matching_header = first_matching([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
name.overwrite(0, matching_header->name.data(), matching_header->name.size());
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void HeaderList::delete_(ReadonlyBytes name)
|
|||
{
|
||||
// To delete a header name name from a header list list, remove all headers whose name is a byte-case-insensitive match for name from list.
|
||||
remove_all_matching([&](auto const& header) {
|
||||
return StringView { header.name }.equals_ignoring_case(name);
|
||||
return StringView { header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ ErrorOr<void> HeaderList::set(Header header)
|
|||
// 1. If list contains name, then set the value of the first such header to value and remove the others.
|
||||
if (contains(name)) {
|
||||
auto matching_index = find_if([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
}).index();
|
||||
auto& matching_header = at(matching_index);
|
||||
matching_header.value = TRY(ByteBuffer::copy(value));
|
||||
|
@ -212,7 +212,7 @@ ErrorOr<void> HeaderList::set(Header header)
|
|||
ScopeGuard increment_i = [&]() { i++; };
|
||||
if (i <= matching_index)
|
||||
return false;
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
// 2. Otherwise, append header (name, value) to list.
|
||||
|
@ -234,7 +234,7 @@ ErrorOr<void> HeaderList::combine(Header header)
|
|||
// 1. If list contains name, then set the value of the first such header to its value, followed by 0x2C 0x20, followed by value.
|
||||
if (contains(name)) {
|
||||
auto matching_header = first_matching([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
TRY(matching_header->value.try_append(0x2c));
|
||||
TRY(matching_header->value.try_append(0x20));
|
||||
|
@ -270,7 +270,7 @@ ErrorOr<Vector<Header>> HeaderList::sort_and_combine() const
|
|||
// 1. Let values be a list of all values of headers in list whose name is a byte-case-insensitive match for name, in order.
|
||||
// 2. For each value of values:
|
||||
for (auto const& [header_name, value] : *this) {
|
||||
if (StringView { header_name }.equals_ignoring_case(name)) {
|
||||
if (StringView { header_name }.equals_ignoring_ascii_case(name)) {
|
||||
// 1. Append (name, value) to headers.
|
||||
auto header = TRY(Header::from_string_pair(name, value));
|
||||
TRY(headers.try_append(move(header)));
|
||||
|
@ -473,14 +473,14 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
auto name = StringView { header.name };
|
||||
|
||||
// `accept`
|
||||
if (name.equals_ignoring_case("accept"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("accept"sv)) {
|
||||
// If value contains a CORS-unsafe request-header byte, then return false.
|
||||
if (any_of(value.span(), is_cors_unsafe_request_header_byte))
|
||||
return false;
|
||||
}
|
||||
// `accept-language`
|
||||
// `content-language`
|
||||
else if (name.is_one_of_ignoring_case("accept-language"sv, "content-language"sv)) {
|
||||
else if (name.is_one_of_ignoring_ascii_case("accept-language"sv, "content-language"sv)) {
|
||||
// If value contains a byte that is not in the range 0x30 (0) to 0x39 (9), inclusive, is not in the range 0x41 (A) to 0x5A (Z), inclusive, is not in the range 0x61 (a) to 0x7A (z), inclusive, and is not 0x20 (SP), 0x2A (*), 0x2C (,), 0x2D (-), 0x2E (.), 0x3B (;), or 0x3D (=), then return false.
|
||||
if (any_of(value.span(), [](auto byte) {
|
||||
return !(is_ascii_digit(byte) || is_ascii_alpha(byte) || " *,-.;="sv.contains(static_cast<char>(byte)));
|
||||
|
@ -488,7 +488,7 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
return false;
|
||||
}
|
||||
// `content-type`
|
||||
else if (name.equals_ignoring_case("content-type"sv)) {
|
||||
else if (name.equals_ignoring_ascii_case("content-type"sv)) {
|
||||
// 1. If value contains a CORS-unsafe request-header byte, then return false.
|
||||
if (any_of(value.span(), is_cors_unsafe_request_header_byte))
|
||||
return false;
|
||||
|
@ -505,7 +505,7 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
return false;
|
||||
}
|
||||
// `range`
|
||||
else if (name.equals_ignoring_case("range"sv)) {
|
||||
else if (name.equals_ignoring_ascii_case("range"sv)) {
|
||||
// 1. Let rangeValue be the result of parsing a single range header value given value.
|
||||
auto range_value = parse_single_range_header_value(value);
|
||||
|
||||
|
@ -579,7 +579,7 @@ ErrorOr<OrderedHashTable<ByteBuffer>> get_cors_unsafe_header_names(HeaderList co
|
|||
bool is_cors_non_wildcard_request_header_name(ReadonlyBytes header_name)
|
||||
{
|
||||
// A CORS non-wildcard request-header name is a header name that is a byte-case-insensitive match for `Authorization`.
|
||||
return StringView { header_name }.equals_ignoring_case("Authorization"sv);
|
||||
return StringView { header_name }.equals_ignoring_ascii_case("Authorization"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#privileged-no-cors-request-header-name
|
||||
|
@ -587,7 +587,7 @@ bool is_privileged_no_cors_request_header_name(ReadonlyBytes header_name)
|
|||
{
|
||||
// A privileged no-CORS request-header name is a header name that is a byte-case-insensitive match for one of
|
||||
// - `Range`.
|
||||
return StringView { header_name }.equals_ignoring_case("Range"sv);
|
||||
return StringView { header_name }.equals_ignoring_ascii_case("Range"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
|
||||
|
@ -602,7 +602,7 @@ bool is_cors_safelisted_response_header_name(ReadonlyBytes header_name, Span<Rea
|
|||
// - `Last-Modified`
|
||||
// - `Pragma`
|
||||
// - Any item in list that is not a forbidden response-header name.
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Cache-Control"sv,
|
||||
"Content-Language"sv,
|
||||
"Content-Length"sv,
|
||||
|
@ -611,7 +611,7 @@ bool is_cors_safelisted_response_header_name(ReadonlyBytes header_name, Span<Rea
|
|||
"Last-Modified"sv,
|
||||
"Pragma"sv)
|
||||
|| any_of(list, [&](auto list_header_name) {
|
||||
return StringView { header_name }.equals_ignoring_case(list_header_name)
|
||||
return StringView { header_name }.equals_ignoring_ascii_case(list_header_name)
|
||||
&& !is_forbidden_response_header_name(list_header_name);
|
||||
});
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ bool is_no_cors_safelisted_request_header_name(ReadonlyBytes header_name)
|
|||
// - `Accept-Language`
|
||||
// - `Content-Language`
|
||||
// - `Content-Type`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Accept"sv,
|
||||
"Accept-Language"sv,
|
||||
"Content-Language"sv,
|
||||
|
@ -653,7 +653,7 @@ ErrorOr<bool> is_forbidden_request_header(Header const& header)
|
|||
// 1. If name is a byte-case-insensitive match for one of:
|
||||
// [...]
|
||||
// then return true.
|
||||
if (name.is_one_of_ignoring_case(
|
||||
if (name.is_one_of_ignoring_ascii_case(
|
||||
"Accept-Charset"sv,
|
||||
"Accept-Encoding"sv,
|
||||
"Access-Control-Request-Headers"sv,
|
||||
|
@ -688,7 +688,7 @@ ErrorOr<bool> is_forbidden_request_header(Header const& header)
|
|||
// - `X-HTTP-Method-Override`
|
||||
// - `X-Method-Override`
|
||||
// then:
|
||||
if (name.is_one_of_ignoring_case(
|
||||
if (name.is_one_of_ignoring_ascii_case(
|
||||
"X-HTTP-Method"sv,
|
||||
"X-HTTP-Method-Override"sv,
|
||||
"X-Method"sv)) {
|
||||
|
@ -710,7 +710,7 @@ bool is_forbidden_response_header_name(ReadonlyBytes header_name)
|
|||
// A forbidden response-header name is a header name that is a byte-case-insensitive match for one of:
|
||||
// - `Set-Cookie`
|
||||
// - `Set-Cookie2`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Set-Cookie"sv,
|
||||
"Set-Cookie2"sv);
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ bool is_request_body_header_name(ReadonlyBytes header_name)
|
|||
// - `Content-Language`
|
||||
// - `Content-Location`
|
||||
// - `Content-Type`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Content-Encoding"sv,
|
||||
"Content-Language"sv,
|
||||
"Content-Location"sv,
|
||||
|
@ -754,7 +754,7 @@ ErrorOr<Variant<Vector<ByteBuffer>, ExtractHeaderParseFailure, Empty>> extract_h
|
|||
|
||||
// 4. For each header header list contains whose name is name:
|
||||
for (auto const& header : list) {
|
||||
if (!StringView { header.name }.equals_ignoring_case(name))
|
||||
if (!StringView { header.name }.equals_ignoring_ascii_case(name))
|
||||
continue;
|
||||
|
||||
// 1. Let extract be the result of extracting header values from header.
|
||||
|
|
|
@ -32,7 +32,7 @@ bool is_cors_safelisted_method(ReadonlyBytes method)
|
|||
bool is_forbidden_method(ReadonlyBytes method)
|
||||
{
|
||||
// A forbidden method is a method that is a byte-case-insensitive match for `CONNECT`, `TRACE`, or `TRACK`.
|
||||
return StringView { method }.is_one_of_ignoring_case("CONNECT"sv, "TRACE"sv, "TRACK"sv);
|
||||
return StringView { method }.is_one_of_ignoring_ascii_case("CONNECT"sv, "TRACE"sv, "TRACK"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-method-normalize
|
||||
|
@ -40,7 +40,7 @@ ErrorOr<ByteBuffer> normalize_method(ReadonlyBytes method)
|
|||
{
|
||||
// To normalize a method, if it is a byte-case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or `PUT`, byte-uppercase it.
|
||||
auto bytes = TRY(ByteBuffer::copy(method));
|
||||
if (StringView { method }.is_one_of_ignoring_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv))
|
||||
if (StringView { method }.is_one_of_ignoring_ascii_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv))
|
||||
Infra::byte_uppercase(bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ JS::ThrowCompletionOr<void> HTMLBodyElement::initialize(JS::Realm& realm)
|
|||
void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("bgcolor"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("bgcolor"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
} else if (name.equals_ignoring_case("text"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("text"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
|
||||
} else if (name.equals_ignoring_case("background"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
VERIFY(m_background_style_value);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
|
||||
}
|
||||
|
@ -48,19 +48,19 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
if (name.equals_ignoring_case("link"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("link"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("alink"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("alink"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_active_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("vlink"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vlink"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("background"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value));
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (layout_node()) {
|
||||
|
|
|
@ -64,7 +64,7 @@ DeprecatedString HTMLButtonElement::type() const
|
|||
auto value = attribute(HTML::AttributeNames::type);
|
||||
|
||||
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \
|
||||
if (value.equals_ignoring_case(#keyword##sv)) \
|
||||
if (value.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return #keyword;
|
||||
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
|
||||
|
@ -78,7 +78,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
|
|||
auto value = attribute(HTML::AttributeNames::type);
|
||||
|
||||
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, state) \
|
||||
if (value.equals_ignoring_case(#keyword##sv)) \
|
||||
if (value.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return HTMLButtonElement::TypeAttributeState::state;
|
||||
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
|
||||
|
|
|
@ -64,7 +64,7 @@ DeprecatedString HTMLElement::dir() const
|
|||
{
|
||||
auto dir = attribute(HTML::AttributeNames::dir);
|
||||
#define __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE(keyword) \
|
||||
if (dir.equals_ignoring_case(#keyword##sv)) \
|
||||
if (dir.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return #keyword##sv;
|
||||
ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE
|
||||
|
@ -81,10 +81,10 @@ HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
|
|||
{
|
||||
auto contenteditable = attribute(HTML::AttributeNames::contenteditable);
|
||||
// "true", an empty string or a missing value map to the "true" state.
|
||||
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"sv))
|
||||
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_ascii_case("true"sv))
|
||||
return ContentEditableState::True;
|
||||
// "false" maps to the "false" state.
|
||||
if (contenteditable.equals_ignoring_case("false"sv))
|
||||
if (contenteditable.equals_ignoring_ascii_case("false"sv))
|
||||
return ContentEditableState::False;
|
||||
// Having no such attribute or an invalid value maps to the "inherit" state.
|
||||
return ContentEditableState::Inherit;
|
||||
|
@ -121,15 +121,15 @@ DeprecatedString HTMLElement::content_editable() const
|
|||
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
|
||||
WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(DeprecatedString const& content_editable)
|
||||
{
|
||||
if (content_editable.equals_ignoring_case("inherit"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("inherit"sv)) {
|
||||
remove_attribute(HTML::AttributeNames::contenteditable);
|
||||
return {};
|
||||
}
|
||||
if (content_editable.equals_ignoring_case("true"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("true"sv)) {
|
||||
MUST(set_attribute(HTML::AttributeNames::contenteditable, "true"));
|
||||
return {};
|
||||
}
|
||||
if (content_editable.equals_ignoring_case("false"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("false"sv)) {
|
||||
MUST(set_attribute(HTML::AttributeNames::contenteditable, "false"));
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ JS::ThrowCompletionOr<void> HTMLFontElement::initialize(JS::Realm& realm)
|
|||
void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("color"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("color"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
|
||||
|
|
|
@ -233,7 +233,7 @@ static bool is_form_control(DOM::Element const& element)
|
|||
}
|
||||
|
||||
if (is<HTMLInputElement>(element)
|
||||
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_case("image"sv)) {
|
||||
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_ascii_case("image"sv)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
|
|
|
@ -431,7 +431,7 @@ void HTMLInputElement::parse_attribute(DeprecatedFlyString const& name, Deprecat
|
|||
HTMLInputElement::TypeAttributeState HTMLInputElement::parse_type_attribute(StringView type)
|
||||
{
|
||||
#define __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE(keyword, state) \
|
||||
if (type.equals_ignoring_case(#keyword##sv)) \
|
||||
if (type.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return HTMLInputElement::TypeAttributeState::state;
|
||||
ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con
|
|||
HTMLElement::apply_presentational_hints(style);
|
||||
|
||||
for_each_attribute([&](auto const& name, auto const&) {
|
||||
if (name.equals_ignoring_case(HTML::AttributeNames::wrap))
|
||||
if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap))
|
||||
style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& s
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "bottom"sv)
|
||||
style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::align) {
|
||||
if (value.equals_ignoring_case("center"sv) || value.equals_ignoring_case("middle"sv)) {
|
||||
if (value.equals_ignoring_ascii_case("center"sv) || value.equals_ignoring_ascii_case("middle"sv)) {
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
|
||||
} else {
|
||||
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign))
|
||||
|
|
|
@ -413,16 +413,16 @@ DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) co
|
|||
auto const& public_identifier = doctype_token.doctype_data().public_identifier;
|
||||
auto const& system_identifier = doctype_token.doctype_data().system_identifier;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("-/W3C/DTD HTML 4.0 Transitional/EN"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("-/W3C/DTD HTML 4.0 Transitional/EN"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("HTML"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("HTML"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (system_identifier.equals_ignoring_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;
|
||||
|
||||
for (auto& public_id : s_quirks_public_ids) {
|
||||
|
@ -1922,7 +1922,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
|
|||
(void)m_stack_of_open_elements.pop();
|
||||
token.acknowledge_self_closing_flag_if_set();
|
||||
auto type_attribute = token.attribute(HTML::AttributeNames::type);
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_ascii_case("hidden"sv)) {
|
||||
m_frameset_ok = false;
|
||||
}
|
||||
return;
|
||||
|
@ -2698,7 +2698,7 @@ void HTMLParser::handle_in_table(HTMLToken& token)
|
|||
}
|
||||
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::input) {
|
||||
auto type_attribute = token.attribute(HTML::AttributeNames::type);
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_ascii_case("hidden"sv)) {
|
||||
goto AnythingElse;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<Depre
|
|||
m_mime_type = url().data_mime_type();
|
||||
} else {
|
||||
auto content_type_options = headers.get("X-Content-Type-Options");
|
||||
if (content_type_options.value_or("").equals_ignoring_case("nosniff"sv)) {
|
||||
if (content_type_options.value_or("").equals_ignoring_ascii_case("nosniff"sv)) {
|
||||
m_mime_type = "text/plain";
|
||||
} else {
|
||||
m_mime_type = Core::guess_mime_type_based_on_filename(url().path());
|
||||
|
|
|
@ -30,18 +30,18 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
{
|
||||
CSS::Parser::ParsingContext parsing_context { document() };
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("fill"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("fill"sv)) {
|
||||
// FIXME: The `fill` attribute and CSS `fill` property are not the same! But our support is limited enough that they are equivalent for now.
|
||||
if (auto fill_value = parse_css_value(parsing_context, value, CSS::PropertyID::Fill))
|
||||
style.set_property(CSS::PropertyID::Fill, fill_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("stroke"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("stroke"sv)) {
|
||||
// FIXME: The `stroke` attribute and CSS `stroke` property are not the same! But our support is limited enough that they are equivalent for now.
|
||||
if (auto stroke_value = parse_css_value(parsing_context, value, CSS::PropertyID::Stroke))
|
||||
style.set_property(CSS::PropertyID::Stroke, stroke_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("stroke-width"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("stroke-width"sv)) {
|
||||
if (auto stroke_width_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeWidth))
|
||||
style.set_property(CSS::PropertyID::StrokeWidth, stroke_width_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("transform"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("transform"sv)) {
|
||||
if (auto transform = parse_css_value(parsing_context, value, CSS::PropertyID::Transform))
|
||||
style.set_property(CSS::PropertyID::Transform, transform.release_nonnull());
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void SVGSVGElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedS
|
|||
{
|
||||
SVGGraphicsElement::parse_attribute(name, value);
|
||||
|
||||
if (name.equals_ignoring_case(SVG::AttributeNames::viewBox))
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
|
||||
m_view_box = try_parse_view_box(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ ErrorOr<JsonValue, Client::WrappedError> Client::read_body_as_json()
|
|||
size_t content_length = 0;
|
||||
|
||||
for (auto const& header : m_request->headers()) {
|
||||
if (header.name.equals_ignoring_case("Content-Length"sv)) {
|
||||
if (header.name.equals_ignoring_ascii_case("Content-Length"sv)) {
|
||||
content_length = header.value.to_uint<size_t>(TrimWhitespace::Yes).value_or(0);
|
||||
break;
|
||||
}
|
||||
|
@ -287,8 +287,8 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue resu
|
|||
}
|
||||
|
||||
bool keep_alive = false;
|
||||
if (auto it = m_request->headers().find_if([](auto& header) { return header.name.equals_ignoring_case("Connection"sv); }); !it.is_end())
|
||||
keep_alive = it->value.trim_whitespace().equals_ignoring_case("keep-alive"sv);
|
||||
if (auto it = m_request->headers().find_if([](auto& header) { return header.name.equals_ignoring_ascii_case("Connection"sv); }); !it.is_end())
|
||||
keep_alive = it->value.trim_whitespace().equals_ignoring_ascii_case("keep-alive"sv);
|
||||
|
||||
if (!keep_alive)
|
||||
die();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue