LibWeb/CSS: Take AbstractElement in resolve_unresolved_properties()

This commit is contained in:
Sam Atkins 2025-09-05 14:07:53 +01:00 committed by Alexander Kalenik
commit 916e24de30
Notes: github-actions[bot] 2025-09-11 16:49:07 +00:00
3 changed files with 5 additions and 7 deletions

View file

@ -59,14 +59,13 @@ void CascadedProperties::revert_layer_property(PropertyID property_id, Important
m_properties.remove(it);
}
void CascadedProperties::resolve_unresolved_properties(GC::Ref<DOM::Element> element, Optional<PseudoElement> pseudo_element)
void CascadedProperties::resolve_unresolved_properties(DOM::AbstractElement abstract_element)
{
for (auto& [property_id, entries] : m_properties) {
for (auto& entry : entries) {
if (!entry.property.value->is_unresolved())
continue;
DOM::AbstractElement abstract_element { element, pseudo_element };
entry.property.value = Parser::Parser::resolve_unresolved_style_value(Parser::ParsingParams { element->document() }, abstract_element, property_id, entry.property.value->as_unresolved());
entry.property.value = Parser::Parser::resolve_unresolved_style_value(Parser::ParsingParams { abstract_element.document() }, abstract_element, property_id, entry.property.value->as_unresolved());
}
}
}

View file

@ -33,7 +33,7 @@ public:
void revert_property(PropertyID, Important, CascadeOrigin);
void revert_layer_property(PropertyID, Important, Optional<FlyString> layer_name);
void resolve_unresolved_properties(GC::Ref<DOM::Element>, Optional<PseudoElement>);
void resolve_unresolved_properties(DOM::AbstractElement);
private:
CascadedProperties();

View file

@ -1567,9 +1567,8 @@ GC::Ref<CascadedProperties> StyleComputer::compute_cascaded_values(DOM::Element&
}
// SVG presentation attributes are parsed as CSS values, so we need to handle potential custom properties here.
if (element.is_svg_element()) {
cascaded_properties->resolve_unresolved_properties(element, pseudo_element);
}
if (element.is_svg_element())
cascaded_properties->resolve_unresolved_properties({ element, pseudo_element });
}
// Normal author declarations, ordered by @layer, with un-@layer-ed rules last