mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Avoid unnecessary work when element display property changes
`play_or_cancel_animations_after_display_property_change` is called whenever an element is inserted or removed, or it's display property changes, but it is only required to run if we actually have animations to play or cancel. Reduces time spent in the aforementioned function from ~2% to ~0.03% when loading https://en.wikipedia.org/wiki/2023_in_American_television
This commit is contained in:
parent
cfc22a4075
commit
55afa9d37e
Notes:
github-actions[bot]
2025-11-11 08:36:51 +00:00
Author: https://github.com/Calme1709
Commit: 55afa9d37e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6787
Reviewed-by: https://github.com/tcl3 ✅
4 changed files with 21 additions and 0 deletions
|
|
@ -4177,6 +4177,10 @@ FlyString const& Element::html_uppercased_qualified_name() const
|
|||
|
||||
void Element::play_or_cancel_animations_after_display_property_change()
|
||||
{
|
||||
// OPTIMIZATION: We don't care about elements with no CSS defined animations
|
||||
if (!has_css_defined_animations())
|
||||
return;
|
||||
|
||||
// OPTIMIZATION: We don't care about animations in disconnected subtrees.
|
||||
if (!is_connected())
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue