Bug 629823 - Use the right view manager for the parent view. r=tnikkel a=roc

This commit is contained in:
Mats Palmgren 2011-02-10 23:38:37 +01:00
parent 0d6b76ad28
commit 125805c748

View File

@ -1327,6 +1327,8 @@ void nsViewManager::InvalidateHorizontalBandDifference(nsView *aView, const nsRe
void nsViewManager::InvalidateRectDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut,
PRUint32 aUpdateFlags) {
NS_ASSERTION(aView->GetViewManager() == this,
"InvalidateRectDifference called on view we don't own");
if (aRect.y < aCutOut.y) {
InvalidateHorizontalBandDifference(aView, aRect, aCutOut, aUpdateFlags, aRect.y, aCutOut.y, PR_FALSE);
}
@ -1346,25 +1348,27 @@ NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, const nsRect &aRect, PRB
view->GetDimensions(oldDimensions);
if (!oldDimensions.IsExactEqual(aRect)) {
nsView* parentView = view->GetParent();
if (parentView == nsnull)
parentView = view;
// resize the view.
// Prevent Invalidation of hidden views
if (view->GetVisibility() == nsViewVisibility_kHide) {
view->SetDimensions(aRect, PR_FALSE);
} else {
nsView* parentView = view->GetParent();
if (!parentView) {
parentView = view;
}
nsRect oldBounds = view->GetBoundsInParentUnits();
view->SetDimensions(aRect, PR_TRUE);
nsViewManager* parentVM = parentView->GetViewManager();
if (!aRepaintExposedAreaOnly) {
//Invalidate the union of the old and new size
UpdateView(view, aRect, NS_VMREFRESH_NO_SYNC);
UpdateView(parentView, oldBounds, NS_VMREFRESH_NO_SYNC);
parentVM->UpdateView(parentView, oldBounds, NS_VMREFRESH_NO_SYNC);
} else {
InvalidateRectDifference(view, aRect, oldDimensions, NS_VMREFRESH_NO_SYNC);
nsRect newBounds = view->GetBoundsInParentUnits();
InvalidateRectDifference(parentView, oldBounds, newBounds, NS_VMREFRESH_NO_SYNC);
parentVM->InvalidateRectDifference(parentView, oldBounds, newBounds,
NS_VMREFRESH_NO_SYNC);
}
}
}