LibWeb/CSS: Take AbstractElement in compute_pe_style_if_needed()

This commit is contained in:
Sam Atkins 2025-09-09 11:40:06 +01:00 committed by Alexander Kalenik
commit 263c51f6ac
Notes: github-actions[bot] 2025-09-11 16:48:25 +00:00
3 changed files with 4 additions and 4 deletions

View file

@ -2335,9 +2335,9 @@ GC::Ref<ComputedProperties> StyleComputer::compute_style(DOM::AbstractElement ab
return *compute_style_impl(abstract_element, ComputeStyleMode::Normal, did_change_custom_properties);
}
GC::Ptr<ComputedProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, Optional<bool&> did_change_custom_properties) const
GC::Ptr<ComputedProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::AbstractElement abstract_element, Optional<bool&> did_change_custom_properties) const
{
return compute_style_impl({ element, move(pseudo_element) }, ComputeStyleMode::CreatePseudoElementStyleIfNeeded, did_change_custom_properties);
return compute_style_impl(abstract_element, ComputeStyleMode::CreatePseudoElementStyleIfNeeded, did_change_custom_properties);
}
GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::AbstractElement abstract_element, ComputeStyleMode mode, Optional<bool&> did_change_custom_properties) const

View file

@ -153,7 +153,7 @@ public:
[[nodiscard]] GC::Ref<ComputedProperties> create_document_style() const;
[[nodiscard]] GC::Ref<ComputedProperties> compute_style(DOM::AbstractElement, Optional<bool&> did_change_custom_properties = {}) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::PseudoElement>, Optional<bool&> did_change_custom_properties) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_pseudo_element_style_if_needed(DOM::AbstractElement, Optional<bool&> did_change_custom_properties) const;
[[nodiscard]] RuleCache const& get_pseudo_class_rule_cache(PseudoClass) const;

View file

@ -739,7 +739,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style(bool& did_cha
style_computer.push_ancestor(*this);
auto pseudo_element_style = computed_properties(pseudo_element);
auto new_pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed(*this, pseudo_element, did_change_custom_properties);
auto new_pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed({ *this, pseudo_element }, did_change_custom_properties);
// TODO: Can we be smarter about invalidation?
if (pseudo_element_style && new_pseudo_element_style) {