Do a sync invalidate of the areas dirtied by the reflow we do before painting,

not an async one.  This will keep us from dropping animation frames quite as
much if events take a long time to process.  Bug 288369, r+sr=roc
This commit is contained in:
bzbarsky%mit.edu 2005-03-31 20:42:30 +00:00
Родитель 5a7ec0baa2
Коммит 482ef684eb
1 изменённых файлов: 17 добавлений и 10 удалений

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

@ -1736,7 +1736,7 @@ nsViewManager::UpdateViewAfterScroll(nsView *aView)
UpdateWidgetArea(RootViewManager()->GetRootView(), nsRegion(damageRect), aView);
Composite();
--mScrollCnt;
--RootViewManager()->mScrollCnt;
}
/**
@ -2008,21 +2008,28 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
// XXXbz do we need to notify other view observers for viewmanagers
// in our tree?
// Make sure to not send WillPaint notifications while scrolling
if (mScrollCnt == 0) {
nsViewManager* rootVM = RootViewManager();
if (rootVM->mScrollCnt == 0) {
nsIViewObserver* observer = GetViewObserver();
if (observer) {
// Do an update view batch, and make sure we don't process
// those invalidates right now. Note that the observer may try
// to reenter this code from inside WillPaint() by trying to do
// a synchronous paint, but since refresh will be disabled it
// won't be able to do the paint. We should really sort out
// the rules on our synch painting api....
// Do an update view batch. Make sure not to do it DEFERRED,
// since that would effectively delay any invalidates that are
// triggered by the WillPaint notification (they'd happen when
// the invalide event fires, which is later than the reflow
// event would fire and could end up being after some timer
// events, leading to frame dropping in DHTML). Note that the
// observer may try to reenter this code from inside
// WillPaint() by trying to do a synchronous paint, but since
// refresh will be disabled it won't be able to do the paint.
// We should really sort out the rules on our synch painting
// api....
BeginUpdateViewBatch();
observer->WillPaint();
EndUpdateViewBatch(NS_VMREFRESH_DEFERRED);
EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
}
}
nsViewManager* rootVM = RootViewManager();
// Make sure to sync up any widget geometry changes we
// have pending before we paint.
if (rootVM->mHasPendingUpdates) {
rootVM->ProcessPendingUpdates(mRootView, PR_FALSE);
}