Bug 1303235 - Part 1: Add ResolveServoStyleByAddingAnimation. r=hiro

We need to create a temporary ServoStyleContext with the animation value for
calculating the Cumulative change hints.

MozReview-Commit-ID: JzArnaGqVeV

--HG--
extra : rebase_source : 2947910e07f0aab6b385ca60cef927966d15bcf6
This commit is contained in:
Boris Chiou 2017-10-19 10:51:55 +08:00
Родитель 74ab4a0a06
Коммит a43997fa7b
3 изменённых файлов: 41 добавлений и 0 удалений

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

@ -647,6 +647,14 @@ SERVO_BINDING_FUNC(Servo_StyleSet_GetBaseComputedValuesForElement,
ServoStyleContextBorrowed existing_style,
const mozilla::ServoElementSnapshotTable* snapshots,
mozilla::CSSPseudoElementType pseudo_type)
// Returns computed values for the given element by adding an animation value.
SERVO_BINDING_FUNC(Servo_StyleSet_GetComputedValuesByAddingAnimation,
ServoStyleContextStrong,
RawServoStyleSetBorrowed set,
RawGeckoElementBorrowed element,
ServoStyleContextBorrowed existing_style,
const mozilla::ServoElementSnapshotTable* snapshots,
RawServoAnimationValueBorrowed animation)
// For canvas font.
SERVO_BINDING_FUNC(Servo_SerializeFontValueForCanvas, void,

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

@ -1239,6 +1239,25 @@ ServoStyleSet::GetBaseContextForElement(
aPseudoType).Consume();
}
already_AddRefed<ServoStyleContext>
ServoStyleSet::ResolveServoStyleByAddingAnimation(
Element* aElement,
const ServoStyleContext* aStyle,
RawServoAnimationValue* aAnimationValue)
{
MOZ_RELEASE_ASSERT(!aElement->OwnerDoc()->GetBFCacheEntry(),
"ResolveServoStyleByAddingAniamtion does not support "
"documents in the bfcache");
AutoClearStaleData guard(aElement);
return Servo_StyleSet_GetComputedValuesByAddingAnimation(
mRawSet.get(),
aElement,
aStyle,
&Snapshots(),
aAnimationValue).Consume();
}
already_AddRefed<RawServoAnimationValue>
ServoStyleSet::ComputeAnimationValue(
Element* aElement,

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

@ -392,6 +392,20 @@ public:
CSSPseudoElementType aPseudoType,
const ServoStyleContext* aStyle);
// Get a style context that represents |aStyle|, but as though
// it additionally matched the rules of the newly added |aAnimaitonaValue|.
// We use this function to temporarily generate a ServoStyleContext for
// calculating the cumulative change hints.
// This must hold:
// The additional rules must be appropriate for the transition
// level of the cascade, which is the highest level of the cascade.
// (This is the case for one current caller, the cover rule used
// for CSS transitions.)
// Note: |aElement| should be the generated element if it is pseudo.
already_AddRefed<ServoStyleContext>
ResolveServoStyleByAddingAnimation(dom::Element* aElement,
const ServoStyleContext* aStyle,
RawServoAnimationValue* aAnimationValue);
/**
* Resolve style for a given declaration block with/without the parent style.
* If the parent style is not specified, the document default computed values