mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05: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:
parent
05b5a3bfba
commit
f0b72b819e
2 changed files with 6 additions and 3 deletions
|
@ -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@;
|
||||
)~~~");
|
||||
});
|
||||
|
|
|
@ -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@;
|
||||
)~~~");
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue