Index: third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..31894d12a1810a71364f4c8eb687b9853b105032 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html |
@@ -0,0 +1,63 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<div id="host"> |
+ <div id="c1"> |
+ <!-- To ensure the fast path is working, add children and check their styles don't recalc. --> |
+ <div></div><div></div><div></div><div></div><div></div><div></div> |
+ </div> |
+ <div id="c2"></div> |
+ <div id="c3"></div> |
+</div> |
+<script> |
+// The aim of this test is to expose a bug in the independent inheritance fast |
+// path when using slotting with shadow trees, since we traverse the DOM in |
+// tree-of-trees order, but inheritance happens in flat-tree order. |
+// |
+// The final tree-of-trees for this test will look like: |
+// |
+// <div id="host"> |
+// <:shadow-root> |
+// <span> |
+// <slot></slot> |
+// </span> |
+// </:shadow-root> |
+// <div id="c1"></div> |
+// <div id="c2"></div> |
+// </div> |
+// |
+// Which means the final flat tree after slotting will look like: |
+// |
+// <div id="host"> |
+// <span> |
+// <div id="c1"></div> |
+// <div id="c2"></div> |
+// </span> |
+// </div> |
+// |
+// This test passes if changes in the span element propagate correctly to the |
+// slotted child divs. |
+test(function(t) |
+{ |
+ var shadow_root = host.attachShadow({mode: 'closed'}); |
+ var span = document.createElement("span"); |
+ span.appendChild(document.createElement("slot")); |
+ shadow_root.appendChild(span); |
+ |
+ assert_equals(getComputedStyle(c1).pointerEvents, "auto"); |
+ assert_equals(getComputedStyle(c2).pointerEvents, "auto"); |
+ |
+ host.scrollTop; // Force recalc. |
+ span.style.pointerEvents = "none"; |
+ // Only 4 elements should update: the span and the 3 child divs |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4); |
+ |
+ assert_equals(getComputedStyle(c1).pointerEvents, "none"); |
+ assert_equals(getComputedStyle(c2).pointerEvents, "none"); |
+ |
+}, "Changing pointerEvents, an independent inherited property, propagates correctly through slotted elements."); |
+</script> |
+ |
+ |
+ |
+ |