Wrap a view update batch around all restyle processing and switch

ApplyRenderingChangeToTree to use a NO_SYNC view batch, since we now flush
reflows before painting.  Bug 288365, r+sr=roc
This commit is contained in:
bzbarsky%mit.edu 2005-04-01 18:14:18 +00:00
parent 7a84ac3af7
commit 821ec9f30c
2 changed files with 14 additions and 4 deletions

View File

@ -10064,10 +10064,7 @@ ApplyRenderingChangeToTree(nsPresContext* aPresContext,
gInApplyRenderingChangeToTree = PR_FALSE;
#endif
// Use NS_VMREFRESH_DEFERRED here so that any reflows that may be coming from
// the same restyle as called this function will get a chance to be processed
// before we do the widget invalidates from DoApplyRenderingChangeToTree.
viewManager->EndUpdateViewBatch(NS_VMREFRESH_DEFERRED);
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
}
nsresult
@ -10462,7 +10459,11 @@ nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
if (namespaceID == kNameSpaceID_XUL &&
(tag == nsXULAtoms::menupopup || tag == nsXULAtoms::popup ||
tag == nsXULAtoms::tooltip)) {
nsIViewManager* viewManager = mPresShell->GetViewManager();
viewManager->BeginUpdateViewBatch();
ProcessOneRestyle(aContent, rshint, hint);
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
return result;
}
}
@ -13673,6 +13674,12 @@ nsCSSFrameConstructor::ProcessPendingRestyles()
// already processing, sending us into an infinite loop.
mPendingRestyles.Clear();
nsIViewManager* viewManager = mPresShell->GetViewManager();
// Put a view update batch around the whole thing so we only process
// view updates at the very end. Note that this serves as the view
// update batch we need around our ProcessRestyledFrames calls too.
viewManager->BeginUpdateViewBatch();
for (nsCSSFrameConstructor::RestyleEnumerateData* currentRestyle =
restylesToProcess;
currentRestyle != lastRestyle;
@ -13681,6 +13688,7 @@ nsCSSFrameConstructor::ProcessPendingRestyles()
currentRestyle->mRestyleHint,
currentRestyle->mChangeHint);
}
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
delete [] restylesToProcess;
}

View File

@ -132,6 +132,8 @@ public:
void WillDestroyFrameTree();
// Note: It's the caller's responsibility to make sure to wrap a
// ProcessRestyledFrames call in a view update batch.
nsresult ProcessRestyledFrames(nsStyleChangeList& aRestyleArray);
void ProcessOneRestyle(nsIContent* aContent, nsReStyleHint aRestyleHint,