From 71d9fe5d60caf09c964dd77b64a5246a74a37a08 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Fri, 15 Feb 2019 06:35:04 +0000 Subject: [PATCH] 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: testing/web-platform/tests/web-animations/animation-model/animation-types/visibility.html will fail without this fix once we remove the style flush from KeyframeEffect::SetKeyframes later in this patch series. [1] https://searchfox.org/mozilla-central/rev/6e3cc153566f5f288ae768a2172385b8436d61dd/servo/components/style/sharing/mod.rs#597 Differential Revision: https://phabricator.services.mozilla.com/D18913 --- components/style/sharing/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index c7be23572c6..0675359ed77 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -766,6 +766,11 @@ impl StyleSharingCache { return None; } + if target.element.has_animations() { + trace!("Miss: Has Animations"); + return None; + } + if target.matches_user_and_author_rules() != candidate.element.matches_user_and_author_rules() {