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
--- 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,