summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-visited
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/css-visited')
-rw-r--r--layout/reftests/css-visited/border-1-ref.html11
-rw-r--r--layout/reftests/css-visited/border-1.html11
-rw-r--r--layout/reftests/css-visited/border-2-ref.html11
-rw-r--r--layout/reftests/css-visited/border-2a.html11
-rw-r--r--layout/reftests/css-visited/border-2b.html11
-rw-r--r--layout/reftests/css-visited/border-collapse-1-ref.html32
-rw-r--r--layout/reftests/css-visited/border-collapse-1.html32
-rw-r--r--layout/reftests/css-visited/color-choice-1-ref.html10
-rw-r--r--layout/reftests/css-visited/color-choice-1.html11
-rw-r--r--layout/reftests/css-visited/color-on-bullets-1-ref.html18
-rw-r--r--layout/reftests/css-visited/color-on-bullets-1.html18
-rw-r--r--layout/reftests/css-visited/color-on-link-1-ref.html6
-rw-r--r--layout/reftests/css-visited/color-on-link-1.html8
-rw-r--r--layout/reftests/css-visited/color-on-link-before-1.html8
-rw-r--r--layout/reftests/css-visited/color-on-text-decoration-1-ref.html18
-rw-r--r--layout/reftests/css-visited/color-on-text-decoration-1.html18
-rw-r--r--layout/reftests/css-visited/color-on-visited-1-ref.html6
-rw-r--r--layout/reftests/css-visited/color-on-visited-1.html8
-rw-r--r--layout/reftests/css-visited/color-on-visited-before-1.html8
-rw-r--r--layout/reftests/css-visited/column-rule-1-notref.html11
-rw-r--r--layout/reftests/css-visited/column-rule-1-ref.html11
-rw-r--r--layout/reftests/css-visited/column-rule-1.html11
-rw-r--r--layout/reftests/css-visited/content-before-1-ref.html6
-rw-r--r--layout/reftests/css-visited/content-color-on-link-before-1-ref.html6
-rw-r--r--layout/reftests/css-visited/content-color-on-link-before-1.html8
-rw-r--r--layout/reftests/css-visited/content-color-on-visited-before-1-ref.html6
-rw-r--r--layout/reftests/css-visited/content-color-on-visited-before-1.html8
-rw-r--r--layout/reftests/css-visited/content-on-link-before-1.html8
-rw-r--r--layout/reftests/css-visited/content-on-visited-before-1.html8
-rw-r--r--layout/reftests/css-visited/first-line-1-ref.html12
-rw-r--r--layout/reftests/css-visited/first-line-1.html22
-rw-r--r--layout/reftests/css-visited/inherit-keyword-1-ref.html15
-rw-r--r--layout/reftests/css-visited/inherit-keyword-1.xhtml20
-rw-r--r--layout/reftests/css-visited/link-root-1-ref.xhtml16
-rw-r--r--layout/reftests/css-visited/link-root-1.xhtml26
-rw-r--r--layout/reftests/css-visited/mathml-links-ref.html32
-rw-r--r--layout/reftests/css-visited/mathml-links.html33
-rw-r--r--layout/reftests/css-visited/outline-1-ref.html11
-rw-r--r--layout/reftests/css-visited/outline-1.html11
-rw-r--r--layout/reftests/css-visited/reftest-stylo.list5
-rw-r--r--layout/reftests/css-visited/reftest.list4
-rw-r--r--layout/reftests/css-visited/selector-adj-sibling-1-ref.html7
-rw-r--r--layout/reftests/css-visited/selector-adj-sibling-1.html11
-rw-r--r--layout/reftests/css-visited/selector-adj-sibling-2-ref.html6
-rw-r--r--layout/reftests/css-visited/selector-adj-sibling-2.html15
-rw-r--r--layout/reftests/css-visited/selector-any-sibling-1-ref.html7
-rw-r--r--layout/reftests/css-visited/selector-any-sibling-1.html11
-rw-r--r--layout/reftests/css-visited/selector-any-sibling-2-ref.html6
-rw-r--r--layout/reftests/css-visited/selector-any-sibling-2.html15
-rw-r--r--layout/reftests/css-visited/selector-child-1-ref.html4
-rw-r--r--layout/reftests/css-visited/selector-child-1.html11
-rw-r--r--layout/reftests/css-visited/selector-child-2-ref.xhtml12
-rw-r--r--layout/reftests/css-visited/selector-child-2.xhtml21
-rw-r--r--layout/reftests/css-visited/selector-descendant-1-ref.html4
-rw-r--r--layout/reftests/css-visited/selector-descendant-1.html11
-rw-r--r--layout/reftests/css-visited/selector-descendant-2-ref.xhtml36
-rw-r--r--layout/reftests/css-visited/selector-descendant-2.xhtml36
-rw-r--r--layout/reftests/css-visited/subject-of-selector-1-ref.html4
-rw-r--r--layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html11
-rw-r--r--layout/reftests/css-visited/subject-of-selector-any-sibling-1.html11
-rw-r--r--layout/reftests/css-visited/subject-of-selector-child-1.html11
-rw-r--r--layout/reftests/css-visited/subject-of-selector-descendant-1.html11
-rw-r--r--layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml33
-rw-r--r--layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml33
-rw-r--r--layout/reftests/css-visited/visited-page.html2
-rw-r--r--layout/reftests/css-visited/white-to-transparent-1-ref.html11
-rw-r--r--layout/reftests/css-visited/white-to-transparent-1.html13
-rw-r--r--layout/reftests/css-visited/width-1-ref.html12
-rw-r--r--layout/reftests/css-visited/width-on-link-1.html17
-rw-r--r--layout/reftests/css-visited/width-on-visited-1.html17
70 files changed, 945 insertions, 0 deletions
diff --git a/layout/reftests/css-visited/border-1-ref.html b/layout/reftests/css-visited/border-1-ref.html
new file mode 100644
index 000000000..cbd7450eb
--- /dev/null
+++ b/layout/reftests/css-visited/border-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div { margin: 2px; }
+.unvis { border: medium solid olive; border-top: dashed thin blue; }
+.vis { border: medium solid fuchsia; border-top-style: dashed; border-top-width: thin; border-right-color: silver; }
+
+</style>
+<div class="unvis">unvisited</div>
+<div class="vis">visited</div>
diff --git a/layout/reftests/css-visited/border-1.html b/layout/reftests/css-visited/border-1.html
new file mode 100644
index 000000000..38ba7e8af
--- /dev/null
+++ b/layout/reftests/css-visited/border-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+a { text-decoration: none; color: initial; display: block; margin: 2px; }
+:link { border: medium solid olive; border-top: dashed thin blue; }
+:visited { border: thick dotted fuchsia; border-right: thin double silver; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/border-2-ref.html b/layout/reftests/css-visited/border-2-ref.html
new file mode 100644
index 000000000..3730a300c
--- /dev/null
+++ b/layout/reftests/css-visited/border-2-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777): default color for 'border'</title>
+<style type="text/css">
+
+div { margin: 2px; }
+.link { color: maroon; border: medium solid maroon; border-top: dashed thin blue; }
+.visited { color: gray; border: medium solid fuchsia; border-top: dashed thin fuchsia; border-right-color: gray; }
+
+</style>
+<div class="link">unvisited</div>
+<div class="visited">visited</div>
diff --git a/layout/reftests/css-visited/border-2a.html b/layout/reftests/css-visited/border-2a.html
new file mode 100644
index 000000000..de756dba1
--- /dev/null
+++ b/layout/reftests/css-visited/border-2a.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777): implicit default color for 'border'</title>
+<style type="text/css">
+
+a { text-decoration: none; display: block; margin: 2px; }
+:link { color: maroon; border: medium solid; border-top: dashed thin blue; }
+:visited { color: gray; border: thick dotted fuchsia; border-right: thin double; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/border-2b.html b/layout/reftests/css-visited/border-2b.html
new file mode 100644
index 000000000..9a97afcc5
--- /dev/null
+++ b/layout/reftests/css-visited/border-2b.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777): explicit default color for 'border'</title>
+<style type="text/css">
+
+a { text-decoration: none; display: block; margin: 2px; }
+:link { color: maroon; border: medium solid currentColor; border-top: dashed thin blue; }
+:visited { color: gray; border: thick dotted fuchsia; border-right: thin double currentColor; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/border-collapse-1-ref.html b/layout/reftests/css-visited/border-collapse-1-ref.html
new file mode 100644
index 000000000..fea8ae14d
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div.table { display: table; border-collapse: collapse }
+div.row { display: table-row }
+div.link, div.visited { display: table-cell }
+
+.row1 .link { border: medium solid blue }
+.row1 .visited { border: medium solid fuchsia }
+
+.row2 .link { border: thin dotted black }
+.row2 .visited { border: thin dotted red }
+
+.row3 .link { border: 7px double gray }
+.row3 .visited { border: 7px double olive }
+
+</style>
+<div class="table">
+ <div class="row row1">
+ <div class="link">unvisited</div>
+ <div class="visited">visited</div>
+ </div>
+ <div class="row row2">
+ <div class="visited">visited</div>
+ <div class="link">unvisited</div>
+ </div>
+ <div class="row row3">
+ <div class="link">unvisited</div>
+ <div class="visited">visited</div>
+ </div>
+</div>
diff --git a/layout/reftests/css-visited/border-collapse-1.html b/layout/reftests/css-visited/border-collapse-1.html
new file mode 100644
index 000000000..b702c0184
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div.table { display: table; border-collapse: collapse }
+div.row { display: table-row }
+a { text-decoration: none; color: initial; display: table-cell }
+
+.row1 :link { border: medium solid blue }
+.row1 :visited { border: thick dashed fuchsia }
+
+.row2 :link { border: thin dotted black }
+.row2 :visited { border: thick hidden rgba(255, 0, 0, 0.5) }
+
+.row3 :link { border: 7px double gray }
+.row3 :visited { border: 4px inset olive }
+
+</style>
+<div class="table">
+ <div class="row row1">
+ <a href="unvisited-page.html">unvisited</a>
+ <a href="visited-page.html">visited</a>
+ </div>
+ <div class="row row2">
+ <a href="visited-page.html">visited</a>
+ <a href="unvisited-page.html">unvisited</a>
+ </div>
+ <div class="row row3">
+ <a href="unvisited-page.html">unvisited</a>
+ <a href="visited-page.html">visited</a>
+ </div>
+</div>
diff --git a/layout/reftests/css-visited/color-choice-1-ref.html b/layout/reftests/css-visited/color-choice-1-ref.html
new file mode 100644
index 000000000..2a58c8e28
--- /dev/null
+++ b/layout/reftests/css-visited/color-choice-1-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+.link { background: rgba(179, 25, 87, 0.72); }
+.visited { background: rgba(28, 215, 119, 0.72); }
+
+</style>
+<span class="link">unvisited</span>
+<span class="visited">visited</span>
diff --git a/layout/reftests/css-visited/color-choice-1.html b/layout/reftests/css-visited/color-choice-1.html
new file mode 100644
index 000000000..002c4fb64
--- /dev/null
+++ b/layout/reftests/css-visited/color-choice-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+a { text-decoration: none; color: initial; }
+:link { background: rgba(179, 25, 87, 0.72); }
+:visited { background: rgba(28, 215, 119, 0.31); }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/color-on-bullets-1-ref.html b/layout/reftests/css-visited/color-on-bullets-1-ref.html
new file mode 100644
index 000000000..0d91630dc
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-bullets-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+ul, ol, li { margin: 0; padding: 0 }
+li { margin-left: 4em }
+.link { color: rgba(255, 177, 83, 0.8) }
+.visited { color: rgba(128, 99, 12, 0.8) }
+
+</style>
+<ol>
+<li class="link">unvisited</li>
+<li class="visited">visited</li>
+</ol>
+<ul>
+<li class="link">unvisited</li>
+<li class="visited">visited</li>
+</ul>
diff --git a/layout/reftests/css-visited/color-on-bullets-1.html b/layout/reftests/css-visited/color-on-bullets-1.html
new file mode 100644
index 000000000..6f04678b5
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-bullets-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none; display: list-item; margin-left: 4em }
+:link { color: rgba(255, 177, 83, 0.8) }
+:visited { color: rgba(128, 99, 12, 0.4) }
+
+</style>
+<!-- FIXME: workaround list numbering bug by using ol instead of div -->
+<ol style="list-style-type: decimal; margin: 0; padding: 0">
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
+</ol>
+<div style="list-style-type: disc">
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
+</div>
diff --git a/layout/reftests/css-visited/color-on-link-1-ref.html b/layout/reftests/css-visited/color-on-link-1-ref.html
new file mode 100644
index 000000000..859cfb6dd
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+span { color: fuchsia; }
+</style>
+<span>link</span>
diff --git a/layout/reftests/css-visited/color-on-link-1.html b/layout/reftests/css-visited/color-on-link-1.html
new file mode 100644
index 000000000..425523f1f
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link { color: fuchsia; }
+:visited { color: purple; }
+</style>
+<a href="unvisited-page.html">link</a>
diff --git a/layout/reftests/css-visited/color-on-link-before-1.html b/layout/reftests/css-visited/color-on-link-before-1.html
new file mode 100644
index 000000000..72e965f1c
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link:before { content: "link"; color: fuchsia; }
+:visited:before { content: "link"; color: purple; }
+</style>
+<a href="unvisited-page.html"></a>
diff --git a/layout/reftests/css-visited/color-on-text-decoration-1-ref.html b/layout/reftests/css-visited/color-on-text-decoration-1-ref.html
new file mode 100644
index 000000000..9bdc6fa8d
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-text-decoration-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+body > span { text-decoration: underline }
+body > span > span { text-decoration: overline }
+body > span > span > span { text-decoration: line-through }
+
+.link { color: olive }
+.link > span { color: fuchsia }
+.link > span > span { color: black }
+.visited { color: gray }
+.visited > span { color: maroon }
+.visited > span > span { color: purple }
+
+</style>
+<span class="link"><span><span>unvisited</span></span></span>
+<span class="visited"><span><span>visited</span></span></span>
diff --git a/layout/reftests/css-visited/color-on-text-decoration-1.html b/layout/reftests/css-visited/color-on-text-decoration-1.html
new file mode 100644
index 000000000..029823d0e
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-text-decoration-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+body > a { text-decoration: underline }
+body > a > span { text-decoration: overline }
+body > a > span > span { text-decoration: line-through }
+
+:link { color: olive }
+:link > span { color: fuchsia }
+:link > span > span { color: black }
+:visited { color: gray }
+:visited > span { color: maroon }
+:visited > span > span { color: purple }
+
+</style>
+<a href="unvisited-page.html"><span><span>unvisited</span></span></a>
+<a href="visited-page.html"><span><span>visited</span></span></a>
diff --git a/layout/reftests/css-visited/color-on-visited-1-ref.html b/layout/reftests/css-visited/color-on-visited-1-ref.html
new file mode 100644
index 000000000..75fda1f75
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+span { color: purple; }
+</style>
+<span>link</span>
diff --git a/layout/reftests/css-visited/color-on-visited-1.html b/layout/reftests/css-visited/color-on-visited-1.html
new file mode 100644
index 000000000..1b7bc4b41
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link { color: fuchsia; }
+:visited { color: purple; }
+</style>
+<a href="visited-page.html">link</a>
diff --git a/layout/reftests/css-visited/color-on-visited-before-1.html b/layout/reftests/css-visited/color-on-visited-before-1.html
new file mode 100644
index 000000000..4dc80d82a
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link:before { content: "link"; color: fuchsia; }
+:visited:before { content: "link"; color: purple; }
+</style>
+<a href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/column-rule-1-notref.html b/layout/reftests/css-visited/column-rule-1-notref.html
new file mode 100644
index 000000000..74f1397be
--- /dev/null
+++ b/layout/reftests/css-visited/column-rule-1-notref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div { margin: 8px; -moz-column-count: 2; }
+#link { -moz-column-rule: medium dotted blue; }
+#visited { -moz-column-rule: medium dotted black; }
+
+</style>
+<div id="link">unvisited<br>link</div>
+<div id="visited">visited<br>link</div>
diff --git a/layout/reftests/css-visited/column-rule-1-ref.html b/layout/reftests/css-visited/column-rule-1-ref.html
new file mode 100644
index 000000000..c20f795a3
--- /dev/null
+++ b/layout/reftests/css-visited/column-rule-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div { margin: 8px; -moz-column-count: 2; }
+#link { -moz-column-rule: medium dotted blue; }
+#visited { -moz-column-rule: medium dotted silver; }
+
+</style>
+<div id="link">unvisited<br>link</div>
+<div id="visited">visited<br>link</div>
diff --git a/layout/reftests/css-visited/column-rule-1.html b/layout/reftests/css-visited/column-rule-1.html
new file mode 100644
index 000000000..1cee83a2f
--- /dev/null
+++ b/layout/reftests/css-visited/column-rule-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+a { text-decoration: none; color: initial; display: block; margin: 8px; -moz-column-count: 2; }
+:link { -moz-column-rule: medium dotted blue; }
+:visited { -moz-column-rule: thick dashed silver; }
+
+</style>
+<a href="unvisited-page.html">unvisited<br>link</a>
+<a href="visited-page.html">visited<br>link</a>
diff --git a/layout/reftests/css-visited/content-before-1-ref.html b/layout/reftests/css-visited/content-before-1-ref.html
new file mode 100644
index 000000000..233407fbb
--- /dev/null
+++ b/layout/reftests/css-visited/content-before-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+span:before { content: "link"; }
+</style>
+<span></span>
diff --git a/layout/reftests/css-visited/content-color-on-link-before-1-ref.html b/layout/reftests/css-visited/content-color-on-link-before-1-ref.html
new file mode 100644
index 000000000..a46017fde
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-link-before-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+span:before { content: "link"; color: fuchsia; }
+</style>
+<span></span>
diff --git a/layout/reftests/css-visited/content-color-on-link-before-1.html b/layout/reftests/css-visited/content-color-on-link-before-1.html
new file mode 100644
index 000000000..bea15972f
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-link-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link:before { content: "link"; color: fuchsia; }
+:visited:before { content: "visited"; color: purple; }
+</style>
+<a href="unvisited-page.html"></a>
diff --git a/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html b/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html
new file mode 100644
index 000000000..66df0e1b9
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+span:before { content: "link"; color: purple; }
+</style>
+<span></span>
diff --git a/layout/reftests/css-visited/content-color-on-visited-before-1.html b/layout/reftests/css-visited/content-color-on-visited-before-1.html
new file mode 100644
index 000000000..72664e022
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-visited-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+a { text-decoration: none }
+:link:before { content: "link"; color: fuchsia; }
+:visited:before { content: "visited"; color: purple; }
+</style>
+<a href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/content-on-link-before-1.html b/layout/reftests/css-visited/content-on-link-before-1.html
new file mode 100644
index 000000000..bcc1ab2e1
--- /dev/null
+++ b/layout/reftests/css-visited/content-on-link-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+* { color: initial; text-decoration: none }
+:link:before { content: "link"; }
+:visited:before { content: "visited"; }
+</style>
+<a href="unvisited-page.html"></a>
diff --git a/layout/reftests/css-visited/content-on-visited-before-1.html b/layout/reftests/css-visited/content-on-visited-before-1.html
new file mode 100644
index 000000000..3c1ec0a9e
--- /dev/null
+++ b/layout/reftests/css-visited/content-on-visited-before-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+* { color: initial; text-decoration: none }
+:link:before { content: "link"; }
+:visited:before { content: "visited"; }
+</style>
+<a href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/first-line-1-ref.html b/layout/reftests/css-visited/first-line-1-ref.html
new file mode 100644
index 000000000..796968566
--- /dev/null
+++ b/layout/reftests/css-visited/first-line-1-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html lang="en-US">
+<head>
+ <title>:visited and ::first-line (reference)</title>
+</head>
+<body>
+
+<div><span style="color: fuchsia">unvisited</span><br><span style="color: blue">link</span></div>
+<div><span style="color: maroon">visited</span><br><span style="color: purple">link</span></div>
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/first-line-1.html b/layout/reftests/css-visited/first-line-1.html
new file mode 100644
index 000000000..37aec8edc
--- /dev/null
+++ b/layout/reftests/css-visited/first-line-1.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html lang="en-US">
+<head>
+ <title>:visited and ::first-line</title>
+ <style type="text/css">
+
+ :link, :visited { display: block; text-decoration: none; }
+
+ :link { color: blue }
+ :link::first-line { color: fuchsia; }
+ :visited { color: purple }
+ :visited::first-line { color: maroon; }
+
+ </style>
+</head>
+<body>
+
+<a href="unvisited-page.html">unvisited<br>link</a>
+<a href="visited-page.html">visited<br>link</a>
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/inherit-keyword-1-ref.html b/layout/reftests/css-visited/inherit-keyword-1-ref.html
new file mode 100644
index 000000000..0b3d4ea4b
--- /dev/null
+++ b/layout/reftests/css-visited/inherit-keyword-1-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<!--
+ Intentionally using an HTML reference for an XHTML test, just to
+ mix things up a little. :-)
+ -->
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+span { text-decoration: none; color: olive }
+
+</style>
+<span>unvisited / unvisited</span>
+<span>unvisited / visited</span>
+<span>visited / unvisited</span>
+<span>visited / visited</span>
diff --git a/layout/reftests/css-visited/inherit-keyword-1.xhtml b/layout/reftests/css-visited/inherit-keyword-1.xhtml
new file mode 100644
index 000000000..abc08c51d
--- /dev/null
+++ b/layout/reftests/css-visited/inherit-keyword-1.xhtml
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+body > :link { color: olive; }
+body > :visited { color: fuchsia; }
+a > a { color: inherit; }
+
+</style>
+</head>
+<body>
+<a href="unvisited-page.html"><a href="unvisited-page.html">unvisited / unvisited</a></a>
+<a href="unvisited-page.html"><a href="visited-page.html">unvisited / visited</a></a>
+<a href="visited-page.html"><a href="unvisited-page.html">visited / unvisited</a></a>
+<a href="visited-page.html"><a href="visited-page.html">visited / visited</a></a>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/link-root-1-ref.xhtml b/layout/reftests/css-visited/link-root-1-ref.xhtml
new file mode 100644
index 000000000..577792b11
--- /dev/null
+++ b/layout/reftests/css-visited/link-root-1-ref.xhtml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>dynamic changes to link state for root element (reference)</title>
+<style>
+<![CDATA[
+
+html { background: green }
+
+]]>
+</style>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/link-root-1.xhtml b/layout/reftests/css-visited/link-root-1.xhtml
new file mode 100644
index 000000000..8ac75b4f9
--- /dev/null
+++ b/layout/reftests/css-visited/link-root-1.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE html>
+<a xmlns="http://www.w3.org/1999/xhtml"
+ href="http://www.example-notvisited.tld" class="reftest-wait">
+<style>
+<![CDATA[
+
+a { display: block; width: 100%; height: 100% }
+
+:link { background: red }
+:visited { background: green }
+
+]]>
+</style>
+<script>
+<![CDATA[
+
+var a = document.documentElement;
+getComputedStyle(a, "").backgroundColor; // flush style
+a.href = "";
+getComputedStyle(a, "").backgroundColor; // flush style
+document.documentElement.removeAttribute("class");
+
+]]>
+</script>
+</a>
diff --git a/layout/reftests/css-visited/mathml-links-ref.html b/layout/reftests/css-visited/mathml-links-ref.html
new file mode 100644
index 000000000..7919142fe
--- /dev/null
+++ b/layout/reftests/css-visited/mathml-links-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <style>
+ * { color: green; }
+ </style>
+ </head>
+ <body>
+ <math href="" display="block">
+ <mi>x</mi>
+ <mo>=</mo>
+ <mfrac>
+ <mrow>
+ <msqrt>
+ <mn>5</mn>
+ </msqrt>
+ </mrow>
+ <mrow>
+ <menclose
+ notation="radical circle roundedbox updiagonalstrike downdiagonalstrike">
+ <mn>2</mn>
+ </menclose>
+ </mrow>
+ </mfrac>
+ <mo>+</mo>
+ <mfrac bevelled="true">
+ <mn>2</mn>
+ <mn>3</mn>
+ </mfrac>
+ </math>
+ </body>
+</html>
diff --git a/layout/reftests/css-visited/mathml-links.html b/layout/reftests/css-visited/mathml-links.html
new file mode 100644
index 000000000..19a2c3b44
--- /dev/null
+++ b/layout/reftests/css-visited/mathml-links.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <style>
+ :link { color: red; }
+ :visited { color: green; }
+ </style>
+ </head>
+ <body>
+ <math href="" display="block">
+ <mi>x</mi>
+ <mo>=</mo>
+ <mfrac>
+ <mrow>
+ <msqrt>
+ <mn>5</mn>
+ </msqrt>
+ </mrow>
+ <mrow>
+ <menclose
+ notation="radical circle roundedbox updiagonalstrike downdiagonalstrike">
+ <mn>2</mn>
+ </menclose>
+ </mrow>
+ </mfrac>
+ <mo>+</mo>
+ <mfrac bevelled="true">
+ <mn>2</mn>
+ <mn>3</mn>
+ </mfrac>
+ </math>
+ </body>
+</html>
diff --git a/layout/reftests/css-visited/outline-1-ref.html b/layout/reftests/css-visited/outline-1-ref.html
new file mode 100644
index 000000000..996a4c350
--- /dev/null
+++ b/layout/reftests/css-visited/outline-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+div { margin: 8px; }
+.unvis { outline: medium dotted blue; }
+.vis { outline: medium dotted silver; }
+
+</style>
+<div class="unvis">unvisited</div>
+<div class="vis">visited</div>
diff --git a/layout/reftests/css-visited/outline-1.html b/layout/reftests/css-visited/outline-1.html
new file mode 100644
index 000000000..d31cf4feb
--- /dev/null
+++ b/layout/reftests/css-visited/outline-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+
+a { text-decoration: none; color: initial; display: block; margin: 8px; }
+:link { outline: medium dotted blue; }
+:visited { outline: thick dashed silver; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/reftest-stylo.list b/layout/reftests/css-visited/reftest-stylo.list
new file mode 100644
index 000000000..40236791f
--- /dev/null
+++ b/layout/reftests/css-visited/reftest-stylo.list
@@ -0,0 +1,5 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# Because coloring of visited links is asynchronous and does not block
+# or fire any events, the tests in this directory are not run through
+# the reftest harness. Instead, they are run through
+# layout/style/tests/test_visited_reftests.html .
diff --git a/layout/reftests/css-visited/reftest.list b/layout/reftests/css-visited/reftest.list
new file mode 100644
index 000000000..62cfba757
--- /dev/null
+++ b/layout/reftests/css-visited/reftest.list
@@ -0,0 +1,4 @@
+# Because coloring of visited links is asynchronous and does not block
+# or fire any events, the tests in this directory are not run through
+# the reftest harness. Instead, they are run through
+# layout/style/tests/test_visited_reftests.html .
diff --git a/layout/reftests/css-visited/selector-adj-sibling-1-ref.html b/layout/reftests/css-visited/selector-adj-sibling-1-ref.html
new file mode 100644
index 000000000..ba6ecca09
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+span { color: olive; }
+</style>
+<span>unvisited</span>
+<span>visited</span>
diff --git a/layout/reftests/css-visited/selector-adj-sibling-1.html b/layout/reftests/css-visited/selector-adj-sibling-1.html
new file mode 100644
index 000000000..b5bb0d413
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link + span { color: olive; }
+:visited + span { color: fuchsia; }
+
+</style>
+<a href="unvisited-page.html"></a><span>unvisited</span>
+<a href="visited-page.html"></a><span>visited</span>
diff --git a/layout/reftests/css-visited/selector-adj-sibling-2-ref.html b/layout/reftests/css-visited/selector-adj-sibling-2-ref.html
new file mode 100644
index 000000000..a9f97dc9c
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-2-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<span style="color: olive">unvisited + unvisited</span>
+<span style="color: fuchsia">unvisited + visited</span>
+<span style="color: olive">visited + unvisited</span>
+<span style="color: fuchsia">visited + visited</span>
diff --git a/layout/reftests/css-visited/selector-adj-sibling-2.html b/layout/reftests/css-visited/selector-adj-sibling-2.html
new file mode 100644
index 000000000..0eee73c51
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link + :link { color: olive; }
+:visited + :link { color: red; }
+:link + :visited { color: fuchsia; }
+:visited + :visited { color: red; }
+
+</style>
+<a href="unvisited-page.html"></a><a href="unvisited-page.html">unvisited + unvisited</a>
+<a href="unvisited-page.html"></a><a href="visited-page.html">unvisited + visited</a>
+<a href="visited-page.html"></a><a href="unvisited-page.html">visited + unvisited</a>
+<a href="visited-page.html"></a><a href="visited-page.html">visited + visited</a>
diff --git a/layout/reftests/css-visited/selector-any-sibling-1-ref.html b/layout/reftests/css-visited/selector-any-sibling-1-ref.html
new file mode 100644
index 000000000..de502b684
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+div { color: olive; }
+</style>
+<div>unvisited</div>
+<div>visited</div>
diff --git a/layout/reftests/css-visited/selector-any-sibling-1.html b/layout/reftests/css-visited/selector-any-sibling-1.html
new file mode 100644
index 000000000..25f00c654
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link ~ span { color: olive; }
+:visited ~ span { color: fuchsia; }
+
+</style>
+<div><a href="unvisited-page.html"></a><span>unvisited</span></div>
+<div><a href="visited-page.html"></a><span>visited</span></div>
diff --git a/layout/reftests/css-visited/selector-any-sibling-2-ref.html b/layout/reftests/css-visited/selector-any-sibling-2-ref.html
new file mode 100644
index 000000000..e64a48729
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-2-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<div style="color: olive">unvisited + unvisited</div>
+<div style="color: fuchsia">unvisited + visited</div>
+<div style="color: olive">visited + unvisited</div>
+<div style="color: fuchsia">visited + visited</div>
diff --git a/layout/reftests/css-visited/selector-any-sibling-2.html b/layout/reftests/css-visited/selector-any-sibling-2.html
new file mode 100644
index 000000000..31ec00f4c
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link ~ :link { color: olive; }
+:visited ~ :link { color: red; }
+:link ~ :visited { color: fuchsia; }
+:visited ~ :visited { color: red; }
+
+</style>
+<div><a href="unvisited-page.html"></a><a href="unvisited-page.html">unvisited + unvisited</a></div>
+<div><a href="unvisited-page.html"></a><a href="visited-page.html">unvisited + visited</a></div>
+<div><a href="visited-page.html"></a><a href="unvisited-page.html">visited + unvisited</a></div>
+<div><a href="visited-page.html"></a><a href="visited-page.html">visited + visited</a></div>
diff --git a/layout/reftests/css-visited/selector-child-1-ref.html b/layout/reftests/css-visited/selector-child-1-ref.html
new file mode 100644
index 000000000..2ed3bd25a
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<span style="color: olive">unvisited</span>
+<span style="color: fuchsia">visited</span>
diff --git a/layout/reftests/css-visited/selector-child-1.html b/layout/reftests/css-visited/selector-child-1.html
new file mode 100644
index 000000000..bd56273e4
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link > span { color: olive; }
+:visited > span { color: fuchsia; }
+
+</style>
+<a href="unvisited-page.html"><span>unvisited</span></a>
+<a href="visited-page.html"><span>visited</span></a>
diff --git a/layout/reftests/css-visited/selector-child-2-ref.xhtml b/layout/reftests/css-visited/selector-child-2-ref.xhtml
new file mode 100644
index 000000000..e56caa1ab
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-2-ref.xhtml
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+</head>
+<body>
+<span style="color: olive">unvisited / unvisited</span>
+<span style="color: fuchsia">unvisited / visited</span>
+<span style="color: olive">visited / unvisited</span>
+<span style="color: fuchsia">visited / visited</span>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/selector-child-2.xhtml b/layout/reftests/css-visited/selector-child-2.xhtml
new file mode 100644
index 000000000..35ebfb7b2
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-2.xhtml
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link > :link { color: olive; }
+:visited > :link { color: red; }
+:link > :visited { color: fuchsia; }
+:visited > :visited { color: red; }
+
+</style>
+</head>
+<body>
+<a href="unvisited-page.html"><a href="unvisited-page.html">unvisited / unvisited</a></a>
+<a href="unvisited-page.html"><a href="visited-page.html">unvisited / visited</a></a>
+<a href="visited-page.html"><a href="unvisited-page.html">visited / unvisited</a></a>
+<a href="visited-page.html"><a href="visited-page.html">visited / visited</a></a>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/selector-descendant-1-ref.html b/layout/reftests/css-visited/selector-descendant-1-ref.html
new file mode 100644
index 000000000..2ed3bd25a
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<span style="color: olive">unvisited</span>
+<span style="color: fuchsia">visited</span>
diff --git a/layout/reftests/css-visited/selector-descendant-1.html b/layout/reftests/css-visited/selector-descendant-1.html
new file mode 100644
index 000000000..e7cedde31
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link span { color: olive; }
+:visited span { color: fuchsia; }
+
+</style>
+<a href="unvisited-page.html"><span>unvisited</span></a>
+<a href="visited-page.html"><span>visited</span></a>
diff --git a/layout/reftests/css-visited/selector-descendant-2-ref.xhtml b/layout/reftests/css-visited/selector-descendant-2-ref.xhtml
new file mode 100644
index 000000000..a970ea512
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2-ref.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+body { color: black }
+span.l { color: olive; background: rgba(0, 255, 255, 0.5); }
+span.v { color: fuchsia; background: rgba(0, 0, 255, 0.5) }
+
+</style>
+</head>
+<body>
+
+<span class="l">unvisited</span> (<span class="l">unvisited</span>)
+<span class="l">unvisited</span> (<span class="v">visited</span>)
+<span class="v">visited</span> (<span class="l">unvisited</span>)
+<span class="v">visited</span> (<span class="v">visited</span>)
+
+<span class="u">unvisited</span> (<span class="l">unvisited</span>)
+<span class="u">unvisited</span> (<span class="v">visited</span>)
+<span class="u">visited</span> (<span class="l">unvisited</span>)
+<span class="u">visited</span> (<span class="v">visited</span>)
+
+<span class="l">unvisited</span> (<span class="l">unvisited</span>)
+<span class="l">unvisited</span> (<span class="l">visited</span>)
+<span class="v">visited</span> (<span class="l">unvisited</span>)
+<span class="v">visited</span> (<span class="l">visited</span>)
+
+<span class="u">unvisited</span> (<span class="u">unvisited</span>)
+<span class="u">unvisited</span> (<span class="u">visited</span>)
+<span class="u">visited</span> (<span class="u">unvisited</span>)
+<span class="u">visited</span> (<span class="u">visited</span>)
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/selector-descendant-2.xhtml b/layout/reftests/css-visited/selector-descendant-2.xhtml
new file mode 100644
index 000000000..1c5bfa4f5
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none; color: black }
+.styled:link span { color: olive; background: rgba(0, 255, 255, 0.5); }
+.styled:visited span { color: fuchsia; background: rgba(0, 0, 255, 0.5) }
+
+</style>
+</head>
+<body>
+
+<a class="styled" href="unvisited-page.html"><span>unvisited</span> (<a class="styled" href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a class="styled" href="unvisited-page.html"><span>unvisited</span> (<a class="styled" href="visited-page.html"><span>visited</span></a>)</a>
+<a class="styled" href="visited-page.html"><span>visited</span> (<a class="styled" href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a class="styled" href="visited-page.html"><span>visited</span> (<a class="styled" href="visited-page.html"><span>visited</span></a>)</a>
+
+<a href="unvisited-page.html"><span>unvisited</span> (<a class="styled" href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a href="unvisited-page.html"><span>unvisited</span> (<a class="styled" href="visited-page.html"><span>visited</span></a>)</a>
+<a href="visited-page.html"><span>visited</span> (<a class="styled" href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a href="visited-page.html"><span>visited</span> (<a class="styled" href="visited-page.html"><span>visited</span></a>)</a>
+
+<a class="styled" href="unvisited-page.html"><span>unvisited</span> (<a href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a class="styled" href="unvisited-page.html"><span>unvisited</span> (<a href="visited-page.html"><span>visited</span></a>)</a>
+<a class="styled" href="visited-page.html"><span>visited</span> (<a href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a class="styled" href="visited-page.html"><span>visited</span> (<a href="visited-page.html"><span>visited</span></a>)</a>
+
+<a href="unvisited-page.html"><span>unvisited</span> (<a href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a href="unvisited-page.html"><span>unvisited</span> (<a href="visited-page.html"><span>visited</span></a>)</a>
+<a href="visited-page.html"><span>visited</span> (<a href="unvisited-page.html"><span>unvisited</span></a>)</a>
+<a href="visited-page.html"><span>visited</span> (<a href="visited-page.html"><span>visited</span></a>)</a>
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/subject-of-selector-1-ref.html b/layout/reftests/css-visited/subject-of-selector-1-ref.html
new file mode 100644
index 000000000..2ed3bd25a
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<span style="color: olive">unvisited</span>
+<span style="color: fuchsia">visited</span>
diff --git a/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html b/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html
new file mode 100644
index 000000000..b0279d975
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+span + :link { color: olive; }
+span + :visited { color: fuchsia; }
+
+</style>
+<span></span><a href="unvisited-page.html">unvisited</a>
+<span></span><a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html b/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html
new file mode 100644
index 000000000..806f70578
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+span ~ :link { color: olive; }
+span ~ :visited { color: fuchsia; }
+
+</style>
+<span><span></span><a href="unvisited-page.html">unvisited</a></span>
+<span><span></span><a href="visited-page.html">visited</a></span>
diff --git a/layout/reftests/css-visited/subject-of-selector-child-1.html b/layout/reftests/css-visited/subject-of-selector-child-1.html
new file mode 100644
index 000000000..e9bdd9988
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-child-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+body > :link { color: olive; }
+body > :visited { color: fuchsia; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-1.html b/layout/reftests/css-visited/subject-of-selector-descendant-1.html
new file mode 100644
index 000000000..c31caeb0f
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+body :link { color: olive; }
+body :visited { color: fuchsia; }
+
+</style>
+<a href="unvisited-page.html">unvisited</a>
+<a href="visited-page.html">visited</a>
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml b/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml
new file mode 100644
index 000000000..21a8a829c
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+.unstylink { color: blue }
+.unstyvis { color: purple }
+
+.stylink { color: olive; background: rgba(0, 255, 255, 0.5); }
+.styvis { color: fuchsia; background: rgba(0, 0, 255, 0.5) }
+
+</style>
+</head>
+<body>
+
+<span class="stylink">unvisited (<span class="stylink">unvisited</span>)</span>
+<span class="stylink">unvisited (<span class="styvis">visited</span>)</span>
+<span class="styvis">visited (<span class="stylink">unvisited</span>)</span>
+<span class="styvis">visited (<span class="styvis">visited</span>)</span>
+
+<span class="unstylink">unvisited (<span class="stylink">unvisited</span>)</span>
+<span class="unstylink">unvisited (<span class="styvis">visited</span>)</span>
+<span class="unstyvis">visited (<span class="stylink">unvisited</span>)</span>
+<span class="unstyvis">visited (<span class="styvis">visited</span>)</span>
+
+<span class="stylink">unvisited (<span class="unstylink">unvisited</span>)</span>
+<span class="stylink">unvisited (<span class="unstyvis">visited</span>)</span>
+<span class="styvis">visited (<span class="unstylink">unvisited</span>)</span>
+<span class="styvis">visited (<span class="unstyvis">visited</span>)</span>
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml b/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml
new file mode 100644
index 000000000..b7e07ecad
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style>
+
+a { text-decoration: none }
+:link { color: blue }
+:visited { color: purple }
+body .styled:link { color: olive; background: rgba(0, 255, 255, 0.5); }
+body .styled:visited { color: fuchsia; background: rgba(0, 0, 255, 0.5) }
+
+</style>
+</head>
+<body>
+
+<a class="styled" href="unvisited-page.html">unvisited (<a class="styled" href="unvisited-page.html">unvisited</a>)</a>
+<a class="styled" href="unvisited-page.html">unvisited (<a class="styled" href="visited-page.html">visited</a>)</a>
+<a class="styled" href="visited-page.html">visited (<a class="styled" href="unvisited-page.html">unvisited</a>)</a>
+<a class="styled" href="visited-page.html">visited (<a class="styled" href="visited-page.html">visited</a>)</a>
+
+<a href="unvisited-page.html">unvisited (<a class="styled" href="unvisited-page.html">unvisited</a>)</a>
+<a href="unvisited-page.html">unvisited (<a class="styled" href="visited-page.html">visited</a>)</a>
+<a href="visited-page.html">visited (<a class="styled" href="unvisited-page.html">unvisited</a>)</a>
+<a href="visited-page.html">visited (<a class="styled" href="visited-page.html">visited</a>)</a>
+
+<a class="styled" href="unvisited-page.html">unvisited (<a href="unvisited-page.html">unvisited</a>)</a>
+<a class="styled" href="unvisited-page.html">unvisited (<a href="visited-page.html">visited</a>)</a>
+<a class="styled" href="visited-page.html">visited (<a href="unvisited-page.html">unvisited</a>)</a>
+<a class="styled" href="visited-page.html">visited (<a href="visited-page.html">visited</a>)</a>
+
+</body>
+</html>
diff --git a/layout/reftests/css-visited/visited-page.html b/layout/reftests/css-visited/visited-page.html
new file mode 100644
index 000000000..45f19843a
--- /dev/null
+++ b/layout/reftests/css-visited/visited-page.html
@@ -0,0 +1,2 @@
+<!DOCTYPE HTML>
+<title>Visited page for tests for privacy restrictions on :visited (Bug 147777)</title>
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 000000000..9ec44c5cd
--- /dev/null
+++ b/layout/reftests/css-visited/white-to-transparent-1-ref.html
@@ -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>
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 000000000..a9ac26957
--- /dev/null
+++ b/layout/reftests/css-visited/white-to-transparent-1.html
@@ -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>
diff --git a/layout/reftests/css-visited/width-1-ref.html b/layout/reftests/css-visited/width-1-ref.html
new file mode 100644
index 000000000..b7b388b8c
--- /dev/null
+++ b/layout/reftests/css-visited/width-1-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<table>
+ <tr>
+ <td>
+ <div style="width: 100px"></div>
+ </td>
+ <td>
+ text in next cell
+ </td>
+ </tr>
+</table>
diff --git a/layout/reftests/css-visited/width-on-link-1.html b/layout/reftests/css-visited/width-on-link-1.html
new file mode 100644
index 000000000..d05350dc1
--- /dev/null
+++ b/layout/reftests/css-visited/width-on-link-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+:link, :visited { display: block }
+:link { width: 100px; }
+:visited { width: 200px; }
+</style>
+<table>
+ <tr>
+ <td>
+ <a href="unvisited-page.html"></a>
+ </td>
+ <td>
+ text in next cell
+ </td>
+ </tr>
+</table>
diff --git a/layout/reftests/css-visited/width-on-visited-1.html b/layout/reftests/css-visited/width-on-visited-1.html
new file mode 100644
index 000000000..b9b653f4a
--- /dev/null
+++ b/layout/reftests/css-visited/width-on-visited-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<title>Test for privacy restrictions on :visited (Bug 147777)</title>
+<style type="text/css">
+:link, :visited { display: block }
+:link { width: 100px; }
+:visited { width: 200px; }
+</style>
+<table>
+ <tr>
+ <td>
+ <a href="visited-page.html"></a>
+ </td>
+ <td>
+ text in next cell
+ </td>
+ </tr>
+</table>