Bug 1040668 part 1 - Avoid queuing transition event for disabled properties. r=dbaron
authorXidorn Quan <quanxunzhen@gmail.com>
Sat, 28 Nov 2015 11:56:33 +1100
changeset 308683 4c2fc03f6c174bbfa7c2ae5ea26d5ef1ad3f8940
parent 308682 a25efba616ac9714bb4d8d769adb5a37a8c17151
child 308684 d57862a8ffca78eb225bdf2c0348d9260a85cdc4
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1040668
milestone45.0a1
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 1040668 part 1 - Avoid queuing transition event for disabled properties. r=dbaron
layout/style/nsTransitionManager.cpp
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -136,26 +136,35 @@ CSSTransition::QueueEvents()
     return;
   }
 
   dom::Element* owningElement;
   nsCSSPseudoElements::Type owningPseudoType;
   mOwningElement.GetElement(owningElement, owningPseudoType);
   MOZ_ASSERT(owningElement, "Owning element should be set");
 
+  // Do not queue any event for disabled properties. This could happen
+  // if the property has a default value which derives value from other
+  // property, e.g. color.
+  nsCSSProperty property = TransitionProperty();
+  if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent) &&
+      (!nsContentUtils::IsSystemPrincipal(owningElement->NodePrincipal()) ||
+       !nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledInChrome))) {
+    return;
+  }
+
   nsPresContext* presContext = mOwningElement.GetRenderedPresContext();
   if (!presContext) {
     return;
   }
 
   nsTransitionManager* manager = presContext->TransitionManager();
   manager->QueueEvent(TransitionEventInfo(owningElement, owningPseudoType,
-                                          TransitionProperty(),
-                                          mEffect->Timing()
-                                            .mIterationDuration,
+                                          property,
+                                          mEffect->Timing().mIterationDuration,
                                           AnimationTimeToTimeStamp(EffectEnd()),
                                           this));
 }
 
 void
 CSSTransition::Tick()
 {
   Animation::Tick();