Bug 1343753 - Part 9: Early return for non-animatable properties for transitions. draft
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 12 Apr 2017 16:37:09 +0800
changeset 561131 37f9ea1275bb23b585e4ef3631ea0c54a2908073
parent 561130 c15a8eea0d3619bef0b63a16811c6b7552e7deed
child 623893 22e4fce038f1ae2c13232166c3df11fb38376775
push id53643
push userbmo:boris.chiou@gmail.com
push dateWed, 12 Apr 2017 08:51:47 +0000
bugs1343753
milestone55.0a1
Bug 1343753 - Part 9: Early return for non-animatable properties for transitions. MozReview-Commit-ID: HtNavkzyHvt
layout/style/ServoBindingList.h
layout/style/nsTransitionManager.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -138,16 +138,18 @@ SERVO_BINDING_FUNC(Servo_GetComputedKeyf
 SERVO_BINDING_FUNC(Servo_AnimationValueMap_Push, void,
                    RawServoAnimationValueMapBorrowed,
                    nsCSSPropertyID property,
                    RawServoAnimationValueBorrowed value)
 SERVO_BINDING_FUNC(Servo_ComputedValues_ExtractAnimationValue,
                    RawServoAnimationValueStrong,
                    ServoComputedValuesBorrowed computed_values,
                    nsCSSPropertyID property)
+SERVO_BINDING_FUNC(Servo_Property_IsAnimatable, bool,
+                   nsCSSPropertyID property)
 SERVO_BINDING_FUNC(Servo_Property_IsDiscreteAnimatable, bool,
                    nsCSSPropertyID property)
 
 // AnimationValues handling
 SERVO_BINDING_FUNC(Servo_AnimationValues_Interpolate,
                    RawServoAnimationValueStrong,
                    RawServoAnimationValueBorrowed from,
                    RawServoAnimationValueBorrowed to,
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -822,16 +822,26 @@ GetTransitionKeyframes(nsCSSPropertyID a
     fromFrame.mTimingFunction->Init(aTimingFunction);
   }
 
   AppendKeyframe(1.0, aProperty, Move(aEndValue), keyframes);
 
   return keyframes;
 }
 
+static bool
+IsAnimatable(nsCSSPropertyID aProperty, bool aIsServo)
+{
+  if (aIsServo) {
+    return Servo_Property_IsAnimatable(aProperty);
+  }
+
+  return nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_None;
+}
+
 template<typename StyleType>
 void
 nsTransitionManager::ConsiderInitiatingTransition(
   nsCSSPropertyID aProperty,
   const StyleTransition& aTransition,
   dom::Element* aElement,
   CSSPseudoElementType aPseudoType,
   CSSTransitionCollection*& aElementTransitions,
@@ -856,17 +866,17 @@ nsTransitionManager::ConsiderInitiatingT
   if (aWhichStarted->HasProperty(aProperty)) {
     // A later item in transition-property already started a
     // transition for this property, so we ignore this one.
     // See comment above and
     // http://lists.w3.org/Archives/Public/www-style/2009Aug/0109.html .
     return;
   }
 
-  if (nsCSSProps::kAnimTypeTable[aProperty] == eStyleAnimType_None) {
+  if (!IsAnimatable(aProperty, aElement->IsStyledByServo())) {
     return;
   }
 
   dom::DocumentTimeline* timeline = aElement->OwnerDoc()->Timeline();
 
   AnimationValue startValue, endValue;
   bool haveValues =
     ExtractNonDiscreteComputedValue(aProperty, aOldStyle, startValue) &&