Index: third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a8b5a53858eac0d234e8fa98e00edb8adb58c0bf |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html |
@@ -0,0 +1,36 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/js-test.js"></script> |
+<style> |
+ .b { color: red } |
+ .a + div .b { color: green } |
+</style> |
+<input type="text"></input> |
+<div> |
+ <span class="b">Should be green</span> |
+ <span></span> |
+ <span></span> |
+ <span></span> |
+</div> |
+<script> |
+ description("A reattach should not discard a scheduled sibling invalidation."); |
+ |
+ var input = document.querySelector("input"); |
+ |
+ shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color", "rgb(255, 0, 0)"); |
+ |
+ // Force clean style+layout |
+ input.offsetTop; |
+ |
+ // Schedule sibling invalidation set to invalidate span.b |
+ input.className = "a"; |
+ |
+ // Trigger lazyReattachIfAttached() -> detach(). |
+ document.querySelector("input").type = "button"; |
+ |
+ // The expected count will be 2 when ContainerNode::checkForChildrenAdjacentRuleChanges() |
+ // is removed. One for attaching the input, and one for the span.b recalc. |
+ if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); |
+ |
+ shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color", "rgb(0, 128, 0)"); |
+</script> |