Bug 1311257 - Add a function that returns a base computed values (i.e. computed values without any animations rules). r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 06 Apr 2017 10:34:50 +0900
changeset 556561 148446b1af01ac0db481ed1f93dfa36546e00f87
parent 556468 9ffcfb1564d12239e9878026a92ffb58ba391d89
child 556562 dca48155a1aa883e0403685d39d678df90869f5c
push id52584
push userhikezoe@mozilla.com
push dateThu, 06 Apr 2017 03:01:12 +0000
reviewersheycam
bugs1311257
milestone55.0a1
Bug 1311257 - Add a function that returns a base computed values (i.e. computed values without any animations rules). r?heycam This base value will be used for additive, accumulative animations and also SMIL. MozReview-Commit-ID: LHV8ZnxSzjb
layout/style/ServoBindingList.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -310,16 +310,23 @@ SERVO_BINDING_FUNC(Servo_ResolveStyleLaz
 // directly
 SERVO_BINDING_FUNC(Servo_TraverseSubtree, bool,
                    RawGeckoElementBorrowed root, RawServoStyleSetBorrowed set,
                    mozilla::TraversalRootBehavior root_behavior)
 
 // Assert that the tree has no pending or unconsumed restyles.
 SERVO_BINDING_FUNC(Servo_AssertTreeIsClean, void, RawGeckoElementBorrowed root)
 
+// Returns computed values for the given element without any animations rules.
+SERVO_BINDING_FUNC(Servo_StyleSet_GetBaseComputedValuesForElement,
+                   ServoComputedValuesStrong,
+                   RawServoStyleSetBorrowed set,
+                   RawGeckoElementBorrowed element,
+                   nsIAtom* pseudo_tag)
+
 // Style-struct management.
 #define STYLE_STRUCT(name, checkdata_cb)                            \
   struct nsStyle##name;                                             \
   SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*,  \
                      ServoComputedValuesBorrowedOrNull computed_values)
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -782,16 +782,25 @@ ServoStyleSet::GetComputedKeyframeValues
   Servo_GetComputedKeyframeValues(&aKeyframes,
                                   aServoValues.mCurrentStyle,
                                   aServoValues.mParentStyle,
                                   mRawSet.get(),
                                   &result);
   return result;
 }
 
+already_AddRefed<ServoComputedValues>
+ServoStyleSet::GetBaseComputedValuesForElement(Element* aElement,
+                                               nsIAtom* aPseudoTag)
+{
+  return Servo_StyleSet_GetBaseComputedValuesForElement(mRawSet.get(),
+                                                        aElement,
+                                                        aPseudoTag).Consume();
+}
+
 void
 ServoStyleSet::RebuildData()
 {
   ClearNonInheritingStyleContexts();
   Servo_StyleSet_RebuildData(mRawSet.get());
 }
 
 already_AddRefed<ServoComputedValues>
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -269,16 +269,19 @@ public:
   nsTArray<ComputedKeyframeValues>
   GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
                                dom::Element* aElement,
                                const ServoComputedValuesWithParent&
                                  aServoValues);
 
   bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
 
+  already_AddRefed<ServoComputedValues>
+  GetBaseComputedValuesForElement(dom::Element* aElement, nsIAtom* aPseudoTag);
+
 private:
   already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
                                               nsStyleContext* aParentContext,
                                               nsIAtom* aPseudoTag,
                                               CSSPseudoElementType aPseudoType,
                                               dom::Element* aElementForAnimation);
 
   already_AddRefed<nsStyleContext> GetContext(nsIContent* aContent,