From a995b1ec9f95d6a44efeb18837805a5638b45417 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Sat, 26 Sep 1998 17:29:10 +0000 Subject: [PATCH] Fixed background-image rendering so that when the entire background is not covered by the image the background color can be seen --- layout/base/nsCSSRendering.cpp | 13 +++++++++---- layout/html/style/src/nsCSSRendering.cpp | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 46a75e57e3da..140a975c5d28 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -755,13 +755,11 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, loader->GetSize(imageSize); NS_RELEASE(loader); + PRBool needBackgroundColor = PR_FALSE; #if XXX // XXX enable this code as soon as nsIImage can support it if (image->NeedsBlend()) { - if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { - aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(aBounds); - } + needBackgroundColor = PR_TRUE; } #endif @@ -782,20 +780,27 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, default: xCount = 0; yCount = 0; + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_X: xCount = PRIntn(aDirtyRect.XMost() / tileWidth); yCount = 0; + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_Y: xCount = 0; yCount = PRIntn(aDirtyRect.YMost() / tileHeight); + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_XY: xCount = PRIntn(aDirtyRect.XMost() / tileWidth); yCount = PRIntn(aDirtyRect.YMost() / tileHeight); break; } + if (needBackgroundColor) { + aRenderingContext.SetColor(aColor.mBackgroundColor); + aRenderingContext.FillRect(aBounds); + } // When we have non-zero background position values, we have to // adjust how many tiles we draw (by at most one) and the starting diff --git a/layout/html/style/src/nsCSSRendering.cpp b/layout/html/style/src/nsCSSRendering.cpp index 46a75e57e3da..140a975c5d28 100644 --- a/layout/html/style/src/nsCSSRendering.cpp +++ b/layout/html/style/src/nsCSSRendering.cpp @@ -755,13 +755,11 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, loader->GetSize(imageSize); NS_RELEASE(loader); + PRBool needBackgroundColor = PR_FALSE; #if XXX // XXX enable this code as soon as nsIImage can support it if (image->NeedsBlend()) { - if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { - aRenderingContext.SetColor(aColor.mBackgroundColor); - aRenderingContext.FillRect(aBounds); - } + needBackgroundColor = PR_TRUE; } #endif @@ -782,20 +780,27 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, default: xCount = 0; yCount = 0; + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_X: xCount = PRIntn(aDirtyRect.XMost() / tileWidth); yCount = 0; + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_Y: xCount = 0; yCount = PRIntn(aDirtyRect.YMost() / tileHeight); + needBackgroundColor = PR_TRUE; break; case NS_STYLE_BG_REPEAT_XY: xCount = PRIntn(aDirtyRect.XMost() / tileWidth); yCount = PRIntn(aDirtyRect.YMost() / tileHeight); break; } + if (needBackgroundColor) { + aRenderingContext.SetColor(aColor.mBackgroundColor); + aRenderingContext.FillRect(aBounds); + } // When we have non-zero background position values, we have to // adjust how many tiles we draw (by at most one) and the starting