LibWeb: Return AbstractElement from element_to_inherit_style_from

No functional changes.
This commit is contained in:
Callum Law 2025-08-21 16:38:17 +12:00 committed by Jelle Raaijmakers
commit a2c9ab9c9a
Notes: github-actions[bot] 2025-08-22 07:50:15 +00:00
3 changed files with 11 additions and 5 deletions

View file

@ -3119,9 +3119,10 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_value_of_custom_property(
// Unset is the same as inherit for inherited properties, and by default all custom properties are inherited.
// FIXME: Support non-inherited registered custom properties.
if (value->is_inherit() || value->is_unset()) {
if (!abstract_element.element_to_inherit_style_from())
auto element_to_inherit_style_from = abstract_element.element_to_inherit_style_from();
if (!element_to_inherit_style_from.has_value())
return document.custom_property_initial_value(name);
auto inherited_value = DOM::AbstractElement { const_cast<DOM::Element&>(*abstract_element.element_to_inherit_style_from()) }.get_custom_property(name);
auto inherited_value = element_to_inherit_style_from->get_custom_property(name);
if (!inherited_value)
return document.custom_property_initial_value(name);
return inherited_value.release_nonnull();