summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-visited
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /layout/reftests/css-visited
parentInitial commit. (diff)
downloadfirefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.tar.xz
firefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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/caret-color-on-visited-1-ref.html22
-rw-r--r--layout/reftests/css-visited/caret-color-on-visited-1.html26
-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/color-on-visited-text-1-ref.html16
-rw-r--r--layout/reftests/css-visited/color-on-visited-text-1.html20
-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/logical-box-border-color-visited-link-001.html32
-rw-r--r--layout/reftests/css-visited/logical-box-border-color-visited-link-002.html26
-rw-r--r--layout/reftests/css-visited/logical-box-border-color-visited-link-003.html43
-rw-r--r--layout/reftests/css-visited/logical-box-border-color-visited-link-ref.html11
-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/placeholder-1-ref.html7
-rw-r--r--layout/reftests/css-visited/placeholder-1.html6
-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-adj-sibling-3-ref.xhtml16
-rw-r--r--layout/reftests/css-visited/selector-adj-sibling-3.xhtml19
-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.xhtml39
-rw-r--r--layout/reftests/css-visited/selector-descendant-2.xhtml39
-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/svg-paint-currentcolor-visited-ref.svg6
-rw-r--r--layout/reftests/css-visited/svg-paint-currentcolor-visited.svg16
-rw-r--r--layout/reftests/css-visited/transition-on-visited-ref.html13
-rw-r--r--layout/reftests/css-visited/transition-on-visited.html25
-rw-r--r--layout/reftests/css-visited/variables-visited-ref.html7
-rw-r--r--layout/reftests/css-visited/variables-visited.html12
-rw-r--r--layout/reftests/css-visited/visited-inherit-1-ref.html10
-rw-r--r--layout/reftests/css-visited/visited-inherit-1.html10
-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
89 files changed, 1289 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 0000000000..cbd7450ebb
--- /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 0000000000..38ba7e8af1
--- /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 0000000000..3730a300c9
--- /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 0000000000..de756dba15
--- /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 0000000000..9a97afcc5e
--- /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 0000000000..fea8ae14d1
--- /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 0000000000..b702c0184f
--- /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/caret-color-on-visited-1-ref.html b/layout/reftests/css-visited/caret-color-on-visited-1-ref.html
new file mode 100644
index 0000000000..23d8e0c244
--- /dev/null
+++ b/layout/reftests/css-visited/caret-color-on-visited-1-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<style>
+@font-face {
+ font-family: Ahem;
+ src: url(Ahem.ttf);
+}
+div {
+ font: 16px/1 Ahem;
+ width: 1em;
+ background: green;
+}
+</style>
+<div><span></span></div>
+<script>
+let $div = document.querySelector('div');
+let $span = document.querySelector('span');
+window.onload = function () {
+ document.fonts.ready.then(() => {
+ $div.style.height = $span.getBoundingClientRect().height + 'px';
+ });
+};
+</script>
diff --git a/layout/reftests/css-visited/caret-color-on-visited-1.html b/layout/reftests/css-visited/caret-color-on-visited-1.html
new file mode 100644
index 0000000000..92443cdf5d
--- /dev/null
+++ b/layout/reftests/css-visited/caret-color-on-visited-1.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<style>
+@font-face {
+ font-family: Ahem;
+ src: url(Ahem.ttf);
+}
+a {
+ caret-color: red;
+}
+a:visited {
+ caret-color: green;
+}
+textarea {
+ caret-color: inherit;
+ font: 16px/1 Ahem;
+ outline: none;
+ border: 0 none;
+ resize: none;
+ padding: 0;
+ margin: 0;
+}
+</style>
+<a href="visited-page.html"><textarea></textarea></a>
+<script>
+ document.querySelector('textarea').focus();
+</script>
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 0000000000..2a58c8e286
--- /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 0000000000..002c4fb648
--- /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 0000000000..0d91630dc2
--- /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 0000000000..6f04678b51
--- /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 0000000000..859cfb6dd7
--- /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 0000000000..425523f1f5
--- /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 0000000000..72e965f1c8
--- /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 0000000000..9bdc6fa8d8
--- /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 0000000000..029823d0e4
--- /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 0000000000..75fda1f759
--- /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 0000000000..1b7bc4b41e
--- /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 0000000000..4dc80d82a1
--- /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/color-on-visited-text-1-ref.html b/layout/reftests/css-visited/color-on-visited-text-1-ref.html
new file mode 100644
index 0000000000..b144767ce7
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-text-1-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+ .unvisited {
+ color: blue;
+ }
+ .visited {
+ color: purple;
+ }
+ .first-line {
+ color: green;
+ }
+</style>
+<div class="first-line">Visited</div>
+<div class="first-line">Visited with span</div>
+<div class="unvisited">Visited with inner unvisited</div>
+<div class="visited">Visited with inner visited</div>
diff --git a/layout/reftests/css-visited/color-on-visited-text-1.html b/layout/reftests/css-visited/color-on-visited-text-1.html
new file mode 100644
index 0000000000..101c9653dc
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-text-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+ a {
+ display: block;
+ text-decoration: none;
+ }
+ :link {
+ color: blue;
+ }
+ :visited {
+ color: purple;
+ }
+ .outer::first-line {
+ color: green;
+ }
+</style>
+<a class="outer" href="visited-page.html">Visited</a>
+<a class="outer" href="visited-page.html"><span>Visited with span</span></a>
+<a class="outer" href="visited-page.html"><a href="unvisited-page.html">Visited with inner unvisited</a></a>
+<a class="outer" href="visited-page.html"><a href="visited-page.html">Visited with inner visited</a></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 0000000000..bc99002fd9
--- /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; column-count: 2; }
+#link { column-rule: medium dotted blue; }
+#visited { 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 0000000000..fa999ff274
--- /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; column-count: 2; }
+#link { column-rule: medium dotted blue; }
+#visited { 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 0000000000..4400ea8b06
--- /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; column-count: 2; }
+:link { column-rule: medium dotted blue; }
+:visited { 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 0000000000..233407fbb5
--- /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 0000000000..a46017fdee
--- /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 0000000000..bea15972fa
--- /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 0000000000..66df0e1b9f
--- /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 0000000000..72664e0227
--- /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 0000000000..bcc1ab2e18
--- /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 0000000000..3c1ec0a9eb
--- /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 0000000000..7969685666
--- /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 0000000000..37aec8edc1
--- /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 0000000000..0b3d4ea4ba
--- /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 0000000000..abc08c51dd
--- /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 0000000000..577792b119
--- /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 0000000000..a22f854187
--- /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 = "visited-page.html";
+getComputedStyle(a, "").backgroundColor; // flush style
+document.documentElement.removeAttribute("class");
+
+]]>
+</script>
+</a>
diff --git a/layout/reftests/css-visited/logical-box-border-color-visited-link-001.html b/layout/reftests/css-visited/logical-box-border-color-visited-link-001.html
new file mode 100644
index 0000000000..9ffa91c368
--- /dev/null
+++ b/layout/reftests/css-visited/logical-box-border-color-visited-link-001.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Logical Properties: Flow-Relative Border Colors in Visited Links</title>
+<style>
+a {
+ display: inline-block;
+ vertical-align: top;
+ border: 25px solid red;
+}
+#link1, #link2:visited {
+ border-block-start-color: green;
+ border-block-end-color: green;
+ border-inline-start-color: green;
+ border-inline-end-color: green;
+}
+#link3 {
+ border-block-start: 25px solid green;
+ border-block-end: 25px solid green;
+ border-inline-start: 25px solid green;
+ border-inline-end: 25px solid green;
+}
+#link4:visited {
+ /* :visited should honor the border color but ignore other values in the shorthand */
+ border-block-start: 0 none green;
+ border-block-end: 0 none green;
+ border-inline-start: 0 none green;
+ border-inline-end: 0 none green;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<a id="link1" href="visited-page.html"></a><a id="link2" href="visited-page.html"></a><br>
+<a id="link3" href="visited-page.html"></a><a id="link4" href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/logical-box-border-color-visited-link-002.html b/layout/reftests/css-visited/logical-box-border-color-visited-link-002.html
new file mode 100644
index 0000000000..0ace612bab
--- /dev/null
+++ b/layout/reftests/css-visited/logical-box-border-color-visited-link-002.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Logical Properties: Flow-Relative Border Colors in Visited Links</title>
+<style>
+a {
+ display: inline-block;
+ vertical-align: top;
+ border: 25px solid red;
+}
+#link1, #link2:visited {
+ border-block-color: green;
+ border-inline-color: green;
+}
+#link3 {
+ border-block: 25px solid green;
+ border-inline: 25px solid green;
+}
+#link4:visited {
+ /* :visited should honor the border color but ignore other values in the shorthand */
+ border-block: 0 none green;
+ border-inline: 0 none green;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<a id="link1" href="visited-page.html"></a><a id="link2" href="visited-page.html"></a><br>
+<a id="link3" href="visited-page.html"></a><a id="link4" href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/logical-box-border-color-visited-link-003.html b/layout/reftests/css-visited/logical-box-border-color-visited-link-003.html
new file mode 100644
index 0000000000..46a031ad96
--- /dev/null
+++ b/layout/reftests/css-visited/logical-box-border-color-visited-link-003.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Logical Properties: Flow-Relative Border Colors in Visited Links</title>
+<style>
+a {
+ display: inline-block;
+ vertical-align: top;
+ border: 25px solid green;
+ border-top-color: red;
+ border-left-color: red;
+}
+#link1:visited,
+#link2,
+#link3:visited,
+#link4 {
+ direction: rtl;
+}
+#link1:visited,
+#link2:visited,
+#link3,
+#link4 {
+ writing-mode: vertical-rl;
+}
+#link1:visited {
+ border-block-start-color: green;
+ border-inline-start-color: green;
+}
+#link2:visited {
+ border-block-start-color: green;
+ border-inline-end-color: green;
+}
+#link3:visited {
+ border-inline-start-color: green;
+ border-block-end-color: green;
+}
+#link4:visited {
+ border-inline-end-color: green;
+ border-block-end-color: green;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<a id="link1" href="visited-page.html"></a><a id="link2" href="visited-page.html"></a><br>
+<a id="link3" href="visited-page.html"></a><a id="link4" href="visited-page.html"></a>
diff --git a/layout/reftests/css-visited/logical-box-border-color-visited-link-ref.html b/layout/reftests/css-visited/logical-box-border-color-visited-link-ref.html
new file mode 100644
index 0000000000..5858fe2e4e
--- /dev/null
+++ b/layout/reftests/css-visited/logical-box-border-color-visited-link-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<style>
+div {
+ background: green;
+ height: 100px;
+ width: 100px;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div></div>
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 0000000000..7919142fe1
--- /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 0000000000..eee49180e5
--- /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="visited-page.html" 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 0000000000..996a4c350e
--- /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 0000000000..d31cf4feb7
--- /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/placeholder-1-ref.html b/layout/reftests/css-visited/placeholder-1-ref.html
new file mode 100644
index 0000000000..5b88093ab7
--- /dev/null
+++ b/layout/reftests/css-visited/placeholder-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<style>
+ a:visited { color: green }
+ input { color: inherit }
+ input::placeholder { color: green }
+</style>
+<a href="visited-page.html"><input placeholder="This should be green"></a>
diff --git a/layout/reftests/css-visited/placeholder-1.html b/layout/reftests/css-visited/placeholder-1.html
new file mode 100644
index 0000000000..e349edb2c3
--- /dev/null
+++ b/layout/reftests/css-visited/placeholder-1.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<style>
+ a:visited { color: green }
+ input { color: inherit }
+</style>
+<a href="visited-page.html"><input placeholder="This should be green"></a>
diff --git a/layout/reftests/css-visited/reftest.list b/layout/reftests/css-visited/reftest.list
new file mode 100644
index 0000000000..62cfba7574
--- /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 0000000000..ba6ecca095
--- /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 0000000000..b5bb0d413e
--- /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 0000000000..a9f97dc9c5
--- /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 0000000000..0eee73c517
--- /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-adj-sibling-3-ref.xhtml b/layout/reftests/css-visited/selector-adj-sibling-3-ref.xhtml
new file mode 100644
index 0000000000..b3c12d35f6
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-3-ref.xhtml
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test reference for bug 1431539</title>
+<style>
+ a { text-decoration: none }
+ span { color: green }
+</style>
+</head>
+<body>
+<span>
+ <span>visited</span>
+ <span>Should be green</span>
+</span>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/selector-adj-sibling-3.xhtml b/layout/reftests/css-visited/selector-adj-sibling-3.xhtml
new file mode 100644
index 0000000000..38b2709270
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-3.xhtml
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test for bug 1431539</title>
+<style>
+ a { text-decoration: none }
+ :visited { color: green }
+ :-moz-any(:visited) + span {
+ color: red;
+ }
+</style>
+</head>
+<body>
+<a href="visited-page.html">
+ <a href="visited-page.html">visited</a>
+ <span>Should be green</span>
+</a>
+</body>
+</html>
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 0000000000..de502b684f
--- /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 0000000000..25f00c654e
--- /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 0000000000..e64a48729c
--- /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 0000000000..31ec00f4cc
--- /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 0000000000..2ed3bd25a8
--- /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 0000000000..bd56273e49
--- /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 0000000000..e56caa1ab4
--- /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 0000000000..35ebfb7b24
--- /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 0000000000..2ed3bd25a8
--- /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 0000000000..e7cedde31a
--- /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 0000000000..59d100f599
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2-ref.xhtml
@@ -0,0 +1,39 @@
+<!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>)
+<br/>
+
+<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>)
+<br/>
+
+<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>)
+<br/>
+
+<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 0000000000..d1ca877d8e
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2.xhtml
@@ -0,0 +1,39 @@
+<!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>
+<br/>
+
+<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>
+<br/>
+
+<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>
+<br/>
+
+<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 0000000000..2ed3bd25a8
--- /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 0000000000..b0279d9756
--- /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 0000000000..806f705783
--- /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 0000000000..e9bdd99887
--- /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 0000000000..c31caeb0f8
--- /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 0000000000..21a8a829c4
--- /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 0000000000..b7e07ecadd
--- /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/svg-paint-currentcolor-visited-ref.svg b/layout/reftests/css-visited/svg-paint-currentcolor-visited-ref.svg
new file mode 100644
index 0000000000..e42c1fd15b
--- /dev/null
+++ b/layout/reftests/css-visited/svg-paint-currentcolor-visited-ref.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <style>
+ rect { fill: green; stroke: green; stroke-width: 20px; }
+ </style>
+ <rect x="10" y="10" width="80" height="80"/>
+</svg>
diff --git a/layout/reftests/css-visited/svg-paint-currentcolor-visited.svg b/layout/reftests/css-visited/svg-paint-currentcolor-visited.svg
new file mode 100644
index 0000000000..6893c6107d
--- /dev/null
+++ b/layout/reftests/css-visited/svg-paint-currentcolor-visited.svg
@@ -0,0 +1,16 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <metadata>
+ <link xmlns="http://www.w3.org/1999/xhtml" rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"/>
+ <link xmlns="http://www.w3.org/1999/xhtml" rel="help" href="https://www.w3.org/TR/SVG2/pservers.html"/>
+ <link xmlns="http://www.w3.org/1999/xhtml" rel="match" href="currentcolor-visited-ref.svg"/>
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="assert" content="currentcolor should resolve against the visited-dependent value of the color property."/>
+ </metadata>
+
+ <style>
+ a:link { color: red; }
+ a:visited { color: green; }
+ rect { fill: currentcolor; stroke: currentcolor; stroke-width: 20px; }
+ </style>
+
+ <a href="visited-page.html"><rect x="10" y="10" width="80" height="80"/></a>
+</svg>
diff --git a/layout/reftests/css-visited/transition-on-visited-ref.html b/layout/reftests/css-visited/transition-on-visited-ref.html
new file mode 100644
index 0000000000..843f2c174f
--- /dev/null
+++ b/layout/reftests/css-visited/transition-on-visited-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span {
+ color: rgb(128, 0, 128);
+}
+</style>
+</head>
+<body>
+<span>Visited Link</span>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/transition-on-visited.html b/layout/reftests/css-visited/transition-on-visited.html
new file mode 100644
index 0000000000..cbf509ee57
--- /dev/null
+++ b/layout/reftests/css-visited/transition-on-visited.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1381235
+-->
+<head>
+<title>Test for Bug 1381235</title>
+<style>
+a {
+ text-decoration: none;
+ color: rgb(255, 0, 0);
+ transition: color 1000s steps(2, start);
+}
+</style>
+</head>
+<body onload="runTest()">
+<a id="link" href="visited-page.html">Visited Link</a>
+<script type="application/javascript">
+function runTest() {
+ var a = document.getElementById("link");
+ a.style.color = "rgb(0, 0, 255)";
+}
+</script>
+</body>
+</html>
diff --git a/layout/reftests/css-visited/variables-visited-ref.html b/layout/reftests/css-visited/variables-visited-ref.html
new file mode 100644
index 0000000000..bcd8706cd3
--- /dev/null
+++ b/layout/reftests/css-visited/variables-visited-ref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<style>
+ a {
+ color: green;
+ }
+</style>
+<a href="">Which color?</a>
diff --git a/layout/reftests/css-visited/variables-visited.html b/layout/reftests/css-visited/variables-visited.html
new file mode 100644
index 0000000000..ec7cf71e7a
--- /dev/null
+++ b/layout/reftests/css-visited/variables-visited.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<style>
+ a {
+ --foo: green;
+ }
+
+ :visited {
+ --foo: red;
+ color: var(--foo);
+ }
+</style>
+<a href="visited-page.html">Which color?</a>
diff --git a/layout/reftests/css-visited/visited-inherit-1-ref.html b/layout/reftests/css-visited/visited-inherit-1-ref.html
new file mode 100644
index 0000000000..4720e57eae
--- /dev/null
+++ b/layout/reftests/css-visited/visited-inherit-1-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+a { text-decoration: none; color: initial; display: block; margin: 2px; }
+.green { color: green; }
+</style>
+<a href="unvisited-page.html">
+ <div>
+ <span class="green">Should be green</span>
+ </div>
+</a>
diff --git a/layout/reftests/css-visited/visited-inherit-1.html b/layout/reftests/css-visited/visited-inherit-1.html
new file mode 100644
index 0000000000..cf53066d38
--- /dev/null
+++ b/layout/reftests/css-visited/visited-inherit-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+a { text-decoration: none; color: initial; display: block; margin: 2px; }
+.green { color: green; }
+</style>
+<a href="visited-page.html">
+ <div>
+ <span class="green">Should be green</span>
+ </div>
+</a>
diff --git a/layout/reftests/css-visited/visited-page.html b/layout/reftests/css-visited/visited-page.html
new file mode 100644
index 0000000000..45f19843ab
--- /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 0000000000..9ec44c5cd3
--- /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 0000000000..a9ac269574
--- /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 0000000000..b7b388b8ce
--- /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 0000000000..d05350dc17
--- /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 0000000000..b9b653f4ad
--- /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>