Bug 1328787 - Part 3: Add functions for filling each servo's animation keyframes into nsTArray<Keyframe>. r=heycam
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sun, 29 Jan 2017 12:58:28 +0900
changeset 331591 70432998700dc0b70fc81bee710cfb05a1244e84
parent 331590 f6330abee7161b9bfe3e283b313cd5829e65aed2
child 331592 2162612b5857ea591eebadca18a13d6006b0cdbe
push id31275
push userphilringnalda@gmail.com
push dateSun, 29 Jan 2017 17:02:37 +0000
treeherdermozilla-central@77af15f468e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1328787
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1328787 - Part 3: Add functions for filling each servo's animation keyframes into nsTArray<Keyframe>. r=heycam The argument, ServoComputedValues*, will be used the case where keyframe is not specified. MozReview-Commit-ID: HqqEXuYajCi
layout/style/ServoBindingList.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -61,16 +61,22 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Prepen
 SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
 SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet,
                    RawServoStyleSheetBorrowed reference, bool flush)
 SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set)
 SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
                    RawServoStyleSetBorrowed set)
+SERVO_BINDING_FUNC(Servo_StyleSet_FillKeyframesForName, bool,
+                   RawServoStyleSetBorrowed set,
+                   const nsACString* property,
+                   const nsTimingFunction* timing_function,
+                   ServoComputedValuesBorrowed computed_values,
+                   RawGeckoKeyframeListBorrowedMut keyframe_list)
 
 // CSSRuleList
 SERVO_BINDING_FUNC(Servo_CssRules_ListTypes, void,
                    ServoCssRulesBorrowed rules,
                    nsTArrayBorrowed_uintptr_t result)
 SERVO_BINDING_FUNC(Servo_CssRules_GetStyleRuleAt, RawServoStyleRuleStrong,
                    ServoCssRulesBorrowed rules, uint32_t index)
 SERVO_BINDING_FUNC(Servo_CssRules_InsertRule, nsresult,
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -543,16 +543,30 @@ ServoStyleSet::AssertTreeIsClean()
 {
   DocumentStyleRootIterator iter(mPresContext->Document());
   while (Element* root = iter.GetNextStyleRoot()) {
     Servo_AssertTreeIsClean(root);
   }
 }
 #endif
 
+bool
+ServoStyleSet::FillKeyframesForName(const nsString& aName,
+                                    const nsTimingFunction& aTimingFunction,
+                                    const ServoComputedValues* aComputedValues,
+                                    nsTArray<Keyframe>& aKeyframes)
+{
+  NS_ConvertUTF16toUTF8 name(aName);
+  return Servo_StyleSet_FillKeyframesForName(mRawSet.get(),
+                                             &name,
+                                             &aTimingFunction,
+                                             aComputedValues,
+                                             &aKeyframes);
+}
+
 void
 ServoStyleSet::RebuildData()
 {
   Servo_StyleSet_RebuildData(mRawSet.get());
 }
 
 ServoComputedValuesStrong
 ServoStyleSet::RestyleWithAddedDeclaration(RawServoDeclarationBlock* aDeclarations,
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -21,20 +21,22 @@
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
 class CSSStyleSheet;
 class ServoRestyleManager;
 class ServoStyleSheet;
+struct Keyframe;
 } // namespace mozilla
 class nsIDocument;
 class nsStyleContext;
 class nsPresContext;
+struct nsTimingFunction;
 struct TreeMatchContext;
 
 namespace mozilla {
 
 /**
  * The set of style sheets that apply to a document, backed by a Servo
  * Stylist.  A ServoStyleSet contains ServoStyleSheets.
  */
@@ -174,16 +176,21 @@ public:
 
   /**
    * Restyle with added declaration, for use in animations.
    */
   ServoComputedValuesStrong RestyleWithAddedDeclaration(
     RawServoDeclarationBlock* aDeclarations,
     const ServoComputedValues* aPreviousStyle);
 
+  bool FillKeyframesForName(const nsString& aName,
+                            const nsTimingFunction& aTimingFunction,
+                            const ServoComputedValues* aComputedValues,
+                            nsTArray<Keyframe>& aKeyframes);
+
 private:
   already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
                                               nsStyleContext* aParentContext,
                                               nsIAtom* aPseudoTag,
                                               CSSPseudoElementType aPseudoType);
 
   already_AddRefed<nsStyleContext> GetContext(nsIContent* aContent,
                                               nsStyleContext* aParentContext,