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
This commit is contained in:
kmcclusk%netscape.com
2000-06-23 00:27:12 +00:00
parent 52bb73928e
commit 6e1642ddc9

View File

@@ -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;