Bug 625289 patch 2 - Create wrapper function around the only calling pattern of ComputeStyleChangeFor. r=heycam

This commit is contained in:
L. David Baron 2014-08-13 15:39:00 -07:00
Родитель 9b2d455ea1
Коммит 8aa5af235c
2 изменённых файлов: 24 добавлений и 10 удалений

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

@ -905,10 +905,8 @@ RestyleManager::RestyleElement(Element* aElement,
if (aMinHint & nsChangeHint_ReconstructFrame) {
FrameConstructor()->RecreateFramesForContent(aElement, false);
} else if (aPrimaryFrame) {
nsStyleChangeList changeList;
ComputeStyleChangeFor(aPrimaryFrame, &changeList, aMinHint,
aRestyleTracker, aRestyleHint);
ProcessRestyledFrames(changeList);
ComputeAndProcessStyleChange(aPrimaryFrame, aMinHint, aRestyleTracker,
aRestyleHint);
} else if (aRestyleHint & ~eRestyle_LaterSiblings) {
// We're restyling an element with no frame, so we should try to
// make one if its new style says it should have one. But in order
@ -1464,16 +1462,12 @@ RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
// XXX This could be made faster by not rerunning rule matching
// (but note that nsPresShell::SetPreferenceStyleRules currently depends
// on us re-running rule matching here
nsStyleChangeList changeList;
// XXX Does it matter that we're passing aExtraHint to the real root
// frame and not the root node's primary frame? (We could do
// roughly what we do for aRestyleHint above.)
// Note: The restyle tracker we pass in here doesn't matter.
ComputeStyleChangeFor(mPresContext->PresShell()->GetRootFrame(),
&changeList, aExtraHint,
aRestyleTracker, aRestyleHint);
// Process the required changes
ProcessRestyledFrames(changeList);
ComputeAndProcessStyleChange(mPresContext->PresShell()->GetRootFrame(),
aExtraHint, aRestyleTracker, aRestyleHint);
FlushOverflowChangedTracker();
// Tell the style set it's safe to destroy the old rule tree. We
@ -3075,6 +3069,18 @@ GetNextBlockInInlineSibling(FramePropertyTable* aPropTable, nsIFrame* aFrame)
(aPropTable->Get(aFrame, nsIFrame::IBSplitSibling()));
}
void
RestyleManager::ComputeAndProcessStyleChange(nsIFrame* aFrame,
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker,
nsRestyleHint aRestyleHint)
{
nsStyleChangeList changeList;
ComputeStyleChangeFor(aFrame, &changeList, aMinChange,
aRestyleTracker, aRestyleHint);
ProcessRestyledFrames(changeList);
}
void
RestyleManager::ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList* aChangeList,

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

@ -97,6 +97,12 @@ public:
*/
nsresult ReparentStyleContext(nsIFrame* aFrame);
private:
void ComputeAndProcessStyleChange(nsIFrame* aFrame,
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker,
nsRestyleHint aRestyleHint);
/**
* Re-resolve the style contexts for a frame tree, building
* aChangeList based on the resulting style changes, plus aMinChange
@ -109,6 +115,8 @@ public:
RestyleTracker& aRestyleTracker,
nsRestyleHint aRestyleHint);
public:
#ifdef DEBUG
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree