diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-02-17 16:43:28 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-19 00:46:47 +0100 |
commit | f0b72b819e83ed970e1db5ee887ab1eefcb34029 (patch) | |
tree | da8df1113cec47e712772d424c28dcbc47964e04 | |
parent | 05b5a3bfbabb2e3a9feb3a009fe9a9861beb7e2d (diff) | |
download | serenity-f0b72b819e83ed970e1db5ee887ab1eefcb34029.zip |
LibWeb: Make property/media-feature name matching ASCII case-insensitive
https://www.w3.org/TR/css-conditional-3/#dom-css-supports specifically
asks for this when calling `CSS::property_id_from_string()`, but in
general, CSS property and media-feature names can only contain ASCII.
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSMediaFeatureID.cpp | 6 | ||||
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSMediaFeatureID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSMediaFeatureID.cpp index 6cf5abcf43..8da1c6578f 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSMediaFeatureID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSMediaFeatureID.cpp @@ -88,7 +88,9 @@ ErrorOr<void> generate_implementation_file(JsonObject& media_feature_data, Core: { StringBuilder builder; SourceGenerator generator { builder }; - generator.append(R"~~~(#include <LibWeb/CSS/MediaFeatureID.h> + generator.append(R"~~~( +#include <LibWeb/CSS/MediaFeatureID.h> +#include <LibWeb/Infra/Strings.h> namespace Web::CSS { @@ -100,7 +102,7 @@ Optional<MediaFeatureID> media_feature_id_from_string(StringView string) member_generator.set("name", name); member_generator.set("name:titlecase", title_casify(name)); member_generator.append(R"~~~( - if (string.equals_ignoring_case("@name@"sv)) + if (Infra::is_ascii_case_insensitive_match(string, "@name@"sv)) return MediaFeatureID::@name:titlecase@; )~~~"); }); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index 5724dd7b1c..ce97679e98 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -154,6 +154,7 @@ ErrorOr<void> generate_implementation_file(JsonObject& properties, Core::File& f #include <LibWeb/CSS/Parser/Parser.h> #include <LibWeb/CSS/PropertyID.h> #include <LibWeb/CSS/StyleValue.h> +#include <LibWeb/Infra/Strings.h> namespace Web::CSS { @@ -189,7 +190,7 @@ PropertyID property_id_from_string(StringView string) member_generator.set("name", name); member_generator.set("name:titlecase", title_casify(name)); member_generator.append(R"~~~( - if (string.equals_ignoring_case("@name@"sv)) + if (Infra::is_ascii_case_insensitive_match(string, "@name@"sv)) return PropertyID::@name:titlecase@; )~~~"); }); |