Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html

Issue 2220873002: Add a fast-path for independent inherited properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added 2 more tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>
+
+
+
+

Powered by Google App Engine
This is Rietveld 408576698