Bug 896138 patch 10: Move beginning and ending of ProcessPendingRestyles into helper functions on the RestyleManager. r=heycam

This commit is contained in:
L. David Baron 2013-07-30 17:36:08 -07:00
parent 99a10229ff
commit dec690eacf
3 changed files with 34 additions and 20 deletions

View File

@ -1371,6 +1371,32 @@ RestyleManager::ProcessPendingRestyles()
}
}
void
RestyleManager::BeginProcessingRestyles()
{
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
mPresContext->FrameConstructor()->BeginUpdate();
mInStyleRefresh = true;
}
void
RestyleManager::EndProcessingRestyles()
{
FlushOverflowChangedTracker();
// Set mInStyleRefresh to false now, since the EndUpdate call might
// add more restyles.
mInStyleRefresh = false;
mPresContext->FrameConstructor()->EndUpdate();
#ifdef DEBUG
mPresContext->PresShell()->VerifyStyleTree();
#endif
}
void
RestyleManager::PostRestyleEventCommon(Element* aElement,
nsRestyleHint aRestyleHint,

View File

@ -145,6 +145,12 @@ public:
// itself.
void ProcessPendingRestyles();
// ProcessPendingRestyles calls into one of our RestyleTracker
// objects. It then calls back to these functions at the beginning
// and end of its work.
void BeginProcessingRestyles();
void EndProcessingRestyles();
// 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.
@ -179,11 +185,6 @@ public:
PostRestyleEventInternal(true);
}
void SetInStyleRefresh(bool aInStyleRefresh)
{
mInStyleRefresh = aInStyleRefresh;
}
void FlushOverflowChangedTracker()
{
mOverflowChangedTracker.Flush();

View File

@ -135,11 +135,8 @@ void
RestyleTracker::DoProcessRestyles()
{
PROFILER_LABEL("CSS", "ProcessRestyles");
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
mRestyleManager->PresContext()->FrameConstructor()->BeginUpdate();
mRestyleManager->SetInStyleRefresh(true);
mRestyleManager->BeginProcessingRestyles();
// loop so that we process any restyle events generated by processing
while (mPendingRestyles.Count()) {
@ -239,17 +236,7 @@ RestyleTracker::DoProcessRestyles()
}
}
mRestyleManager->FlushOverflowChangedTracker();
// SetInStyleRefresh(false) now, since the EndUpdate call might
// add more restyles.
mRestyleManager->SetInStyleRefresh(false);
mRestyleManager->PresContext()->FrameConstructor()->EndUpdate();
#ifdef DEBUG
mRestyleManager->PresContext()->PresShell()->VerifyStyleTree();
#endif
mRestyleManager->EndProcessingRestyles();
}
bool