Bug 343430. Reduce the area we scroll on Windows to reduce flicker by excluding areas that shouldn't be moving. On Linux, since we can't control the area we scroll, just disable accelerated scrolling in that case and repaint everything. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2007-05-27 20:17:20 -07:00
Родитель 7a41f3f408
Коммит 182c294250
3 изменённых файлов: 31 добавлений и 3 удалений

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

@ -578,9 +578,33 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsPoin
// consistent with the view hierarchy.
mViewManager->UpdateView(this, 0);
} else { // if we can blit and have a scrollwidget then scroll.
nsRect* toScrollPtr = nsnull;
#ifdef XP_WIN
nsRect toScroll;
if (!updateRegion.IsEmpty()) {
nsRegion regionToScroll;
regionToScroll.Sub(nsRect(nsPoint(0,0), GetBounds().Size()),
updateRegion);
nsRegionRectIterator iter(regionToScroll);
nsRect biggestRect(0,0,0,0);
const nsRect* r;
for (r = iter.Next(); r; r = iter.Next()) {
if (r->width*r->height > biggestRect.width*biggestRect.height) {
biggestRect = *r;
}
}
regionToScroll.Sub(regionToScroll, biggestRect);
updateRegion.Or(updateRegion, regionToScroll);
toScrollPtr = &toScroll;
toScroll = biggestRect;
toScroll.ScaleRoundOut(1.0/aP2A);
}
#endif
// Scroll the contents of the widget by the specified amount, and scroll
// the child widgets
scrollWidget->Scroll(aPixDelta.x, aPixDelta.y, nsnull);
scrollWidget->Scroll(aPixDelta.x, aPixDelta.y, toScrollPtr);
mViewManager->UpdateViewAfterScroll(this, updateRegion);
}
}

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

@ -1628,8 +1628,12 @@ PRBool nsViewManager::CanScrollWithBitBlt(nsView* aView, nsPoint aDelta,
aUpdateRegion->MoveBy(-displayOffset);
#ifdef MOZ_WIDGET_GTK2
return aUpdateRegion->IsEmpty();
#else
return PR_TRUE;
}
#endif
}
NS_IMETHODIMP nsViewManager::SetViewCheckChildEvents(nsIView *aView, PRBool aEnable)
{

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

@ -3278,7 +3278,7 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
trect.bottom = aClipRect->YMost();
}
::ScrollWindowEx(mWnd, aDx, aDy, (nsnull != aClipRect) ? &trect : NULL, NULL,
::ScrollWindowEx(mWnd, aDx, aDy, NULL, (nsnull != aClipRect) ? &trect : NULL,
NULL, NULL, SW_INVALIDATE | SW_SCROLLCHILDREN);
::UpdateWindow(mWnd);
return NS_OK;