Skip to content
Browse files

style: Don't share styles when an element has animations applied to it.

We already avoid putting styles in the shared style cache for an element that
has animations[1] but if we are doing the initial style of two siblings where
the _second_ has animations applied, there is nothing to stop us from trying to
share with the first (un-animated) element. This patch adds a check to prevent
sharing in that case since sharing style between animated elements is unsound
for the reasons described in [1].

A number of tests including:


will fail without this fix once we remove the style flush from
KeyframeEffect::SetKeyframes later in this patch series.


Differential Revision:
  • Loading branch information...
birtles authored and emilio committed Feb 15, 2019
1 parent 07cb325 commit 71d9fe5d60caf09c964dd77b64a5246a74a37a08
Showing with 5 additions and 0 deletions.
  1. +5 −0 components/style/sharing/
@@ -766,6 +766,11 @@ impl<E: TElement> StyleSharingCache<E> {
return None;

if target.element.has_animations() {
trace!("Miss: Has Animations");
return None;

if target.matches_user_and_author_rules() !=

0 comments on commit 71d9fe5

Please sign in to comment.
You can’t perform that action at this time.