зеркало из https://github.com/mozilla/pjs.git
Invalidate only the newly exposed region when the container frame size changes vertically b=19256; sr=attinasi@netscape.com r=roc+moz@cs.cmu.edu
This commit is contained in:
Родитель
18e4340007
Коммит
f3b73154d2
|
@ -463,7 +463,16 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
|
|||
vm->ResizeView(aView, aCombinedArea->XMost(), aCombinedArea->YMost());
|
||||
|
||||
} else {
|
||||
vm->ResizeView(aView, frameSize.width, frameSize.height);
|
||||
nscoord width, height;
|
||||
aView->GetDimensions(&width, &height);
|
||||
// If only the height has changed then repaint only the newly exposed or
|
||||
// contracted area, otherwise repaint the union of the old and new areas
|
||||
|
||||
// XXX: We currently invalidate the newly exposed areas only when the
|
||||
// container changes height because some frames do not invalidate themselves
|
||||
// properly. see bug 73825.
|
||||
// Once bug 73825 is fixed, we should always pass PR_TRUE instead of frameSize.width == width.
|
||||
vm->ResizeView(aView, frameSize.width, frameSize.height, frameSize.width == width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -463,7 +463,16 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
|
|||
vm->ResizeView(aView, aCombinedArea->XMost(), aCombinedArea->YMost());
|
||||
|
||||
} else {
|
||||
vm->ResizeView(aView, frameSize.width, frameSize.height);
|
||||
nscoord width, height;
|
||||
aView->GetDimensions(&width, &height);
|
||||
// If only the height has changed then repaint only the newly exposed or
|
||||
// contracted area, otherwise repaint the union of the old and new areas
|
||||
|
||||
// XXX: We currently invalidate the newly exposed areas only when the
|
||||
// container changes height because some frames do not invalidate themselves
|
||||
// properly. see bug 73825.
|
||||
// Once bug 73825 is fixed, we should always pass PR_TRUE instead of frameSize.width == width.
|
||||
vm->ResizeView(aView, frameSize.width, frameSize.height, frameSize.width == width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -243,8 +243,11 @@ public:
|
|||
* @param aView view to move
|
||||
* @param width new view width
|
||||
* @param height new view height
|
||||
* @param RepaintExposedAreaOnly if PR_TRUE Repaint only the expanded or contracted region,
|
||||
* if PR_FALSE Repaint the union of the old and new rectangles.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight, PRBool aRepaintExposedAreaOnly = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Set the clipping of a view's children
|
||||
|
|
|
@ -1486,7 +1486,7 @@ static nsresult NewOffscreenContext(nsIDeviceContext* deviceContext, nsDrawingSu
|
|||
|
||||
nsresult nsViewManager::CreateBlendingBuffers(nsIRenderingContext &aRC)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// create a blender, if none exists already.
|
||||
if (nsnull == mBlender) {
|
||||
|
@ -2232,18 +2232,18 @@ NS_IMETHODIMP nsViewManager::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord height)
|
||||
NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord height, PRBool aRepaintExposedAreaOnly)
|
||||
{
|
||||
nscoord oldWidth, oldHeight;
|
||||
aView->GetDimensions(&oldWidth, &oldHeight);
|
||||
if ((width != oldWidth) || (height != oldHeight)) {
|
||||
nscoord x = 0, y = 0;
|
||||
nsIView* parentView = nsnull;
|
||||
aView->GetParent(parentView);
|
||||
if (parentView != nsnull)
|
||||
aView->GetPosition(&x, &y);
|
||||
else
|
||||
parentView = aView;
|
||||
nscoord oldWidth, oldHeight;
|
||||
aView->GetDimensions(&oldWidth, &oldHeight);
|
||||
if ((width != oldWidth) || (height != oldHeight)) {
|
||||
nscoord x = 0, y = 0;
|
||||
nsIView* parentView = nsnull;
|
||||
aView->GetParent(parentView);
|
||||
if (parentView != nsnull)
|
||||
aView->GetPosition(&x, &y);
|
||||
else
|
||||
parentView = aView;
|
||||
|
||||
// resize the view.
|
||||
nsViewVisibility visibility;
|
||||
|
@ -2253,15 +2253,57 @@ NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord h
|
|||
if (visibility == nsViewVisibility_kHide) {
|
||||
aView->SetDimensions(width, height, PR_FALSE);
|
||||
} else {
|
||||
aView->SetDimensions(width, height, PR_TRUE);
|
||||
nscoord maxWidth = (oldWidth < width ? width : oldWidth);
|
||||
nscoord maxHeight = (oldHeight < height ? height : oldHeight);
|
||||
nsRect boundingArea(x, y, maxWidth, maxHeight);
|
||||
UpdateView(parentView, boundingArea, NS_VMREFRESH_NO_SYNC);
|
||||
if (!aRepaintExposedAreaOnly) {
|
||||
//Invalidate the union of the old and new size
|
||||
aView->SetDimensions(width, height, PR_TRUE);
|
||||
nscoord maxWidth = (oldWidth < width ? width : oldWidth);
|
||||
nscoord maxHeight = (oldHeight < height ? height : oldHeight);
|
||||
nsRect boundingArea(x, y, maxWidth, maxHeight);
|
||||
UpdateView(parentView, boundingArea, NS_VMREFRESH_NO_SYNC);
|
||||
} else {
|
||||
// Invalidate only the newly exposed or contracted region
|
||||
nscoord shortWidth, longWidth, shortHeight, longHeight;
|
||||
if (width < oldWidth) {
|
||||
shortWidth = width;
|
||||
longWidth = oldWidth;
|
||||
}
|
||||
else {
|
||||
shortWidth = oldWidth;
|
||||
longWidth = width;
|
||||
}
|
||||
|
||||
if (height < oldHeight) {
|
||||
shortHeight = height;
|
||||
longHeight = oldHeight;
|
||||
}
|
||||
else {
|
||||
shortHeight = oldHeight;
|
||||
longHeight = height;
|
||||
}
|
||||
|
||||
nsRect damageRect;
|
||||
|
||||
//damage the right edge of the parent's view
|
||||
damageRect.x = x + shortWidth;
|
||||
damageRect.y = y;
|
||||
damageRect.width = longWidth - shortWidth;
|
||||
damageRect.height = longHeight;
|
||||
UpdateView(parentView, damageRect, NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
//damage the bottom edge of the parent's view
|
||||
damageRect.x = x;
|
||||
damageRect.y = y + shortHeight;
|
||||
damageRect.width = longWidth;
|
||||
damageRect.height = longHeight - shortHeight;
|
||||
UpdateView(parentView, damageRect, NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
|
||||
aView->SetDimensions(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewChildClip(nsIView *aView, nsRect *aRect)
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
NS_IMETHOD MoveViewTo(nsIView *aView, nscoord aX, nscoord aY);
|
||||
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight, PRBool aRepaintExposedAreaOnly = PR_FALSE);
|
||||
|
||||
NS_IMETHOD SetViewChildClip(nsIView *aView, nsRect *aRect);
|
||||
|
||||
|
|
|
@ -964,7 +964,7 @@ static nsresult NewOffscreenContext(nsIDeviceContext* deviceContext, nsDrawingSu
|
|||
|
||||
nsresult nsViewManager2::CreateBlendingBuffers(nsIRenderingContext &aRC)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// create a blender, if none exists already.
|
||||
if (nsnull == mBlender) {
|
||||
|
@ -1648,18 +1648,18 @@ NS_IMETHODIMP nsViewManager2::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::ResizeView(nsIView *aView, nscoord width, nscoord height)
|
||||
NS_IMETHODIMP nsViewManager2::ResizeView(nsIView *aView, nscoord width, nscoord height, PRBool aRepaintExposedAreaOnly)
|
||||
{
|
||||
nscoord oldWidth, oldHeight;
|
||||
aView->GetDimensions(&oldWidth, &oldHeight);
|
||||
if ((width != oldWidth) || (height != oldHeight)) {
|
||||
nscoord x = 0, y = 0;
|
||||
nsIView* parentView = nsnull;
|
||||
aView->GetParent(parentView);
|
||||
if (parentView != nsnull)
|
||||
aView->GetPosition(&x, &y);
|
||||
else
|
||||
parentView = aView;
|
||||
nscoord oldWidth, oldHeight;
|
||||
aView->GetDimensions(&oldWidth, &oldHeight);
|
||||
if ((width != oldWidth) || (height != oldHeight)) {
|
||||
nscoord x = 0, y = 0;
|
||||
nsIView* parentView = nsnull;
|
||||
aView->GetParent(parentView);
|
||||
if (parentView != nsnull)
|
||||
aView->GetPosition(&x, &y);
|
||||
else
|
||||
parentView = aView;
|
||||
|
||||
// resize the view.
|
||||
nsViewVisibility visibility;
|
||||
|
@ -1669,15 +1669,58 @@ NS_IMETHODIMP nsViewManager2::ResizeView(nsIView *aView, nscoord width, nscoord
|
|||
if (visibility == nsViewVisibility_kHide) {
|
||||
aView->SetDimensions(width, height, PR_FALSE);
|
||||
} else {
|
||||
aView->SetDimensions(width, height, PR_TRUE);
|
||||
nscoord maxWidth = (oldWidth < width ? width : oldWidth);
|
||||
nscoord maxHeight = (oldHeight < height ? height : oldHeight);
|
||||
nsRect boundingArea(x, y, maxWidth, maxHeight);
|
||||
UpdateView(parentView, boundingArea, NS_VMREFRESH_NO_SYNC);
|
||||
if (!aRepaintExposedAreaOnly) {
|
||||
//Invalidate the union of the old and new size
|
||||
aView->SetDimensions(width, height, PR_TRUE);
|
||||
nscoord maxWidth = (oldWidth < width ? width : oldWidth);
|
||||
nscoord maxHeight = (oldHeight < height ? height : oldHeight);
|
||||
nsRect boundingArea(x, y, maxWidth, maxHeight);
|
||||
UpdateView(parentView, boundingArea, NS_VMREFRESH_NO_SYNC);
|
||||
} else {
|
||||
// Invalidate only the newly exposed or contracted region
|
||||
nscoord shortWidth, longWidth, shortHeight, longHeight;
|
||||
if (width < oldWidth) {
|
||||
shortWidth = width;
|
||||
longWidth = oldWidth;
|
||||
}
|
||||
else {
|
||||
shortWidth = oldWidth;
|
||||
longWidth = width;
|
||||
}
|
||||
|
||||
if (height < oldHeight) {
|
||||
shortHeight = height;
|
||||
longHeight = oldHeight;
|
||||
}
|
||||
else {
|
||||
shortHeight = oldHeight;
|
||||
longHeight = height;
|
||||
}
|
||||
|
||||
nsRect damageRect;
|
||||
|
||||
//damage the right edge of the parent's view
|
||||
damageRect.x = x + shortWidth;
|
||||
damageRect.y = y;
|
||||
damageRect.width = longWidth - shortWidth;
|
||||
damageRect.height = longHeight;
|
||||
UpdateView(parentView, damageRect, NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
|
||||
//damage the bottom edge of the parent's view
|
||||
damageRect.x = x;
|
||||
damageRect.y = y + shortHeight;
|
||||
damageRect.width = longWidth;
|
||||
damageRect.height = longHeight - shortHeight;
|
||||
UpdateView(parentView, damageRect, NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
|
||||
aView->SetDimensions(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::SetViewChildClip(nsIView *aView, nsRect *aRect)
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
|
||||
NS_IMETHOD MoveViewTo(nsIView *aView, nscoord aX, nscoord aY);
|
||||
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD ResizeView(nsIView *aView, nscoord aWidth, nscoord aHeight, PRBool aRepaintExposedAreaOnly = PR_FALSE);
|
||||
|
||||
NS_IMETHOD SetViewChildClip(nsIView *aView, nsRect *aRect);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче