Bug 1524480 - Don't share styles when an element has animations applied to it; r=emilio
authorBrian Birtles <birtles@gmail.com>
Fri, 15 Feb 2019 06:35:04 +0000
changeset 459523 1f26e2c082a8cd867431646765652a01381465e5
parent 459522 656ababf4eda2a93a460b5129d1f615c43f96695
child 459524 c8b3e45cd0313144925f44c10bfd47d430ee2b26
push id111964
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:54:44 +0000
treeherdermozilla-inbound@db3c4f905082 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1524480 - Don't share styles when an element has animations applied to it; r=emilio 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
--- a/layout/style/GeckoBindings.h
+++ b/layout/style/GeckoBindings.h
@@ -215,16 +215,17 @@ void Gecko_UpdateAnimations(RawGeckoElem
                             ComputedStyleBorrowedOrNull aOldComputedValues,
                             ComputedStyleBorrowedOrNull aComputedValues,
                             mozilla::UpdateAnimationsTasks aTasks);
 size_t Gecko_GetAnimationEffectCount(RawGeckoElementBorrowed aElementOrPseudo);
 bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElementOrPseudo);
 bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElementOrPseudo);
 bool Gecko_ElementHasCSSTransitions(RawGeckoElementBorrowed aElementOrPseudo);
+bool Gecko_ElementHasWebAnimations(RawGeckoElementBorrowed aElementOrPseudo);
 size_t Gecko_ElementTransitions_Length(
     RawGeckoElementBorrowed aElementOrPseudo);
 nsCSSPropertyID Gecko_ElementTransitions_PropertyAt(
     RawGeckoElementBorrowed aElementOrPseudo, size_t aIndex);
 RawServoAnimationValueBorrowedOrNull Gecko_ElementTransitions_EndValueAt(
     RawGeckoElementBorrowed aElementOrPseudo, size_t aIndex);
--- a/servo/components/style/sharing/mod.rs
+++ b/servo/components/style/sharing/mod.rs
@@ -761,16 +761,21 @@ impl<E: TElement> StyleSharingCache<E> {
             return None;
         if target.element.shadow_root().is_some() {
             trace!("Miss: Shadow host");
             return None;
+        if target.element.has_animations() {
+            trace!("Miss: Has Animations");
+            return None;
+        }
         if target.matches_user_and_author_rules() !=
             trace!("Miss: User and Author Rules");
             return None;
         // It's possible that there are no styles for either id.