Optimize MoveViewTo() to only move the view if aX != oldX and aY != oldY. This cuts out about 10% on large web pages that slam the status bar, because boxes seem to want to reposition the widget at the same place over and over. r=pavlov

This commit is contained in:
waterson%netscape.com 2000-02-01 01:14:49 +00:00
Родитель b35887b304
Коммит 92a8f5fb23
1 изменённых файлов: 5 добавлений и 1 удалений

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

@ -1892,11 +1892,15 @@ NS_IMETHODIMP nsViewManager::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY)
{
nscoord oldX, oldY;
aView->GetPosition(&oldX, &oldY);
aView->SetPosition(aX, aY);
// only do damage control if the view is visible
if ((aX != oldX) || (aY != oldY)) {
// XXXwaterson: there were dire warnings from plitkins about some
// rare cases not working when you only move when position has
// changed. If they re-occur, move this back outside.
aView->SetPosition(aX, aY);
nsViewVisibility visibility;
aView->GetVisibility(visibility);
if (visibility != nsViewVisibility_kHide) {