mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00: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
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
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…
Reference in a new issue