Index: third_party/WebKit/LayoutTests/css-display-3/display-contents-acid-dynamic-1.html |
diff --git a/third_party/WebKit/LayoutTests/css-display-3/display-contents-acid-dynamic-1.html b/third_party/WebKit/LayoutTests/css-display-3/display-contents-acid-dynamic-1.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9f960c23c6cf7b53b32a83cbe5777bc72b56b97 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/css-display-3/display-contents-acid-dynamic-1.html |
@@ -0,0 +1,58 @@ |
+<!doctype html> |
+<meta charset="utf-8"> |
+<title>Dynamic changes between display: contents and display: none are handled correctly</title> |
+<link rel="help" href="https://drafts.csswg.org/css-display/#box-generation"> |
+<link rel="author" href="mailto:ecobos@igalia.com" title="Emilio Cobos Álvarez"> |
+<style> |
+html, body { |
+ padding: 0; |
+ margin: 0; |
+} |
+iframe { |
+ border: 0; |
+ width: 100%; |
+} |
+</style> |
+<iframe seamless src="resources/display-contents-acid.html"></iframe> |
+<script> |
+var getRandomDisplayValue = function() { |
+ var DISPLAY_VALUES = [ |
+ "none", |
+ "block", |
+ "inline", |
+ "inline-block", |
+ "flex", |
+ "inline-flex", |
+ "table", |
+ "table-column-group", |
+ "grid", |
+ "inline-grid", |
+ "contents", |
+ ]; |
+ |
+ return DISPLAY_VALUES[Math.floor(Math.random() * DISPLAY_VALUES.length)]; |
+} |
+ |
+document.querySelector('iframe').addEventListener('load', function() { |
+ var document = this.contentDocument; |
+ var window = this.contentWindow; |
+ var elements = []; |
+ |
+ document.body.offsetHeight; |
+ |
+ // NOTE: Doing qsa('*') and getComputedStyle is just for the test's |
+ // shake, since it's easier to mess it up when getComputedStyle is involved. |
+ var all = document.querySelectorAll('*'); |
+ for (var i = 0; i < all.length; ++i) { |
+ if (window.getComputedStyle(all[i]).display === "contents") { |
+ all[i].style.display = getRandomDisplayValue(); |
+ elements.push(all[i]); |
+ } |
+ } |
+ |
+ document.body.offsetHeight; |
+ |
+ for (var i = 0; i < elements.length; ++i) |
+ elements[i].style.display = 'contents'; |
+}); |
+</script> |