mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1334735 - Part 2: Add separate flag to track need to flush throttled animations. r=bz,birtles
MozReview-Commit-ID: 6Vi3laKcbmG
This commit is contained in:
parent
b2ee81223c
commit
71d4bbc431
@ -264,7 +264,7 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
|
||||
if (!elementsToRestyle.Contains(key)) {
|
||||
elementsToRestyle.Put(key, false);
|
||||
}
|
||||
mPresContext->PresShell()->SetNeedStyleFlush();
|
||||
mPresContext->PresShell()->SetNeedThrottledAnimationFlush();
|
||||
} else {
|
||||
// Get() returns 0 if the element is not found. It will also return
|
||||
// false if the element is found but does not have a pending restyle.
|
||||
|
@ -798,6 +798,7 @@ nsIPresShell::nsIPresShell()
|
||||
, mScrollPositionClampingScrollPortSizeSet(false)
|
||||
, mNeedLayoutFlush(true)
|
||||
, mNeedStyleFlush(true)
|
||||
, mNeedThrottledAnimationFlush(true)
|
||||
, mPresShellId(0)
|
||||
, mFontSizeInflationEmPerLine(0)
|
||||
, mFontSizeInflationMinTwips(0)
|
||||
@ -4120,6 +4121,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
mInFlush = true;
|
||||
|
||||
mNeedStyleFlush = false;
|
||||
mNeedThrottledAnimationFlush =
|
||||
mNeedThrottledAnimationFlush && !aFlush.mFlushAnimations;
|
||||
mNeedLayoutFlush =
|
||||
mNeedLayoutFlush && (flushType < FlushType::InterruptibleLayout);
|
||||
|
||||
@ -4247,6 +4250,9 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
|
||||
if (!didStyleFlush && flushType >= FlushType::Style && !mIsDestroying) {
|
||||
SetNeedStyleFlush();
|
||||
if (aFlush.mFlushAnimations) {
|
||||
SetNeedThrottledAnimationFlush();
|
||||
}
|
||||
}
|
||||
|
||||
if (!didLayoutFlush && !mIsDestroying &&
|
||||
|
@ -590,24 +590,27 @@ public:
|
||||
* function returns false, we definitely don't need to flush.
|
||||
*
|
||||
* @param aFlushType The flush type to check. This must be
|
||||
* >= FlushType::Style.
|
||||
* >= FlushType::Style. This also returns true if a throttled
|
||||
* animation flush is required.
|
||||
*/
|
||||
bool NeedFlush(mozilla::FlushType aType) const
|
||||
{
|
||||
// We check mInFlush to handle re-entrant calls to FlushPendingNotifications
|
||||
// by reporting that we always need a flush in that case. Otherwise,
|
||||
// we could end up missing needed flushes, since we clear mNeedStyleFlush
|
||||
// and mNeedLayoutFlush at the top of FlushPendingNotifications.
|
||||
// we could end up missing needed flushes, since we clear the mNeedXXXFlush
|
||||
// flags at the top of FlushPendingNotifications.
|
||||
MOZ_ASSERT(aType >= mozilla::FlushType::Style);
|
||||
return mNeedStyleFlush ||
|
||||
(mNeedLayoutFlush &&
|
||||
aType >= mozilla::FlushType::InterruptibleLayout) ||
|
||||
aType >= mozilla::FlushType::Display ||
|
||||
mNeedThrottledAnimationFlush ||
|
||||
mInFlush;
|
||||
}
|
||||
|
||||
inline void SetNeedStyleFlush();
|
||||
inline void SetNeedLayoutFlush();
|
||||
inline void SetNeedThrottledAnimationFlush();
|
||||
|
||||
bool NeedStyleFlush() { return mNeedStyleFlush; }
|
||||
|
||||
@ -1837,6 +1840,10 @@ protected:
|
||||
// True if a style flush might not be a no-op
|
||||
bool mNeedStyleFlush : 1;
|
||||
|
||||
// True if there are throttled animations that would be processed when
|
||||
// performing a flush with mFlushAnimations == true.
|
||||
bool mNeedThrottledAnimationFlush : 1;
|
||||
|
||||
uint32_t mPresShellId;
|
||||
|
||||
// List of subtrees rooted at style scope roots that need to be restyled.
|
||||
|
@ -25,4 +25,15 @@ nsIPresShell::SetNeedStyleFlush()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsIPresShell::SetNeedThrottledAnimationFlush()
|
||||
{
|
||||
mNeedThrottledAnimationFlush = true;
|
||||
if (nsIDocument* doc = mDocument->GetDisplayDocument()) {
|
||||
if (nsIPresShell* shell = doc->GetShell()) {
|
||||
shell->mNeedThrottledAnimationFlush = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // nsIPresShellInlines_h
|
||||
|
Loading…
Reference in New Issue
Block a user