Skip to content

Commit

Permalink
LibWeb: Change animation to schedule repaint only when necessary
Browse files Browse the repository at this point in the history
Animation should trigger repaint only if it's required by animated style
update.
  • Loading branch information
kalenikaliaksandr committed Feb 3, 2025
1 parent f5ba22d commit 090bfc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 0 additions & 3 deletions Libraries/LibWeb/Animations/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,6 @@ void Animation::invalidate_effect()

if (auto* target = m_effect->target(); target) {
target->document().set_needs_animated_style_update();
if (target->paintable()) {
target->paintable()->set_needs_display();
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion Libraries/LibWeb/Animations/KeyframeEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,10 @@ void KeyframeEffect::update_computed_properties()
document.set_needs_layout();
if (invalidation.rebuild_layout_tree)
document.invalidate_layout_tree();
if (invalidation.repaint)
if (invalidation.repaint) {
document.set_needs_display();
document.set_needs_to_resolve_paint_only_properties();
}
if (invalidation.rebuild_stacking_context_tree)
document.invalidate_stacking_context_tree();
}
Expand Down
3 changes: 0 additions & 3 deletions Libraries/LibWeb/DOM/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2646,9 +2646,6 @@ void Document::dispatch_events_for_animation_if_necessary(GC::Ref<Animations::An
if (!target)
return;

if (target->paintable())
target->paintable()->set_needs_display();

auto previous_phase = effect->previous_phase();
auto current_phase = effect->phase();
auto current_iteration = effect->current_iteration().value_or(0.0);
Expand Down

0 comments on commit 090bfc9

Please sign in to comment.