Bug 1349004 part 2 - Add ResolveServoStyle for get resolved servo's computed values. r=hiro
MozReview-Commit-ID: 6RCv5YCDxWJ
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -864,16 +864,23 @@ ServoStyleSet::ResolveStyleLazily(Elemen
computedValues =
Servo_ResolveStyleLazily(aElement, aPseudoTag, mRawSet.get()).Consume();
}
sInServoTraversal = false;
return computedValues.forget();
}
+already_AddRefed<ServoComputedValues>
+ServoStyleSet::ResolveServoStyle(Element* aElement, nsIAtom* aPseudoTag)
+{
+ PreTraverseSync();
+ return ResolveStyleLazily(aElement, aPseudoTag);
+}
+
bool
ServoStyleSet::AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
{
Servo_StyleSet_GetFontFaceRules(mRawSet.get(), &aArray);
return true;
}
bool ServoStyleSet::sInServoTraversal = false;
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -266,16 +266,24 @@ public:
void RebuildData();
/**
* Resolve style for the given element, and return it as a
* ServoComputedValues, not an nsStyleContext.
*/
already_AddRefed<ServoComputedValues> ResolveServoStyleWithoutSyncUpData(dom::Element* aElement);
+ /**
+ * Resolve style for the given (pseudo-)element and pseudo information,
+ * and it will call PreTraverseSync() first.
+ */
+ already_AddRefed<ServoComputedValues>
+ ResolveServoStyle(dom::Element* aElement,
+ nsIAtom* aPseudoTag);
+
bool FillKeyframesForName(const nsString& aName,
const nsTimingFunction& aTimingFunction,
const ServoComputedValues* aComputedValues,
nsTArray<Keyframe>& aKeyframes);
nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,