Skip to content

Conversation

@varjolintu
Copy link
Member

If a page has elements that have animation CSS defined, the MutationObserver will trigger with each small change. Without this change getComputedStyle() will be called to those changes, and it can cause performance issues.

This could potentially break some sites, but we can always add exceptions for those.

Fixes #2363.

@varjolintu varjolintu added the bug label Oct 20, 2024
@varjolintu varjolintu added this to the 1.9.4 milestone Oct 20, 2024
Copy link
Member

@droidmonkey droidmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this have adverse affects on login windows that animate? Fade-in/out for example?

@varjolintu
Copy link
Member Author

Could this have adverse affects on login windows that animate? Fade-in/out for example?

Possibly. That's why I'm little worried. I'll test some sites where I have seen animations before I merge this.

@droidmonkey
Copy link
Member

droidmonkey commented Oct 20, 2024

Maybe ignore anything within a FORM element (ie, don't worry about animations if its related to a FORM). This also brings up the discussion of deferring / bundling the checks. You could accumulate a list of activations through mutation observer, overwriting those that repeat, and do the processing on the list once a second or something like that. So if an element is mutating every millisecond you only do the intense processing once per second anyway. We could also build an "ignore list" of elements that are triggered from the mutation observer more than X number of times. Very unlikely those elements would be a login form.

@varjolintu
Copy link
Member Author

varjolintu commented Oct 20, 2024

Maybe ignore anything within a FORM element (ie, don't worry about animations if its related to a FORM). This also brings up the discussion of deferring / bundling the checks. You could accumulate a list of activations through mutation observer, overwriting those that repeat, and do the processing on the list once a second or something like that. So if an element is mutating every millisecond you only do the intense processing once per second anyway.

Yes, I've thought something like that. In this case there was just one mutation with minimal changes to the CSS styles, but the class and everything else remains the same. This kind of site is pretty good for testing.

Problems occur if the relevant change is somewhere in the middle of 10 000 different mutations.

@varjolintu varjolintu merged commit 7e291a2 into develop Oct 21, 2024
@varjolintu varjolintu deleted the fix/ignore_elements_with_animations branch October 21, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Animations on firefox are jittery due to keepassxc-browser

3 participants