Bug 1324691 - Part 3: Support AnimationsWithDestroyedFrame for ServoRestyleManager. r=heycam

MozReview-Commit-ID: 4cQ6PoieLLG

--HG--
extra : rebase_source : 6f0ca88a379ca9ce73488ae0b68b2b8a43469509
This commit is contained in:
Boris Chiou 2017-01-27 12:45:46 +08:00
Родитель 8941b09399
Коммит 8a0ed49b88
2 изменённых файлов: 16 добавлений и 10 удалений

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

@ -309,6 +309,11 @@ ServoRestyleManager::ProcessPendingRestyles()
return;
}
// Create a AnimationsWithDestroyedFrame during restyling process to
// stop animations and transitions on elements that have no frame at the end
// of the restyling process.
AnimationsWithDestroyedFrame animationsWithDestroyedFrame(this);
ServoStyleSet* styleSet = StyleSet();
nsIDocument* doc = PresContext()->Document();
@ -358,6 +363,11 @@ ServoRestyleManager::ProcessPendingRestyles()
}
IncrementRestyleGeneration();
// Note: We are in the scope of |animationsWithDestroyedFrame|, so
// |mAnimationsWithDestroyedFrame| is still valid.
MOZ_ASSERT(mAnimationsWithDestroyedFrame);
mAnimationsWithDestroyedFrame->StopAnimationsForElementsWithoutFrames();
}
void

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

@ -700,16 +700,12 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
EffectSet::GetEffectSet(this)) {
// If no new frame for this element is created by the end of the
// restyling process, stop animations and transitions for this frame
if (presContext->RestyleManager()->IsGecko()) {
RestyleManagerBase::AnimationsWithDestroyedFrame* adf =
presContext->RestyleManager()->AsGecko()
->GetAnimationsWithDestroyedFrame();
// AnimationsWithDestroyedFrame only lives during the restyling process.
if (adf) {
adf->Put(mContent, mStyleContext);
}
} else {
NS_ERROR("stylo: ServoRestyleManager does not support animations yet");
RestyleManagerBase::AnimationsWithDestroyedFrame* adf =
presContext->RestyleManager()->AsBase()
->GetAnimationsWithDestroyedFrame();
// AnimationsWithDestroyedFrame only lives during the restyling process.
if (adf) {
adf->Put(mContent, mStyleContext);
}
}