From 82e84361523b736adc26b8810e6704a127cc0b5c Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Fri, 30 Oct 1998 22:05:22 +0000 Subject: [PATCH] Fixed a coordinate system bug with Offset method --- layout/base/src/nsSpaceManager.cpp | 7 ++++++- layout/generic/nsSpaceManager.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/layout/base/src/nsSpaceManager.cpp b/layout/base/src/nsSpaceManager.cpp index 0ef29a7a04f..04edb3927bb 100644 --- a/layout/base/src/nsSpaceManager.cpp +++ b/layout/base/src/nsSpaceManager.cpp @@ -752,8 +752,13 @@ PRBool nsSpaceManager::OffsetRegion(nsIFrame* aFrame, nscoord aDx, nscoord aDy) return PR_FALSE; } + // Compute new rect for the region; note that we have to translate + // from the global coordinate system (frameInfo->rect) to our + // current local coordinate system before adding the rect region + // again (since AddRectRegion operates relative to the current + // translation). nsRect rect(frameInfo->rect); - rect.MoveBy(aDx, aDy); + rect.MoveBy(-mX + aDx, -mY + aDy); // Verify that the offset is within the defined coordinate space if ((rect.x < 0) || (rect.y < 0)) { diff --git a/layout/generic/nsSpaceManager.cpp b/layout/generic/nsSpaceManager.cpp index 0ef29a7a04f..04edb3927bb 100644 --- a/layout/generic/nsSpaceManager.cpp +++ b/layout/generic/nsSpaceManager.cpp @@ -752,8 +752,13 @@ PRBool nsSpaceManager::OffsetRegion(nsIFrame* aFrame, nscoord aDx, nscoord aDy) return PR_FALSE; } + // Compute new rect for the region; note that we have to translate + // from the global coordinate system (frameInfo->rect) to our + // current local coordinate system before adding the rect region + // again (since AddRectRegion operates relative to the current + // translation). nsRect rect(frameInfo->rect); - rect.MoveBy(aDx, aDy); + rect.MoveBy(-mX + aDx, -mY + aDy); // Verify that the offset is within the defined coordinate space if ((rect.x < 0) || (rect.y < 0)) {