From e6b6217eb3ccb9e0dac276dea3a0d6fa0741e415 Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Fri, 23 Mar 2001 14:36:28 +0000 Subject: [PATCH] Added 1 pixel to the invalidate rect to compensate for twips to pixel rounding error. bug=63951; sr=karnaze@netscape.com; r=attinasi@netscape.com --- layout/generic/nsTextFrame.cpp | 11 ++++++++++- layout/html/base/src/nsTextFrame.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index eac9be77dc84..a34e3cbd126e 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4630,7 +4630,16 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // has actually changed... /*if (eReflowReason_Incremental == aReflowState.reason || eReflowReason_Dirty == aReflowState.reason) {*/ - maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width); + // XXX See bug 71523 We should really adjust the frames x coordinate to + // a pixel boundary to solve this. + // For now we add 1 pixel to the width of the invalidated rect. + // This fixes cases where the twips to pixel roundoff causes the invalidated + // rect's width to be one pixel short. + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nscoord onePixel = NSIntPixelsToTwips(1, p2t); + + maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width) + onePixel; maxFrameHeight = PR_MAX(maxFrameHeight, mRect.height); Invalidate(aPresContext, nsRect(0,0,maxFrameWidth,maxFrameHeight)); /*}*/ diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index eac9be77dc84..a34e3cbd126e 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -4630,7 +4630,16 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // has actually changed... /*if (eReflowReason_Incremental == aReflowState.reason || eReflowReason_Dirty == aReflowState.reason) {*/ - maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width); + // XXX See bug 71523 We should really adjust the frames x coordinate to + // a pixel boundary to solve this. + // For now we add 1 pixel to the width of the invalidated rect. + // This fixes cases where the twips to pixel roundoff causes the invalidated + // rect's width to be one pixel short. + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nscoord onePixel = NSIntPixelsToTwips(1, p2t); + + maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width) + onePixel; maxFrameHeight = PR_MAX(maxFrameHeight, mRect.height); Invalidate(aPresContext, nsRect(0,0,maxFrameWidth,maxFrameHeight)); /*}*/