Index: third_party/WebKit/LayoutTests/fast/css/add-non-blocking-sheet-recalc.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/add-non-blocking-sheet-recalc.html b/third_party/WebKit/LayoutTests/fast/css/add-non-blocking-sheet-recalc.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..14fab58ea7a463b3fc7ab25e00602e058a451648 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/add-non-blocking-sheet-recalc.html |
@@ -0,0 +1,28 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<link id="media-sheet" rel="stylesheet" media="(min-width: 5000px)"> |
+<link id="alternate-sheet" rel="alternate stylesheet" title="alternate"> |
+<script> |
+ var test = async_test("Check that adding a non-blocking stylesheet does not cause a full document recalc."); |
+ |
+ window.onload = () => { |
+ document.body.offsetTop; |
+ |
+ test.step(() => { |
+ assert_true(!!window.internals, "Test requires internals object for recalc count."); |
+ }); |
+ |
+ test.step(() => { |
+ document.querySelector("#media-sheet").href = "data:text/css,#x{color:pink}"; |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0, "No style recalc adding sheet without matching rules."); |
+ }); |
+ |
+ test.step(() => { |
+ document.querySelector("#alternate-sheet").href = "data:text/css,*{color:pink}"; |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0, "No style recalc adding alternate sheet."); |
+ }); |
+ |
+ test.done(); |
+ }; |
+</script> |