From 7232d0c359630aece37307ee34f6a9b66e314188 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Wed, 22 Jul 1998 05:02:07 +0000 Subject: [PATCH] Changed PaintBorder() to use the (x,y) that's passed in --- layout/base/nsCSSRendering.cpp | 13 ++++++------- layout/base/nsCSSRendering.h | 3 +++ layout/css/layout/src/nsCSSBlockFrame.cpp | 7 ++++--- layout/generic/nsHTMLContainerFrame.cpp | 7 ++++--- layout/generic/nsLeafFrame.cpp | 7 ++++--- layout/html/base/src/nsHTMLContainerFrame.cpp | 7 ++++--- layout/html/base/src/nsLeafFrame.cpp | 7 ++++--- layout/html/style/src/nsCSSRendering.cpp | 13 ++++++------- layout/html/style/src/nsCSSRendering.h | 3 +++ layout/html/table/src/nsTableCellFrame.cpp | 6 +++--- layout/html/table/src/nsTableFrame.cpp | 6 +++--- layout/html/table/src/nsTableRowFrame.cpp | 3 ++- layout/tables/nsTableCellFrame.cpp | 6 +++--- layout/tables/nsTableFrame.cpp | 6 +++--- layout/tables/nsTableRowFrame.cpp | 3 ++- 15 files changed, 54 insertions(+), 43 deletions(-) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 8e58d7cf841..d5303710047 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -857,7 +857,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, // Redraw will happen later if (!transparentBG) { aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } return; } @@ -869,7 +869,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, if (image->NeedsBlend()) { if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } } #endif @@ -902,8 +902,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, } // Tile the background - nscoord xpos = 0, ypos = 0; - nscoord xpos0 = 0; + nscoord xpos = aBounds.x, ypos = aBounds.y; #if XXX // XXX support offset positioning PRIntn xPos = aColor.mBackgroundXPosition; @@ -913,7 +912,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect); PRIntn x, y; for (y = 0; y <= ycount; ++y, ypos += tileHeight) { - for (x = 0, xpos = xpos0; x <= xcount; ++x, xpos += tileWidth) { + for (x = 0; x <= xcount; ++x, xpos += tileWidth) { aRenderingContext.DrawImage(image, xpos, ypos); } } @@ -921,10 +920,10 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, } else { if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { // XXX This step can be avoided if we have an image and it doesn't - // have any transparent pixels and the image is tiled in both + // have any transparent pixels, and the image is tiled in both // the x and the y aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } } } diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index 811e0214e1a..a5fe5c45e13 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -43,6 +43,9 @@ public: /** * Render the background for an element using css rendering rules * for backgrounds. + * + * Both aDirtyRect and aBounds are in the local coordinate space + * of aForFrame */ static void PaintBackground(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/css/layout/src/nsCSSBlockFrame.cpp b/layout/css/layout/src/nsCSSBlockFrame.cpp index 0f98e0dadf9..18e61154875 100644 --- a/layout/css/layout/src/nsCSSBlockFrame.cpp +++ b/layout/css/layout/src/nsCSSBlockFrame.cpp @@ -3900,11 +3900,12 @@ nsCSSBlockFrame::Paint(nsIPresContext& aPresContext, (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *color); + aDirtyRect, rect, *color); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *spacing, skipSides); + aDirtyRect, rect, *spacing, skipSides); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect); diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp index 115cca322b2..0df3418df9b 100644 --- a/layout/generic/nsHTMLContainerFrame.cpp +++ b/layout/generic/nsHTMLContainerFrame.cpp @@ -66,11 +66,12 @@ NS_METHOD nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext, (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *color); + aDirtyRect, rect, *color); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *spacing, skipSides); + aDirtyRect, rect, *spacing, skipSides); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect); diff --git a/layout/generic/nsLeafFrame.cpp b/layout/generic/nsLeafFrame.cpp index fc152bf9c12..0048cef525e 100644 --- a/layout/generic/nsLeafFrame.cpp +++ b/layout/generic/nsLeafFrame.cpp @@ -42,11 +42,12 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext, (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *mySpacing, 0); + aDirtyRect, rect, *mySpacing, 0); } return NS_OK; } diff --git a/layout/html/base/src/nsHTMLContainerFrame.cpp b/layout/html/base/src/nsHTMLContainerFrame.cpp index 115cca322b2..0df3418df9b 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -66,11 +66,12 @@ NS_METHOD nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext, (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *color); + aDirtyRect, rect, *color); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *spacing, skipSides); + aDirtyRect, rect, *spacing, skipSides); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect); diff --git a/layout/html/base/src/nsLeafFrame.cpp b/layout/html/base/src/nsLeafFrame.cpp index fc152bf9c12..0048cef525e 100644 --- a/layout/html/base/src/nsLeafFrame.cpp +++ b/layout/html/base/src/nsLeafFrame.cpp @@ -42,11 +42,12 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext, (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *mySpacing, 0); + aDirtyRect, rect, *mySpacing, 0); } return NS_OK; } diff --git a/layout/html/style/src/nsCSSRendering.cpp b/layout/html/style/src/nsCSSRendering.cpp index 8e58d7cf841..d5303710047 100644 --- a/layout/html/style/src/nsCSSRendering.cpp +++ b/layout/html/style/src/nsCSSRendering.cpp @@ -857,7 +857,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, // Redraw will happen later if (!transparentBG) { aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } return; } @@ -869,7 +869,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, if (image->NeedsBlend()) { if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } } #endif @@ -902,8 +902,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, } // Tile the background - nscoord xpos = 0, ypos = 0; - nscoord xpos0 = 0; + nscoord xpos = aBounds.x, ypos = aBounds.y; #if XXX // XXX support offset positioning PRIntn xPos = aColor.mBackgroundXPosition; @@ -913,7 +912,7 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect); PRIntn x, y; for (y = 0; y <= ycount; ++y, ypos += tileHeight) { - for (x = 0, xpos = xpos0; x <= xcount; ++x, xpos += tileWidth) { + for (x = 0; x <= xcount; ++x, xpos += tileWidth) { aRenderingContext.DrawImage(image, xpos, ypos); } } @@ -921,10 +920,10 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, } else { if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { // XXX This step can be avoided if we have an image and it doesn't - // have any transparent pixels and the image is tiled in both + // have any transparent pixels, and the image is tiled in both // the x and the y aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(0, 0, aBounds.width, aBounds.height); + aRenderingContext.FillRect(aBounds); } } } diff --git a/layout/html/style/src/nsCSSRendering.h b/layout/html/style/src/nsCSSRendering.h index 811e0214e1a..a5fe5c45e13 100644 --- a/layout/html/style/src/nsCSSRendering.h +++ b/layout/html/style/src/nsCSSRendering.h @@ -43,6 +43,9 @@ public: /** * Render the background for an element using css rendering rules * for backgrounds. + * + * Both aDirtyRect and aBounds are in the local coordinate space + * of aForFrame */ static void PaintBackground(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 3468f5aaec5..58a247b7f1f 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -87,12 +87,12 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, NS_ASSERTION(nsnull!=myColor, "bad style color"); NS_ASSERTION(nsnull!=mySpacing, "bad style spacing"); + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *mySpacing, 0); + aDirtyRect, rect, *mySpacing, 0); } // for debug... diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index f98989c9ff1..ef8652c4a0d 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -1103,11 +1103,11 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, const nsStyleColor* color = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *color); + aDirtyRect, rect, *color); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *spacing, 0); + aDirtyRect, rect, *spacing, 0); } // for debug... diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index 4f8a2492eba..c465e027618 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -155,8 +155,9 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext, const nsStyleColor* myColor = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); if (nsnull != myColor) { + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect); diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 3468f5aaec5..58a247b7f1f 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -87,12 +87,12 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, NS_ASSERTION(nsnull!=myColor, "bad style color"); NS_ASSERTION(nsnull!=mySpacing, "bad style spacing"); + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *mySpacing, 0); + aDirtyRect, rect, *mySpacing, 0); } // for debug... diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index f98989c9ff1..ef8652c4a0d 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1103,11 +1103,11 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, const nsStyleColor* color = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *color); + aDirtyRect, rect, *color); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, nsRect(0, 0, mRect.width, mRect.height), - *spacing, 0); + aDirtyRect, rect, *spacing, 0); } // for debug... diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 4f8a2492eba..c465e027618 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -155,8 +155,9 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext, const nsStyleColor* myColor = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); if (nsnull != myColor) { + nsRect rect(0, 0, mRect.width, mRect.height); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, mRect, *myColor); + aDirtyRect, rect, *myColor); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect);