Bug 1232577 part 7 - Move call to SetNeedStyleFlush() to EffectCompositor::RequestRestyle; r=heycam

In this patch series we are gradually migrating style rule updating
functionality from AnimationCollection to EffectCompositor. This patch moves
part of the RequestRestyle method from one class to the other.

Note that in both cases we only call SetNeedsStyleFlush if we haven't already
posted an animation restyle. (In the case of AnimationCollection we check this
using the mHasPendingAnimationRestyle flag, and in EffectCompositor case we
simply check if the element is already in the "needs restyle" hashmap. If it is,
either we already have a throttled restyle and have called SetNeedsStyleFlush or
we have a standard restyle and have posted an animation restyle.)

The added check for a null pres context matches the behavior of
AnimationCollection::RequestRestyle which has an equivalent early return at the
beginning of the function.
This commit is contained in:
Brian Birtles 2016-01-13 07:54:54 +09:00
Родитель 464b5fb4b7
Коммит 21108e5e2e
2 изменённых файлов: 6 добавлений и 7 удалений

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

@ -135,12 +135,18 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
RestyleType aRestyleType,
CascadeLevel aCascadeLevel)
{
if (!mPresContext) {
// Pres context will be null after the effect compositor is disconnected.
return;
}
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
PseudoElementHashKey key = { aElement, aPseudoType };
if (aRestyleType == RestyleType::Throttled &&
!elementsToRestyle.Contains(key)) {
elementsToRestyle.Put(key, false);
mPresContext->Document()->SetNeedStyleFlush();
} else {
elementsToRestyle.Put(key, true);
}

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

@ -508,14 +508,7 @@ AnimationCollection::RequestRestyle(EffectCompositor::RestyleType aRestyleType)
if (aRestyleType >= EffectCompositor::RestyleType::Standard) {
mHasPendingAnimationRestyle = true;
PostRestyleForAnimation(presContext);
return;
}
// Steps for RestyleType::Throttled:
MOZ_ASSERT(aRestyleType == EffectCompositor::RestyleType::Throttled,
"Should have already handled all non-throttled restyles");
presContext->Document()->SetNeedStyleFlush();
}
void