mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
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.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 00:04:17 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/f0b72b819e Pull-request: https://github.com/SerenityOS/serenity/pull/17502 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/trflynn89
@@ -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@;
|
||||
)~~~");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user