Bug 1047928 patch 2 - Pass restyle hint to RestyleManager::RebuildAllStyleData. r=bzbarsky

This patch is not intended to contain any changes in behavior.
This commit is contained in:
L. David Baron 2014-10-08 14:26:57 -07:00
Родитель 072d1af872
Коммит acfd59047e
3 изменённых файлов: 23 добавлений и 11 удалений

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

@ -69,6 +69,7 @@ RestyleManager::RestyleManager(nsPresContext* aPresContext)
, mIsProcessingAnimationStyleChange(false)
, mHoverGeneration(0)
, mRebuildAllExtraHint(nsChangeHint(0))
, mRebuildAllRestyleHint(nsRestyleHint(0))
, mLastUpdateForThrottledAnimations(aPresContext->RefreshDriver()->
MostRecentRefresh())
, mAnimationGeneration(0)
@ -1409,7 +1410,8 @@ RestyleManager::RestyleForRemove(Element* aContainer,
}
void
RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint)
RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)
{
NS_ASSERTION(!(aExtraHint & nsChangeHint_ReconstructFrame),
"Should not reconstruct the root of the frame tree. "
@ -1417,7 +1419,9 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint)
mRebuildAllStyleData = false;
NS_UpdateHint(aExtraHint, mRebuildAllExtraHint);
aRestyleHint |= mRebuildAllRestyleHint;
mRebuildAllExtraHint = nsChangeHint(0);
mRebuildAllRestyleHint = nsRestyleHint(0);
nsIPresShell* presShell = mPresContext->GetPresShell();
if (!presShell || !presShell->GetRootFrame())
@ -1448,13 +1452,7 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint)
mSkipAnimationRules = true;
mPostAnimationRestyles = true;
// FIXME (bug 1047928): Many of the callers probably don't need
// eRestyle_Subtree because they're changing things that affect data
// computation rather than selector matching; we could have a restyle
// hint passed in, and substantially improve the performance of things
// like pref changes and the restyling that we do for downloadable
// font loads.
DoRebuildAllStyleData(mPendingRestyles, aExtraHint, eRestyle_Subtree);
DoRebuildAllStyleData(mPendingRestyles, aExtraHint, aRestyleHint);
mPostAnimationRestyles = false;
mSkipAnimationRules = false;
@ -1589,7 +1587,7 @@ RestyleManager::ProcessPendingRestyles()
// We probably wasted a lot of work up above, but this seems safest
// and it should be rarely used.
// This might add us as a refresh observer again; that's ok.
RebuildAllStyleData(nsChangeHint(0));
RebuildAllStyleData(nsChangeHint(0), nsRestyleHint(0));
}
}
@ -1699,6 +1697,8 @@ RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint)
mRebuildAllStyleData = true;
NS_UpdateHint(mRebuildAllExtraHint, aExtraHint);
// FIXME: pass through from callers
mRebuildAllRestyleHint = eRestyle_Subtree;
// Get a restyle event posted if necessary
PostRestyleEventInternal(false);

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

@ -305,7 +305,17 @@ public:
// Rebuilds all style data by throwing out the old rule tree and
// building a new one, and additionally applying aExtraHint (which
// must not contain nsChangeHint_ReconstructFrame) to the root frame.
void RebuildAllStyleData(nsChangeHint aExtraHint);
//
// aRestyleHint says which restyle hint to use for the computation;
// the only sensible values to use are eRestyle_Subtree (which says
// that the rebuild must run selector matching) and nsRestyleHint(0)
// (which says that rerunning selector matching is not required. (The
// method adds eRestyle_ForceDescendants internally, and including it
// in the restyle hint is harmless; some callers (e.g.,
// nsPresContext::MediaFeatureValuesChanged) might do this for their
// own reasons.)
void RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
// Helper that does part of the work of RebuildAllStyleData, shared by
// RestyleElement for 'rem' handling.
@ -462,6 +472,7 @@ private:
uint32_t mHoverGeneration;
nsChangeHint mRebuildAllExtraHint;
nsRestyleHint mRebuildAllRestyleHint;
mozilla::TimeStamp mLastUpdateForThrottledAnimations;

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

@ -1864,7 +1864,8 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint)
RebuildUserFontSet();
RebuildCounterStyles();
RestyleManager()->RebuildAllStyleData(aExtraHint);
// FIXME: Pass through from callers
RestyleManager()->RebuildAllStyleData(aExtraHint, eRestyle_Subtree);
}
void