mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1203766 - Part 4: Add a "restyle generation" counter, which increments whenever we process pending restyles. r=bzbarsky
This commit is contained in:
parent
5cd9b296f7
commit
54e04d5eff
@ -83,6 +83,7 @@ RestyleManager::RestyleManager(nsPresContext* aPresContext)
|
||||
, mInStyleRefresh(false)
|
||||
, mSkipAnimationRules(false)
|
||||
, mHavePendingNonAnimationRestyles(false)
|
||||
, mRestyleGeneration(1)
|
||||
, mHoverGeneration(0)
|
||||
, mRebuildAllExtraHint(nsChangeHint(0))
|
||||
, mRebuildAllRestyleHint(nsRestyleHint(0))
|
||||
|
@ -91,6 +91,10 @@ public:
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aOldValue);
|
||||
|
||||
// Get an integer that increments every time we process pending restyles.
|
||||
// The value is never 0.
|
||||
uint32_t GetRestyleGeneration() const { return mRestyleGeneration; }
|
||||
|
||||
// Get an integer that increments every time there is a style change
|
||||
// as a result of a change to the :hover content state.
|
||||
uint32_t GetHoverGeneration() const { return mHoverGeneration; }
|
||||
@ -519,6 +523,12 @@ private:
|
||||
// Fast-path the common case (esp. for the animation restyle
|
||||
// tracker) of not having anything to do.
|
||||
if (aRestyleTracker.Count() || ShouldStartRebuildAllFor(aRestyleTracker)) {
|
||||
if (++mRestyleGeneration == 0) {
|
||||
// Keep mRestyleGeneration from being 0, since that's what
|
||||
// nsPresContext::GetRestyleGeneration returns when it no
|
||||
// longer has a RestyleManager.
|
||||
++mRestyleGeneration;
|
||||
}
|
||||
aRestyleTracker.DoProcessRestyles();
|
||||
}
|
||||
}
|
||||
@ -539,6 +549,7 @@ private:
|
||||
bool mSkipAnimationRules : 1;
|
||||
bool mHavePendingNonAnimationRestyles : 1;
|
||||
|
||||
uint32_t mRestyleGeneration;
|
||||
uint32_t mHoverGeneration;
|
||||
nsChangeHint mRebuildAllExtraHint;
|
||||
nsRestyleHint mRebuildAllRestyleHint;
|
||||
|
@ -2844,6 +2844,15 @@ nsPresContext::IsDeviceSizePageSize()
|
||||
return isDeviceSizePageSize;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
nsPresContext::GetRestyleGeneration() const
|
||||
{
|
||||
if (!mRestyleManager) {
|
||||
return 0;
|
||||
}
|
||||
return mRestyleManager->GetRestyleGeneration();
|
||||
}
|
||||
|
||||
nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
|
||||
nsPresContextType aType)
|
||||
: nsPresContext(aDocument, aType),
|
||||
|
@ -915,6 +915,11 @@ public:
|
||||
mAllInvalidated = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the RestyleManager's restyle generation counter.
|
||||
*/
|
||||
uint64_t GetRestyleGeneration() const;
|
||||
|
||||
/**
|
||||
* Returns whether there are any pending restyles or reflows.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user