Bug 1324700 - Add an FFI which returns computed values for a given declaration block with/without parent_style. r=heycam

The function uses document's default computed values if the parent style
is not specified.

MozReview-Commit-ID: ICd3phAi0C6

--HG--
extra : rebase_source : 343dee682096b75cd7f905db7207823f7e3624b5
This commit is contained in:
Hiroyuki Ikezoe 2017-04-15 07:37:35 +09:00
Родитель 175655448b
Коммит 51d6b62cb0
3 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -70,6 +70,11 @@ SERVO_BINDING_FUNC(Servo_StyleSet_FillKeyframesForName, bool,
SERVO_BINDING_FUNC(Servo_StyleSet_GetFontFaceRules, void,
RawServoStyleSetBorrowed set,
RawGeckoFontFaceRuleListBorrowedMut list)
SERVO_BINDING_FUNC(Servo_StyleSet_ResolveForDeclarations,
ServoComputedValuesStrong,
RawServoStyleSetBorrowed set,
ServoComputedValuesBorrowedOrNull parent_style,
RawServoDeclarationBlockBorrowed declarations)
// CSSRuleList
SERVO_BINDING_FUNC(Servo_CssRules_ListTypes, void,

Просмотреть файл

@ -924,4 +924,14 @@ ServoStyleSet::AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
return true;
}
already_AddRefed<ServoComputedValues>
ServoStyleSet::ResolveForDeclarations(
ServoComputedValuesBorrowedOrNull aParentOrNull,
RawServoDeclarationBlockBorrowed aDeclarations)
{
return Servo_StyleSet_ResolveForDeclarations(mRawSet.get(),
aParentOrNull,
aDeclarations).Consume();
}
bool ServoStyleSet::sInServoTraversal = false;

Просмотреть файл

@ -297,6 +297,15 @@ public:
already_AddRefed<ServoComputedValues>
GetBaseComputedValuesForElement(dom::Element* aElement, nsIAtom* aPseudoTag);
/**
* Resolve style for a given declaration block with/without the parent style.
* If the parent style is not specified, the document default computed values
* is used.
*/
already_AddRefed<ServoComputedValues>
ResolveForDeclarations(ServoComputedValuesBorrowedOrNull aParentOrNull,
RawServoDeclarationBlockBorrowed aDeclarations);
private:
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
nsStyleContext* aParentContext,