Bug 1367293 - Don't get parent style for ComputeAnimationValue. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 02 Jun 2017 09:38:46 +0900
changeset 588046 6fc04d4db113cfea2624848285058c491fb61462
parent 588045 9be37aca18cdf17c6fcb5e5177904c0a42d39dc2
child 588047 8cb7adbc464f9cd2c9df61c7dd28e6bcd963c2ca
push id61886
push userhikezoe@mozilla.com
push dateFri, 02 Jun 2017 02:26:43 +0000
reviewersbirtles
bugs1367293
milestone55.0a1
Bug 1367293 - Don't get parent style for ComputeAnimationValue. r?birtles MozReview-Commit-ID: 4TskjmoKchD
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
layout/style/StyleAnimationValue.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1045,21 +1045,21 @@ ServoStyleSet::GetBaseComputedValuesForE
                                                         &Snapshots(),
                                                         aPseudoType).Consume();
 }
 
 already_AddRefed<RawServoAnimationValue>
 ServoStyleSet::ComputeAnimationValue(
   Element* aElement,
   RawServoDeclarationBlock* aDeclarations,
-  const ServoComputedValuesWithParent& aComputedValues)
+  ServoComputedValuesBorrowed aComputedValues)
 {
   return Servo_AnimationValue_Compute(aElement,
                                       aDeclarations,
-                                      aComputedValues.mCurrentStyle,
+                                      aComputedValues,
                                       mRawSet.get()).Consume();
 }
 
 bool
 ServoStyleSet::EnsureUniqueInnerOnCSSSheets()
 {
   AutoTArray<StyleSheet*, 32> queue;
   for (auto& entryArray : mSheets) {
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -375,17 +375,17 @@ public:
    */
   already_AddRefed<ServoComputedValues>
   ResolveForDeclarations(ServoComputedValuesBorrowedOrNull aParentOrNull,
                          RawServoDeclarationBlockBorrowed aDeclarations);
 
   already_AddRefed<RawServoAnimationValue>
   ComputeAnimationValue(dom::Element* aElement,
                         RawServoDeclarationBlock* aDeclaration,
-                        const ServoComputedValuesWithParent& aComputedValues);
+                        ServoComputedValuesBorrowed aComputedValues);
 
   void AppendTask(PostTraversalTask aTask)
   {
     MOZ_ASSERT(IsInServoTraversal());
 
     // We currently only use PostTraversalTasks while the Servo font metrics
     // mutex is locked.  If we need to use them in other situations during
     // a traversal, we should assert that we've taken appropriate
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -25,17 +25,16 @@
 #include "nsStyleSet.h"
 #include "nsComputedDOMStyle.h"
 #include "nsContentUtils.h"
 #include "nsCSSParser.h"
 #include "nsCSSPseudoElements.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/FloatingPoint.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
 #include "mozilla/KeyframeUtils.h" // KeyframeUtils::ParseProperty
 #include "mozilla/Likely.h"
 #include "mozilla/ServoBindings.h" // RawServoDeclarationBlock
 #include "gfxMatrix.h"
 #include "gfxQuaternion.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "gfx2DGlue.h"
@@ -5370,32 +5369,23 @@ AnimationValue::FromString(nsCSSProperty
 
     RefPtr<RawServoDeclarationBlock> declarations =
       KeyframeUtils::ParseProperty(aProperty, aValue, doc);
 
     if (!declarations) {
       return result;
     }
 
-    // We use the current ServoComputeValues and its parent ServoComputeValues
-    // to reconstruct the Context and then compute the AnimationValue. However,
-    // nsStyleContext::GetParentAllowServo() is going away, so if possible, we
-    // should find another way to get the parent ServoComputedValues.
-    RefPtr<nsStyleContext> parentContext = styleContext->GetParentAllowServo();
-    const ServoComputedValuesWithParent styles = {
-      styleContext->StyleSource().AsServoComputedValues(),
-      parentContext ? parentContext->StyleSource().AsServoComputedValues()
-                    : nullptr
-    };
-
+    const ServoComputedValues* computedValues =
+      styleContext->StyleSource().AsServoComputedValues();
     result.mServo = presContext->StyleSet()
                                ->AsServo()
                                ->ComputeAnimationValue(aElement,
                                                        declarations,
-                                                       styles);
+                                                       computedValues);
     return result;
   }
 
   if (!StyleAnimationValue::ComputeValue(aProperty, aElement, styleContext,
                                          aValue, false /* |aUseSVGMode| */,
                                          result.mGecko)) {
     MOZ_ASSERT(result.IsNull());
   }