Bug 1371518 - Use Servo backend to determine if a property is transitionable; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Thu, 15 Jun 2017 09:54:06 +0900
changeset 594417 38f7043a196299427b961bc40f77e4c3f9602bc9
parent 594416 94f2832af0e7047aa9ac62a832e0ebb44a90d086
child 594418 b5fbcf4b6bbbf29f2a354df45660d230ab746762
push id64022
push userbbirtles@mozilla.com
push dateThu, 15 Jun 2017 01:32:06 +0000
reviewershiro
bugs1371518
milestone56.0a1
Bug 1371518 - Use Servo backend to determine if a property is transitionable; r?hiro This allows Gecko to use the same criteria as Servo for evaluating if a property should be transitioned and will cause Gecko to exclude discretely animated properties, including, in future, the 'display' property. MozReview-Commit-ID: H2wWVo5isKS
layout/style/ServoBindingList.h
layout/style/nsTransitionManager.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -223,16 +223,18 @@ SERVO_BINDING_FUNC(Servo_GetComputedKeyf
                    RawServoStyleSetBorrowed set,
                    RawGeckoComputedKeyframeValuesListBorrowedMut result)
 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_IsTransitionable, bool,
+                   nsCSSPropertyID property)
 SERVO_BINDING_FUNC(Servo_Property_IsDiscreteAnimatable, bool,
                    nsCSSPropertyID property)
 SERVO_BINDING_FUNC(Servo_GetProperties_Overriding_Animation, void,
                    RawGeckoElementBorrowed,
                    RawGeckoCSSPropertyIDListBorrowed,
                    nsCSSPropertyIDSetBorrowedMut)
 SERVO_BINDING_FUNC(Servo_MatrixTransform_Operate, void,
                    nsStyleTransformMatrix::MatrixTransformOperator
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -823,22 +823,23 @@ GetTransitionKeyframes(nsCSSPropertyID a
   }
 
   AppendKeyframe(1.0, aProperty, Move(aEndValue), keyframes);
 
   return keyframes;
 }
 
 static bool
-IsAnimatable(nsCSSPropertyID aProperty, bool aIsServo)
+IsTransitionable(nsCSSPropertyID aProperty, bool aIsServo)
 {
   if (aIsServo) {
-    return Servo_Property_IsAnimatable(aProperty);
+    return Servo_Property_IsTransitionable(aProperty);
   }
 
+  // FIXME: This should also exclude discretely-animated properties.
   return nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_None;
 }
 
 template<typename StyleType>
 void
 nsTransitionManager::ConsiderInitiatingTransition(
   nsCSSPropertyID aProperty,
   const StyleTransition& aTransition,
@@ -866,17 +867,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 (!IsAnimatable(aProperty, aElement->IsStyledByServo())) {
+  if (!IsTransitionable(aProperty, aElement->IsStyledByServo())) {
     return;
   }
 
   dom::DocumentTimeline* timeline = aElement->OwnerDoc()->Timeline();
 
   AnimationValue startValue, endValue;
   bool haveValues =
     ExtractNonDiscreteComputedValue(aProperty, aOldStyle, startValue) &&