mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 14:43:01 +02:00
LibWeb: Support "pseudo" CSS properties
These are properties that may used internally by LibWeb when resolving style values, but may not be set by external stylesheets. For example, 'background-repeat' may be a two-value CSS property that internally translates to 'background-repeat-x' and 'background-repeat-y'.
This commit is contained in:
committed by
Andreas Kling
parent
735829f694
commit
3ba338dec3
Notes:
sideshowbarker
2024-07-18 20:45:17 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/3ba338dec31 Pull-request: https://github.com/SerenityOS/serenity/pull/6148
@@ -112,7 +112,35 @@ const char* string_from_property_id(PropertyID property_id) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_pseudo_property(PropertyID property_id)
|
||||
{
|
||||
switch (property_id) {
|
||||
)~~~");
|
||||
|
||||
json.value().as_object().for_each_member([&](auto& name, auto& value) {
|
||||
VERIFY(value.is_object());
|
||||
|
||||
auto pseudo = value.as_object().get_or("pseudo", false);
|
||||
VERIFY(pseudo.is_bool());
|
||||
|
||||
if (pseudo.as_bool()) {
|
||||
auto member_generator = generator.fork();
|
||||
member_generator.set("name:titlecase", title_casify(name));
|
||||
member_generator.append(R"~~~(
|
||||
case PropertyID::@name:titlecase@:
|
||||
return true;
|
||||
)~~~");
|
||||
}
|
||||
});
|
||||
|
||||
generator.append(R"~~~(
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Web::CSS
|
||||
|
||||
)~~~");
|
||||
|
||||
outln("{}", generator.as_string_view());
|
||||
|
||||
Reference in New Issue
Block a user