Bug 1355348 - Add constructor to AnimationValue; r=hiro
authorBrian Birtles <birtles@gmail.com>
Wed, 26 Apr 2017 13:00:11 +0900
changeset 569346 7dbc4fb20502929868f0e855665507214455b328
parent 569345 a1e5a034eefb49ca4b577c0b44c77a5ca377d2e4
child 569347 e5f624959d3dbae43c5f5e0f2364cabf62fc5936
push id56143
push userbmo:jeremychen@mozilla.com
push dateThu, 27 Apr 2017 10:17:21 +0000
reviewershiro
bugs1355348
milestone55.0a1
Bug 1355348 - Add constructor to AnimationValue; r=hiro We will use this later in this patch series to simplify the creation of SMIL's ValueWrapper objects. MozReview-Commit-ID: 7EF9CN2SdwQ
layout/base/nsLayoutUtils.cpp
layout/painting/nsDisplayList.cpp
layout/style/StyleAnimationValue.h
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -591,17 +591,18 @@ GetMinAndMaxScaleForAnimationProperty(co
       }
 
       // We need to factor in the scale of the base style if the base style
       // will be used on the compositor.
       StyleAnimationValue baseStyle = effect->BaseStyle(prop.mProperty);
       if (!baseStyle.IsNull()) {
         // FIXME: Bug 1334036: We need to get the baseStyle for
         //        RawServoAnimationValue.
-        UpdateMinMaxScale(aFrame, { baseStyle, nullptr }, aMinScale, aMaxScale);
+        UpdateMinMaxScale(aFrame, AnimationValue(baseStyle),
+                          aMinScale, aMaxScale);
       }
 
       for (const AnimationPropertySegment& segment : prop.mSegments) {
         // In case of add or accumulate composite, StyleAnimationValue does
         // not have a valid value.
         if (segment.HasReplaceableFromValue()) {
           UpdateMinMaxScale(aFrame, segment.mFromValue, aMinScale, aMaxScale);
         }
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -557,17 +557,17 @@ AddAnimationForProperty(nsIFrame* aFrame
   // to the compositor.
 
   StyleAnimationValue baseStyle =
     aAnimation->GetEffect()->AsKeyframeEffect()->BaseStyle(aProperty.mProperty);
   if (!baseStyle.IsNull()) {
     // FIXME: Bug 1334036: We need to get the baseValue for
     //        RawServoAnimationValue.
     SetAnimatable(aProperty.mProperty,
-                  { baseStyle, nullptr },
+                  AnimationValue(baseStyle),
                   aFrame, refBox,
                   animation->baseStyle());
   } else {
     animation->baseStyle() = null_t();
   }
 
   for (uint32_t segIdx = 0; segIdx < aProperty.mSegments.Length(); segIdx++) {
     const AnimationPropertySegment& segment = aProperty.mSegments[segIdx];
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -565,16 +565,22 @@ private:
   }
   static bool IsStringUnit(Unit aUnit) {
     return aUnit == eUnit_UnparsedString;
   }
 };
 
 struct AnimationValue
 {
+  explicit AnimationValue(const StyleAnimationValue& aValue)
+    : mGecko(aValue) { }
+  explicit AnimationValue(const RefPtr<RawServoAnimationValue>& aValue)
+    : mServo(aValue) { }
+  AnimationValue() = default;
+
   // mGecko and mServo are mutually exclusive: only one or the other should
   // ever be set.
   // FIXME: After obsoleting StyleAnimationValue, we should remove mGecko, and
   // make AnimationValue a wrapper of RawServoAnimationValue to hide these
   // FFIs.
   StyleAnimationValue mGecko;
   RefPtr<RawServoAnimationValue> mServo;