Bug 960465 patch 2 - Add method to return a modified version of a style context, with all or part of the animation data removed. r=birtles

This is used in patch 3.
This commit is contained in:
L. David Baron 2015-02-17 11:15:01 +13:00
Родитель e5827e4f0a
Коммит 4eedf5bf60
3 изменённых файлов: 39 добавлений и 0 удалений

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

@ -114,6 +114,10 @@ public:
return mSkipAnimationRules;
}
void SetSkipAnimationRules(bool aSkipAnimationRules) {
mSkipAnimationRules = aSkipAnimationRules;
}
// Whether rule matching should post animation restyles when it skips
// styles associated with animation. Only true when
// SkipAnimationRules() is also true.
@ -123,6 +127,10 @@ public:
return mPostAnimationRestyles;
}
void SetPostAnimationRestyles(bool aPostAnimationRestyles) {
mPostAnimationRestyles = aPostAnimationRestyles;
}
// Whether we're currently in the animation phase of restyle
// processing (to be eliminated in bug 960465)
bool IsProcessingAnimationStyleChange() const {

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

@ -1649,6 +1649,28 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
elementForAnimation, flags);
}
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
nsStyleContext* aStyleContext,
nsRestyleHint aWhichToRemove)
{
RestyleManager* restyleManager = PresContext()->RestyleManager();
bool oldSkipAnimationRules = restyleManager->SkipAnimationRules();
restyleManager->SetSkipAnimationRules(true);
bool oldPostAnimationRestyles = restyleManager->PostAnimationRestyles();
restyleManager->SetPostAnimationRestyles(false);
nsRefPtr<nsStyleContext> result =
ResolveStyleWithReplacement(aTarget, aStyleContext->GetParent(),
aStyleContext, aWhichToRemove,
eSkipStartingAnimations);
restyleManager->SetPostAnimationRestyles(oldPostAnimationRestyles);
restyleManager->SetSkipAnimationRules(oldSkipAnimationRules);
return result.forget();
}
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)

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

@ -144,6 +144,15 @@ class nsStyleSet
nsRestyleHint aReplacements,
uint32_t aFlags = 0);
// Resolve style by returning a style context with the specified
// animation data removed. It is allowable to remove all animation
// data with eRestyle_ChangeAnimationPhase, or by using any other
// hints that are allowed by ResolveStyleWithReplacement.
already_AddRefed<nsStyleContext>
ResolveStyleWithoutAnimation(mozilla::dom::Element* aElement,
nsStyleContext* aStyleContext,
nsRestyleHint aWhichToRemove);
// Get a style context for a non-element (which no rules will match),
// such as text nodes, placeholder frames, and the nsFirstLetterFrame
// for everything after the first letter.