LibWeb: Don't drop layout tree in CSS animation invalidation

It's possible to do a partial tree rebuild instead.
This commit is contained in:
Aliaksandr Kalenik 2025-03-08 18:06:15 +01:00 committed by Andreas Kling
parent 067d21b8a4
commit 268143681e
Notes: github-actions[bot] 2025-03-08 23:07:20 +00:00
2 changed files with 9 additions and 3 deletions

View file

@ -963,8 +963,15 @@ void KeyframeEffect::update_computed_properties()
if (invalidation.relayout)
target->set_needs_layout_update(DOM::SetNeedsLayoutReason::KeyframeEffect);
if (invalidation.rebuild_layout_tree)
document.invalidate_layout_tree(DOM::InvalidateLayoutTreeReason::KeyframeEffect);
if (invalidation.rebuild_layout_tree) {
// We mark layout tree for rebuild starting from parent element to correctly invalidate
// "display" property change to/from "contents" value.
if (auto* parent_element = target->parent_element()) {
parent_element->set_needs_layout_tree_update(true);
} else {
target->set_needs_layout_tree_update(true);
}
}
if (invalidation.repaint) {
document.set_needs_display();
document.set_needs_to_resolve_paint_only_properties();

View file

@ -55,7 +55,6 @@ enum class QuirksMode {
X(DocumentRequestAnElementToBeRemovedFromTheTopLayer) \
X(HTMLInputElementSrcAttributeChange) \
X(HTMLObjectElement) \
X(KeyframeEffect) \
X(SVGGraphicsElementTransformAttributeChange) \
X(ShadowRootSetInnerHTML)