mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Invalidate style for tree counting functions when required
We mark any element that relies on tree counting functions as needing a style update when a sibling is inserted/removed.
This commit is contained in:
parent
e9036c7c75
commit
2404f95e03
Notes:
github-actions[bot]
2025-10-20 15:13:22 +00:00
Author: https://github.com/Calme1709
Commit: 2404f95e03
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6426
Reviewed-by: https://github.com/AtkinsSJ ✅
50 changed files with 297 additions and 230 deletions
|
|
@ -812,6 +812,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_inherited_style()
|
|||
// unresolved CSS-wide keywords (e.g. 'initial' or 'inherit') rather than the resolved value.
|
||||
auto const& preabsolutized_value = m_cascaded_properties->property(property_id);
|
||||
RefPtr old_value = computed_properties->property(property_id);
|
||||
// FIXME: Consider other style values that rely on relative lengths (e.g. CalculatedStyleValue, StyleValues which contain lengths (e.g. StyleValueList))
|
||||
// Update property if it uses relative units as it might have been affected by a change in ancestor element style.
|
||||
if (preabsolutized_value && preabsolutized_value->is_length() && preabsolutized_value->as_length().length().is_font_relative()) {
|
||||
auto is_inherited = computed_properties->is_property_inherited(property_id);
|
||||
|
|
@ -1394,6 +1395,14 @@ void Element::children_changed(ChildrenChangedMetadata const* metadata)
|
|||
{
|
||||
Node::children_changed(metadata);
|
||||
set_needs_style_update(true);
|
||||
for_each_child([&](DOM::Node& child) {
|
||||
if (auto* element = as_if<DOM::Element>(child); element && element->style_uses_tree_counting_function()) {
|
||||
element->set_needs_style_update(true);
|
||||
set_child_needs_style_update(true);
|
||||
}
|
||||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
void Element::set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::PseudoElement pseudo_element, GC::Ptr<Layout::NodeWithStyle> pseudo_element_node)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue