LibWeb: Allow to pass pseudo-element type in computed properties getter

...and setter. We had lots of places where we check if pseudo-element
type is specified and then use `pseudo_element_computed_properties()` or
`computed_properties()`. This change moves these checks from caller side
to the getter and setter.
This commit is contained in:
Aliaksandr Kalenik 2025-07-18 19:34:58 +02:00 committed by Andreas Kling
commit 2fc405f1b2
Notes: github-actions[bot] 2025-07-18 19:20:46 +00:00
7 changed files with 48 additions and 70 deletions

View file

@ -518,19 +518,11 @@ RefPtr<CSSStyleValue const> CSSStyleProperties::style_value_for_computed_propert
};
auto get_computed_value = [&element, pseudo_element](PropertyID property_id) -> auto const& {
if (pseudo_element.has_value())
return element.pseudo_element_computed_properties(pseudo_element.value())->property(property_id);
return element.computed_properties()->property(property_id);
return element.computed_properties(pseudo_element)->property(property_id);
};
if (property_is_logical_alias(property_id)) {
GC::Ptr<ComputedProperties> computed_properties;
if (pseudo_element.has_value())
computed_properties = element.pseudo_element_computed_properties(pseudo_element.value());
else
computed_properties = element.computed_properties();
auto computed_properties = element.computed_properties(pseudo_element);
return style_value_for_computed_property(
layout_node,
map_logical_alias_to_physical_property(property_id, LogicalAliasMappingContext { computed_properties->writing_mode(), computed_properties->direction() }));