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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted-removed-shadow.html

Issue 2089063005: Schedule sibling invalidation sets for sibling insert/remove. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed minDirectAdjacent optimization. Created 4 years, 6 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/sibling-inserted-removed-shadow.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted-removed-shadow.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted-removed-shadow.html
new file mode 100644
index 0000000000000000000000000000000000000000..ff02f9bf6d96c487ae6c86ee97e87b94645dc259
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted-removed-shadow.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="host1"></div>
+<div id="host2"></div>
+<div id="host3"></div>
+<script>
+ var root1 = host1.createShadowRoot();
+ var root2 = host2.createShadowRoot();
+ var root3 = host3.createShadowRoot();
+
+ root1.innerHTML = `<style>#t1 + div + div + #r1 {background-color:green}</style>
+ <div id="t1"></div>
+ <div id="i1"></div>
+ <div id="r1"></div>
+ <div></div>`;
+
+ root2.innerHTML = `<style>#t2 + div + div + #r2 {background-color:green}</style>
+ <div id="i2"></div>
+ <div></div>
+ <div id="r2"></div>
+ <div></div>`;
+
+ root3.innerHTML = `<style>#t3 + div + div + #r3 {background-color:green}</style>
+ <div id="t3"></div>
+ <div></div>
+ <div id="d3"></div>
+ <div></div>
+ <div id="r3"></div>
+ <div></div>`;
+
+ document.body.offsetTop;
+
+ test(function() {
+ assert_true(!!window.internals, "This test only works with internals exposed present");
+ }, "internals are exposed");
+
+ test(function() {
+ var i1 = root1.querySelector('#i1');
+ var r1 = root1.querySelector('#r1');
+ assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
+
+ i1.parentNode.insertBefore(document.createElement('div'), i1);
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Inserted div plus #r1 recalculated");
+ assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
+ }, "Insert between siblings");
+
+ test(function() {
+ var i2 = root2.querySelector('#i2');
+ var r2 = root2.querySelector('#r2');
+ assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
+
+ var t2 = document.createElement('div');
+ t2.id = 't2';
+ i2.parentNode.insertBefore(t2, i2);
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Inserted div plus #r2 recalculated");
+ assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
+ }, "Insert before siblings");
+
+ test(function() {
+ var d3 = root3.querySelector('#d3');
+ var r3 = root3.querySelector('#r3');
+
+ d3.parentNode.removeChild(d3);
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "#r3 recalculated");
+ assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
+ }, "Remove between siblings");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698