mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Add support for trees of pseudo-elements
This is needed for CSS view transitions.
This commit is contained in:
parent
a2ecafb968
commit
31301ef08b
Notes:
github-actions[bot]
2025-05-13 11:39:50 +00:00
Author: https://github.com/Psychpsyo
Commit: 31301ef08b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4690
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 88 additions and 25 deletions
|
@ -86,6 +86,7 @@ Optional<PseudoElement> aliased_pseudo_element_from_string(StringView);
|
|||
StringView pseudo_element_name(PseudoElement);
|
||||
|
||||
bool is_has_allowed_pseudo_element(PseudoElement);
|
||||
bool is_pseudo_element_root(PseudoElement);
|
||||
bool pseudo_element_supports_property(PseudoElement, PropertyID);
|
||||
|
||||
struct PseudoElementMetadata {
|
||||
|
@ -234,6 +235,33 @@ bool is_has_allowed_pseudo_element(PseudoElement pseudo_element)
|
|||
}
|
||||
}
|
||||
|
||||
bool is_pseudo_element_root(PseudoElement pseudo_element)
|
||||
{
|
||||
switch (pseudo_element) {
|
||||
)~~~");
|
||||
|
||||
pseudo_elements_data.for_each_member([&](auto& name, JsonValue const& value) {
|
||||
auto& pseudo_element = value.as_object();
|
||||
if (pseudo_element.has("alias-for"sv))
|
||||
return;
|
||||
if (!pseudo_element.get_bool("is-pseudo-root"sv).value_or(false))
|
||||
return;
|
||||
|
||||
auto member_generator = generator.fork();
|
||||
member_generator.set("name:titlecase", title_casify(name));
|
||||
|
||||
member_generator.append(R"~~~(
|
||||
case PseudoElement::@name:titlecase@:
|
||||
return true;
|
||||
)~~~");
|
||||
});
|
||||
|
||||
generator.append(R"~~~(
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool pseudo_element_supports_property(PseudoElement pseudo_element, PropertyID property_id)
|
||||
{
|
||||
switch (pseudo_element) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue