diff --git a/layout/reftests/css-visited/white-to-transparent-1-ref.html b/layout/reftests/css-visited/white-to-transparent-1-ref.html new file mode 100644 index 000000000000..9ec44c5cd3e4 --- /dev/null +++ b/layout/reftests/css-visited/white-to-transparent-1-ref.html @@ -0,0 +1,11 @@ + +Test for privacy restrictions on :visited (Bug 147777) + +unvisited +visited diff --git a/layout/reftests/css-visited/white-to-transparent-1.html b/layout/reftests/css-visited/white-to-transparent-1.html new file mode 100644 index 000000000000..a9ac2695745d --- /dev/null +++ b/layout/reftests/css-visited/white-to-transparent-1.html @@ -0,0 +1,13 @@ + +Test for privacy restrictions on :visited (Bug 147777) + +unvisited +visited diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index daa857847284..4027ccc0401e 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -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 = diff --git a/layout/style/test/test_visited_reftests.html b/layout/style/test/test_visited_reftests.html index 1fa3a6d19d65..88ca19757778 100644 --- a/layout/style/test/test_visited_reftests.html +++ b/layout/style/test/test_visited_reftests.html @@ -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