Index: third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-mutation-min-direct.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-mutation-min-direct.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-mutation-min-direct.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ec5d1baa032a946f7eb048e69b7d238ec14c8979 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-mutation-min-direct.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<style> |
+ /* Dummy rule for increasing max-direct-adjacent */ |
+ .x + .x + .x + .x { color: red } |
+ |
+ span { color: green } |
+ .a + .d, .b + .c { color: red } |
+</style> |
+<div id="insertTest"> |
+ <span class="a"></span> |
+ <span class="b"></span> |
+ <span class="c"></span> |
+ <span class="d"></span> |
+</div> |
+<div id="removeTest"> |
+ <span class="a"></span> |
+ <span class="b"></span> |
+ <span class="c"></span> |
+ <span class="d"></span> |
+</div> |
+<script> |
+ test(() => |
+ assert_not_equals(window.internals, undefined, "Check that window.internals is defined.") |
+ , "window.internals required for tests."); |
+ |
+ test(() => { |
+ var c = insertTest.querySelector(".c"); |
+ assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .c is initially red."); |
+ |
+ insertTest.insertBefore(document.createElement("span"), c); |
+ |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Recalc for the inserted element and .c."); |
+ assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .c is green after insertion."); |
+ }, "Check that we don't invalidate too much on sibling insertion."); |
+ |
+ test(() => { |
+ var c = removeTest.querySelector(".c"); |
+ assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .c is initially red."); |
+ |
+ removeTest.querySelector(".b").remove(); |
+ |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Recalc for .c."); |
+ assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .c is green after .b is removed."); |
+ }, "Check that we don't invalidate too much on sibling removal."); |
+</script> |