Fixed regression for bug 40340 (checked in yesterday). Thanks to David Baron. r=karnaze, a=buster

This commit is contained in:
attinasi%netscape.com 2000-10-11 22:25:57 +00:00
Родитель 55b665530c
Коммит f678e50f8b
2 изменённых файлов: 34 добавлений и 12 удалений

Просмотреть файл

@ -1940,8 +1940,7 @@ nsresult PresShell::SetPrefLinkRules(void)
// this means the link colors need to be overridable, // this means the link colors need to be overridable,
// which they are if we put them in the backstop stylesheet, // which they are if we put them in the backstop stylesheet,
// though if using an override sheet this will cause authors grief still // though if using an override sheet this will cause authors grief still
// In the backstop stylesheet, they are !important to keep the forced-color rules // In the backstop stylesheet, they are !important when we are ignoring document colors
// from coloring the links too
// //
// XXX: do active links and visited links get another color? // XXX: do active links and visited links get another color?
// They were red in the html.css rules // They were red in the html.css rules
@ -1955,20 +1954,32 @@ nsresult PresShell::SetPrefLinkRules(void)
// insert a rule to make links the preferred color // insert a rule to make links the preferred color
PRUint32 index = 0; PRUint32 index = 0;
nsAutoString strRule, strColor; nsAutoString strRule, strColor;
PRBool useDocColors = PR_TRUE;
// see if we need to create the rules first
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// - links: '*:link, *:link:active {color: #RRGGBB !important;}' // - links: '*:link, *:link:active {color: #RRGGBB [!important];}'
ColorToString(linkColor,strColor); ColorToString(linkColor,strColor);
strRule.Append(NS_LITERAL_STRING("*:link, *:link:active {color:")); strRule.Append(NS_LITERAL_STRING("*:link, *:link:active {color:"));
strRule.Append(strColor); strRule.Append(strColor);
if (!useDocColors) {
strRule.Append(NS_LITERAL_STRING(" !important;} ")); strRule.Append(NS_LITERAL_STRING(" !important;} "));
} else {
strRule.Append(NS_LITERAL_STRING(";} "));
}
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// - visited links '*:visited, *:visited:active {color: #RRGGBB !important;}' // - visited links '*:visited, *:visited:active {color: #RRGGBB [!important];}'
ColorToString(visitedColor,strColor); ColorToString(visitedColor,strColor);
strRule.Append(NS_LITERAL_STRING("*:visited, *:visited:active {color:")); strRule.Append(NS_LITERAL_STRING("*:visited, *:visited:active {color:"));
strRule.Append(strColor); strRule.Append(strColor);
if (!useDocColors) {
strRule.Append(NS_LITERAL_STRING(" !important;} ")); strRule.Append(NS_LITERAL_STRING(" !important;} "));
} else {
strRule.Append(NS_LITERAL_STRING(";} "));
}
// insert the rules // insert the rules
result = sheet->InsertRule(strRule,0,&index); result = sheet->InsertRule(strRule,0,&index);

Просмотреть файл

@ -1940,8 +1940,7 @@ nsresult PresShell::SetPrefLinkRules(void)
// this means the link colors need to be overridable, // this means the link colors need to be overridable,
// which they are if we put them in the backstop stylesheet, // which they are if we put them in the backstop stylesheet,
// though if using an override sheet this will cause authors grief still // though if using an override sheet this will cause authors grief still
// In the backstop stylesheet, they are !important to keep the forced-color rules // In the backstop stylesheet, they are !important when we are ignoring document colors
// from coloring the links too
// //
// XXX: do active links and visited links get another color? // XXX: do active links and visited links get another color?
// They were red in the html.css rules // They were red in the html.css rules
@ -1955,20 +1954,32 @@ nsresult PresShell::SetPrefLinkRules(void)
// insert a rule to make links the preferred color // insert a rule to make links the preferred color
PRUint32 index = 0; PRUint32 index = 0;
nsAutoString strRule, strColor; nsAutoString strRule, strColor;
PRBool useDocColors = PR_TRUE;
// see if we need to create the rules first
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// - links: '*:link, *:link:active {color: #RRGGBB !important;}' // - links: '*:link, *:link:active {color: #RRGGBB [!important];}'
ColorToString(linkColor,strColor); ColorToString(linkColor,strColor);
strRule.Append(NS_LITERAL_STRING("*:link, *:link:active {color:")); strRule.Append(NS_LITERAL_STRING("*:link, *:link:active {color:"));
strRule.Append(strColor); strRule.Append(strColor);
if (!useDocColors) {
strRule.Append(NS_LITERAL_STRING(" !important;} ")); strRule.Append(NS_LITERAL_STRING(" !important;} "));
} else {
strRule.Append(NS_LITERAL_STRING(";} "));
}
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// - visited links '*:visited, *:visited:active {color: #RRGGBB !important;}' // - visited links '*:visited, *:visited:active {color: #RRGGBB [!important];}'
ColorToString(visitedColor,strColor); ColorToString(visitedColor,strColor);
strRule.Append(NS_LITERAL_STRING("*:visited, *:visited:active {color:")); strRule.Append(NS_LITERAL_STRING("*:visited, *:visited:active {color:"));
strRule.Append(strColor); strRule.Append(strColor);
if (!useDocColors) {
strRule.Append(NS_LITERAL_STRING(" !important;} ")); strRule.Append(NS_LITERAL_STRING(" !important;} "));
} else {
strRule.Append(NS_LITERAL_STRING(";} "));
}
// insert the rules // insert the rules
result = sheet->InsertRule(strRule,0,&index); result = sheet->InsertRule(strRule,0,&index);