Skip to content

Truly independent web browser

LibWeb: Skip the custom property move below elements without children

Tim Ledbetterec637f45afcf
diff --git a/Libraries/LibWeb/CSS/UpdateStyle.cpp b/Libraries/LibWeb/CSS/UpdateStyle.cpp
index 759424ee245..ef08f9c68dc 100644
--- a/Libraries/LibWeb/CSS/UpdateStyle.cpp
+++ b/Libraries/LibWeb/CSS/UpdateStyle.cpp
@@ -430,7 +430,8 @@ void StyleEngineFFI::web_css_rebuild_custom_property_environment(StyleReactionAp
move_pseudo_element_environments(read, document, *element, existing_base.ptr(), existing_inheritable.ptr(), moved);
element->set_custom_property_data({}, moved);
element->republish_style_record_environment(read);
- move_custom_property_environment_below(*application, *element, existing_base, moved);
+ if (element->first_element_child() || element->shadow_root() || is<HTML::HTMLSlotElement>(*element))
+ move_custom_property_environment_below(*application, *element, existing_base, moved);
}
static void propagate_custom_property_environment_move(StyleReactionApplication& application, DOM::Element& origin, RefPtr<CustomPropertyData const> old_origin_data)