Bug 1351339: Test. r?heycam
Written in a kind-of creative way, but I plan to upstream it to WPT, so this is
the best way I found to do it.
MozReview-Commit-ID: 3GBeZk3uq11
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-display/display-contents-state-change-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" name="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com">
+<style>
+div {
+ color: green;
+}
+</style>
+<div>
+ This text should be green, there should be no red border at any time.
+</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-display/display-contents-state-change.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS display: State changes are handled correctly for display: contents children</title>
+<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
+<link rel="author" name="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com">
+<link rel="match" href="display-contents-state-change-ref.html">
+<style>
+:focus-within .contents {
+ color: green;
+}
+.contents {
+ display: contents;
+ border: 10px solid red;
+ color: red;
+}
+input {
+ position: absolute;
+ left: -9999px;
+ top: -9999px;
+}
+</style>
+<div>
+ <input type="text">
+ <div class="contents">This text should be green, there should be no red border at any time.</div>
+</div>
+<script>
+onload = function() {
+ document.querySelector('input').focus();
+}
+</script>
--- a/layout/reftests/css-display/reftest.list
+++ b/layout/reftests/css-display/reftest.list
@@ -22,10 +22,11 @@ fuzzy-if(Android,7,1186) pref(dom.webcom
asserts(1) asserts-if(stylo,2) == display-contents-xbl-3.xul display-contents-xbl-3-ref.xul # bug 1089223
skip == display-contents-xbl-4.xul display-contents-xbl-4-ref.xul # fails (not just asserts) due to bug 1089223
asserts(0-1) fuzzy-if(Android,8,3216) == display-contents-fieldset.html display-contents-fieldset-ref.html # bug 1089223
asserts(1) asserts-if(stylo,2) == display-contents-xbl-5.xul display-contents-xbl-3-ref.xul # bug 1089223
== display-contents-list-item-child.html display-contents-list-item-child-ref.html
== display-contents-dyn-insert-text.html display-contents-dyn-insert-text-ref.html
== display-contents-writing-mode-1.html display-contents-writing-mode-1-ref.html
== display-contents-writing-mode-2.html display-contents-writing-mode-2-ref.html
+needs-focus == display-contents-state-change.html display-contents-state-change-ref.html
pref(layout.css.display-flow-root.enabled,true) == display-flow-root-001.html display-flow-root-001-ref.html
pref(layout.css.display-flow-root.enabled,false) fails-if(stylo) == display-flow-root-001.html display-flow-root-disabled-001-ref.html