From 5e70529bc8b7b1986cf055c427b5232b20feda9c Mon Sep 17 00:00:00 2001 From: "ginn.chen%sun.com" Date: Fri, 23 Sep 2005 08:08:09 +0000 Subject: [PATCH] Bug 255411 "Use my colors" preference makes popup/hover frames have transparent background r=bzbarsky sr=dbaron git-svn-id: svn://10.0.0.236/trunk@180852 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 8 +++++--- mozilla/layout/style/nsRuleNode.cpp | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index ce08bbdf432..75cc7623867 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -2247,7 +2247,7 @@ nsresult PresShell::SetPrefColorRules(void) // background: #RRGGBB !important;}' ColorToString(textColor,strColor); ColorToString(bgColor,strBackgroundColor); - result = sheet->InsertRule(NS_LITERAL_STRING(":root {color:") + + result = sheet->InsertRule(NS_LITERAL_STRING("*|*:root {color:") + strColor + NS_LITERAL_STRING(" !important; ") + NS_LITERAL_STRING("border-color: -moz-use-text-color !important; ") + @@ -2258,8 +2258,10 @@ nsresult PresShell::SetPrefColorRules(void) NS_ENSURE_SUCCESS(result, result); /////////////////////////////////////////////////////////////// - // - everything else inherits the color, and has transparent background - result = sheet->InsertRule(NS_LITERAL_STRING("* {color: inherit !important; border-color: -moz-use-text-color !important; background: transparent !important;} "), + // - everything else inherits the color + // (the background color will be handled in + // nsRuleNode::ComputeBackgroundData) + result = sheet->InsertRule(NS_LITERAL_STRING("*|* {color: inherit !important; border-color: -moz-use-text-color !important; background-image: none !important; } "), sInsertPrefSheetRulesAt, &index); } } diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index 46e1ff38fb2..da7e9d64801 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -3148,6 +3148,12 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor, mPresContext, aContext, bg->mBackgroundColor, inherited)) { bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT; + // if not using document colors, we have to use the user's background color + // instead of any background color other than transparent + if (!mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors) && + !IsChrome(mPresContext)) { + bg->mBackgroundColor = mPresContext->DefaultBackgroundColor(); + } } else if (eCSSUnit_Enumerated == colorData.mBackColor.GetUnit()) { //bg->mBackgroundColor = parentBG->mBackgroundColor; XXXwdh crap crap crap!