Avoid showing black when the if-visited style is transparent and the unvisited style is a color. (Bug 557584) r=bzbarsky

This commit is contained in:
L. David Baron 2010-04-06 15:32:52 -07:00
parent e85f5e69dd
commit ea2113c668
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<title>Test for privacy restrictions on :visited (Bug 147777)</title>
<style type="text/css">
body { background: white; color: black }
span { background: #ccc; }
</style>
<span>unvisited</span>
<span>visited</span>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<title>Test for privacy restrictions on :visited (Bug 147777)</title>
<style type="text/css">
body { background: white; color: black }
a { text-decoration: none; color: black }
:link { background: #ccc; }
:visited { background: transparent }
</style>
<a href="unvisited-page.html">unvisited</a>
<a href="visited-page.html">visited</a>

View File

@ -753,6 +753,14 @@ nsStyleContext::GetVisitedDependentColor(nsCSSProperty aProperty)
/* static */ nscolor
nsStyleContext::CombineVisitedColors(nscolor *aColors, PRBool aLinkIsVisited)
{
if (NS_GET_A(aColors[1]) == 0) {
// If the style-if-visited is transparent, then just use the
// unvisited style rather than using the (meaningless) color
// components of the visited style along with a potentially
// non-transparent alpha value.
aLinkIsVisited = PR_FALSE;
}
// NOTE: We want this code to have as little timing dependence as
// possible on whether this->RelevantLinkVisited() is true.
const ColorIndexSet &set =

View File

@ -77,6 +77,7 @@ var gTests = [
// FIXME: commented out because dynamic changes on the non-first-line
// part of the test don't work right when the link becomes visited.
//"== first-line-1.html first-line-1-ref.html",
"== white-to-transparent-1.html white-to-transparent-1-ref.html",
];
// Maintain a reference count of how many things we're waiting for until