Bug 804970, patch 4: Refactor part of RebuildAllStyleData into a helper function (slightly reordering it), so that we can share that part. r=bzbarsky

This commit is contained in:
L. David Baron 2012-10-26 19:04:20 +02:00
Родитель 0fac8d37bf
Коммит ae03fa3b5b
2 изменённых файлов: 24 добавлений и 10 удалений

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

@ -12101,6 +12101,24 @@ nsCSSFrameConstructor::RebuildAllStyleData(nsChangeHint aExtraHint)
nsAutoScriptBlocker scriptBlocker;
nsPresContext *presContext = mPresShell->GetPresContext();
presContext->SetProcessingRestyles(true);
DoRebuildAllStyleData(mPendingRestyles, aExtraHint);
presContext->SetProcessingRestyles(false);
// Make sure that we process any pending animation restyles from the
// above style change. Note that we can *almost* implement the above
// by just posting a style change -- except we really need to restyle
// the root frame rather than the root element's primary frame.
ProcessPendingRestyles();
}
void
nsCSSFrameConstructor::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
nsChangeHint aExtraHint)
{
// Tell the style set to get the old rule tree out of the way
// so we can recalculate while maintaining rule tree immutability
nsresult rv = mPresShell->StyleSet()->BeginReconstruct();
@ -12108,8 +12126,6 @@ nsCSSFrameConstructor::RebuildAllStyleData(nsChangeHint aExtraHint)
return;
}
nsPresContext *presContext = mPresShell->GetPresContext();
presContext->SetProcessingRestyles(true);
// Recalculate all of the style contexts for the document
// Note that we can ignore the return value of ComputeStyleChangeFor
// because we never need to reframe the root frame
@ -12122,16 +12138,9 @@ nsCSSFrameConstructor::RebuildAllStyleData(nsChangeHint aExtraHint)
// Note: The restyle tracker we pass in here doesn't matter.
ComputeStyleChangeFor(mPresShell->GetRootFrame(),
&changeList, aExtraHint,
mPendingRestyles, true);
aRestyleTracker, true);
// Process the required changes
ProcessRestyledFrames(changeList);
presContext->SetProcessingRestyles(false);
// Make sure that we process any pending animation restyles from the
// above style change. Note that we can *almost* implement the above
// by just posting a style change -- except we really need to restyle
// the root frame rather than the root element's primary frame.
ProcessPendingRestyles();
// Tell the style set it's safe to destroy the old rule tree. We
// must do this after the ProcessRestyledFrames call in case the

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

@ -276,6 +276,11 @@ public:
// must not contain nsChangeHint_ReconstructFrame) to the root frame.
void RebuildAllStyleData(nsChangeHint aExtraHint);
// Helper that does part of the work of RebuildAllStyleData, shared by
// RestyleElement for 'rem' handling.
void DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
nsChangeHint aExtraHint);
// See PostRestyleEventCommon below.
void PostRestyleEvent(Element* aElement,
nsRestyleHint aRestyleHint,