From 6e1642ddc9ba6a7f67d621e4688fd9ca001f55de Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Fri, 23 Jun 2000 00:27:12 +0000 Subject: [PATCH] Nested divs with overflow now correctly position their child divs which have negative translations (patch from Robert O'Callahan) b=41153 r=attinasi@netscape.com tested on WIN32, Linux git-svn-id: svn://10.0.0.236/trunk@73001 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/view/src/nsViewManager2.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mozilla/view/src/nsViewManager2.cpp b/mozilla/view/src/nsViewManager2.cpp index 511ec5f2498..52f4abb4bbc 100755 --- a/mozilla/view/src/nsViewManager2.cpp +++ b/mozilla/view/src/nsViewManager2.cpp @@ -61,10 +61,11 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); // display list elements struct DisplayListElement2 { - nsIView* mView; - nsRect mBounds; - nsRect mDirty; - PRUint32 mFlags; + nsIView* mView; + nsRect mBounds; + nscoord mAbsX, mAbsY; + nsRect mDirty; + PRUint32 mFlags; }; inline nscoord max(nscoord x, nscoord y) { return (x > y ? x : y); } @@ -804,7 +805,7 @@ void nsViewManager2::RenderDisplayListElement(DisplayListElement2* element, nsIR if (!isTranslucent) { aRC.PushState(); - nscoord x = element->mBounds.x, y = element->mBounds.y; + nscoord x = element->mAbsX, y = element->mAbsY; aRC.Translate(x, y); nsRect drect(element->mDirty.x - x, element->mDirty.y - y, @@ -823,11 +824,12 @@ void nsViewManager2::RenderDisplayListElement(DisplayListElement2* element, nsIR // compute the origin of the view, relative to the offscreen buffer, which has the // same dimensions as mTranslucentArea. - nscoord viewX = element->mBounds.x - mTranslucentArea.x, viewY = element->mBounds.y - mTranslucentArea.y; + nscoord x = element->mAbsX, y = element->mAbsY; + nscoord viewX = x - mTranslucentArea.x, viewY = y - mTranslucentArea.y; nsRect damageRect(element->mDirty); damageRect.IntersectRect(damageRect, mTranslucentArea); - damageRect.x -= element->mBounds.x, damageRect.y -= element->mBounds.y; + damageRect.x -= x, damageRect.y -= y; if (element->mFlags & VIEW_TRANSLUCENT) { nsIView* view = element->mView; @@ -2478,6 +2480,8 @@ PRBool nsViewManager2::AddToDisplayList(PRInt32 *aIndex, nsIView *aView, nsRect aView->GetClippedRect(clipRect, clipped, empty); clipRect.x += aAbsX; clipRect.y += aAbsY; + element->mAbsX = aClipRect.x; + element->mAbsY = aClipRect.y; element->mView = aView; element->mDirty = aDirtyRect;