From 590cae8cb164e678c28dea78a23993ee3f2c37ff Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Thu, 23 Jul 1998 18:05:03 +0000 Subject: [PATCH] factored backgound finding code to nsStyleUtil git-svn-id: svn://10.0.0.236/trunk@6266 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/table/src/nsTableCellFrame.cpp | 24 ++++--------------- mozilla/layout/tables/nsTableCellFrame.cpp | 24 ++++--------------- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 58a247b7f1f..fb618c9368d 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -31,6 +31,7 @@ #include "nsHTMLIIDs.h" #include "nsIPtr.h" #include "nsIView.h" +#include "nsStyleUtil.h" // dependancy on content #include "nsHTMLTagContent.h" @@ -442,29 +443,14 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, nsStyleS tableFrame->GetStyleContext(aPresContext,styleContext); - const nsStyleColor* colorData = (const nsStyleColor*)styleContext->GetStyleData(eStyleStruct_Color); - - // Look until we find a style context with a NON-transparent background color - while (styleContext) - { - if ((colorData->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)!=0) - { - nsIStyleContext* temp = styleContext; - styleContext = styleContext->GetParent(); - NS_RELEASE(temp); - colorData = (const nsStyleColor*)styleContext->GetStyleData(eStyleStruct_Color); - } - else - { - break; - } - } + const nsStyleColor* colorData = + nsStyleUtil::FindNonTransparentBackground(styleContext); + NS_IF_RELEASE(styleContext); // Yaahoo, we found a style context which has a background color - nscolor borderColor = 0xFFC0C0C0; - if (styleContext != nsnull) + if (colorData != nsnull) borderColor = colorData->mBackgroundColor; // if the border color is white, then shift to grey diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 58a247b7f1f..fb618c9368d 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -31,6 +31,7 @@ #include "nsHTMLIIDs.h" #include "nsIPtr.h" #include "nsIView.h" +#include "nsStyleUtil.h" // dependancy on content #include "nsHTMLTagContent.h" @@ -442,29 +443,14 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, nsStyleS tableFrame->GetStyleContext(aPresContext,styleContext); - const nsStyleColor* colorData = (const nsStyleColor*)styleContext->GetStyleData(eStyleStruct_Color); - - // Look until we find a style context with a NON-transparent background color - while (styleContext) - { - if ((colorData->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)!=0) - { - nsIStyleContext* temp = styleContext; - styleContext = styleContext->GetParent(); - NS_RELEASE(temp); - colorData = (const nsStyleColor*)styleContext->GetStyleData(eStyleStruct_Color); - } - else - { - break; - } - } + const nsStyleColor* colorData = + nsStyleUtil::FindNonTransparentBackground(styleContext); + NS_IF_RELEASE(styleContext); // Yaahoo, we found a style context which has a background color - nscolor borderColor = 0xFFC0C0C0; - if (styleContext != nsnull) + if (colorData != nsnull) borderColor = colorData->mBackgroundColor; // if the border color is white, then shift to grey