зеркало из https://github.com/mozilla/gecko-dev.git
Backout changeset e794d5f88e0c (bug 539356) because of performance and correctness regressions
This commit is contained in:
Родитель
8b3c1f653a
Коммит
d61b4e8438
|
@ -415,8 +415,7 @@ nsRefreshDriver::Notify(nsITimer *aTimer)
|
|||
printf("Starting ProcessPendingUpdates\n");
|
||||
#endif
|
||||
mViewManagerFlushIsPending = false;
|
||||
bool skippedFlush = mPresContext->GetPresShell()->GetViewManager()->ProcessPendingUpdates();
|
||||
mViewManagerFlushIsPending |= skippedFlush;
|
||||
mPresContext->GetPresShell()->GetViewManager()->ProcessPendingUpdates();
|
||||
#ifdef DEBUG_INVALIDATIONS
|
||||
printf("Ending ProcessPendingUpdates\n");
|
||||
#endif
|
||||
|
|
|
@ -296,11 +296,8 @@ public:
|
|||
/**
|
||||
* Flush the accumulated dirty region to the widget and update widget
|
||||
* geometry.
|
||||
*
|
||||
* @param True if a paint was skipped due to throttling and this
|
||||
* should be called again after a delay.
|
||||
*/
|
||||
virtual bool ProcessPendingUpdates()=0;
|
||||
virtual void ProcessPendingUpdates()=0;
|
||||
|
||||
/**
|
||||
* Just update widget geometry without flushing the dirty region
|
||||
|
|
|
@ -176,8 +176,6 @@ nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
|
|||
mDirtyRegion = nsnull;
|
||||
mDeletionObserver = nsnull;
|
||||
mWidgetIsTopLevel = false;
|
||||
mPendingRefresh = false;
|
||||
mSkippedPaints = 0;
|
||||
}
|
||||
|
||||
void nsView::DropMouseGrabbing()
|
||||
|
|
|
@ -162,13 +162,6 @@ public:
|
|||
nsPoint GetOffsetTo(const nsView* aOther, const PRInt32 aAPD) const;
|
||||
nsIWidget* GetNearestWidget(nsPoint* aOffset, const PRInt32 aAPD) const;
|
||||
|
||||
void SetPendingRefresh(bool aPending) { mPendingRefresh = aPending; }
|
||||
bool PendingRefresh() { return mPendingRefresh; }
|
||||
|
||||
void SkippedPaint() { mSkippedPaints++; }
|
||||
void ClearSkippedPaints() { mSkippedPaints = 0; }
|
||||
PRUint32 SkippedPaints() { return mSkippedPaints; }
|
||||
|
||||
protected:
|
||||
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
|
||||
// call this method if we have no widget.
|
||||
|
@ -176,15 +169,6 @@ protected:
|
|||
|
||||
nsRegion* mDirtyRegion;
|
||||
|
||||
// True if the view has invalidate scheduled with the widget
|
||||
// and is waiting for nsViewManager::Refresh to be called.
|
||||
bool mPendingRefresh;
|
||||
|
||||
// True if a paint event was skipped while mPendingRefresh was
|
||||
// true, and a new one should be scheduled once we get
|
||||
// nsViewManager::Refresh called.
|
||||
PRUint32 mSkippedPaints;
|
||||
|
||||
private:
|
||||
void InitializeWindow(bool aEnableDragDrop, bool aResetVisibility);
|
||||
};
|
||||
|
|
|
@ -301,11 +301,6 @@ void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion,
|
|||
bool aWillSendDidPaint)
|
||||
{
|
||||
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
|
||||
aView->SetPendingRefresh(false);
|
||||
if (aView->SkippedPaints()) {
|
||||
RootViewManager()->GetPresShell()->ScheduleViewManagerFlush(true);
|
||||
aView->ClearSkippedPaints();
|
||||
}
|
||||
|
||||
// damageRegion is the damaged area, in twips, relative to the view origin
|
||||
nsRegion damageRegion = aRegion.ToAppUnits(AppUnitsPerDevPixel());
|
||||
|
@ -357,14 +352,14 @@ void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion,
|
|||
}
|
||||
}
|
||||
|
||||
bool nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
||||
void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
||||
bool aFlushDirtyRegion)
|
||||
{
|
||||
NS_ASSERTION(IsRootVM(), "Updates will be missed");
|
||||
|
||||
// Protect against a null-view.
|
||||
if (!aView) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (aView->HasWidget()) {
|
||||
|
@ -372,10 +367,9 @@ bool nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
|||
}
|
||||
|
||||
// process pending updates in child view.
|
||||
bool skipped = false;
|
||||
for (nsView* childView = aView->GetFirstChild(); childView;
|
||||
childView = childView->GetNextSibling()) {
|
||||
skipped |= ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
|
||||
ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
|
||||
}
|
||||
|
||||
// Push out updates after we've processed the children; ensures that
|
||||
|
@ -383,14 +377,7 @@ bool nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
|||
if (aFlushDirtyRegion) {
|
||||
nsIWidget *widget = aView->GetWidget();
|
||||
if (widget && widget->NeedsPaint()) {
|
||||
if (aView->PendingRefresh() && aView->SkippedPaints() < 5) {
|
||||
aView->SkippedPaint();
|
||||
skipped = true;
|
||||
} else {
|
||||
aView->ClearSkippedPaints();
|
||||
aView->SetPendingRefresh(false);
|
||||
widget->SetNeedsPaint(false);
|
||||
SetPainting(true);
|
||||
#ifdef DEBUG_INVALIDATIONS
|
||||
printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
|
||||
#endif
|
||||
|
@ -399,12 +386,9 @@ bool nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
|||
#ifdef DEBUG_INVALIDATIONS
|
||||
printf("---- PAINT END ----\n");
|
||||
#endif
|
||||
SetPainting(false);
|
||||
}
|
||||
}
|
||||
FlushDirtyRegionToWidget(aView);
|
||||
}
|
||||
return skipped;
|
||||
}
|
||||
|
||||
void nsViewManager::FlushDirtyRegionToWidget(nsView* aView)
|
||||
|
@ -447,7 +431,7 @@ nsViewManager::PostPendingUpdate()
|
|||
{
|
||||
nsViewManager* rootVM = RootViewManager();
|
||||
rootVM->mHasPendingWidgetGeometryChanges = true;
|
||||
if (rootVM->mPresShell && !rootVM->IsPainting()) {
|
||||
if (rootVM->mPresShell) {
|
||||
rootVM->mPresShell->ScheduleViewManagerFlush(nsIFrame::PAINT_COMPOSITE_ONLY);
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +514,6 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
|
|||
leftOver.Sub(aDamagedRegion, children);
|
||||
|
||||
if (!leftOver.IsEmpty()) {
|
||||
aWidgetView->SetPendingRefresh(true);
|
||||
const nsRect* r;
|
||||
for (nsRegionRectIterator iter(leftOver); (r = iter.Next());) {
|
||||
nsIntRect bounds = ViewToWidget(aWidgetView, *r);
|
||||
|
@ -1317,15 +1300,16 @@ nsViewManager::IsPainting(bool& aIsPainting)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
nsViewManager::ProcessPendingUpdates()
|
||||
{
|
||||
if (!IsRootVM()) {
|
||||
return RootViewManager()->ProcessPendingUpdates();
|
||||
RootViewManager()->ProcessPendingUpdates();
|
||||
return;
|
||||
}
|
||||
|
||||
mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
|
||||
return ProcessPendingUpdatesForView(mRootView, true);
|
||||
ProcessPendingUpdatesForView(mRootView, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
/* Update the cached RootViewManager pointer on this view manager. */
|
||||
void InvalidateHierarchy();
|
||||
|
||||
virtual bool ProcessPendingUpdates();
|
||||
virtual void ProcessPendingUpdates();
|
||||
virtual void UpdateWidgetGeometry();
|
||||
|
||||
protected:
|
||||
|
@ -114,10 +114,7 @@ protected:
|
|||
private:
|
||||
|
||||
void FlushPendingInvalidates();
|
||||
/* Returns true if we skipped painting a view and we should try
|
||||
* again later.
|
||||
*/
|
||||
bool ProcessPendingUpdatesForView(nsView *aView,
|
||||
void ProcessPendingUpdatesForView(nsView *aView,
|
||||
bool aFlushDirtyRegion = true);
|
||||
void FlushDirtyRegionToWidget(nsView* aView);
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче