Chromium Code Reviews| Index: LayoutTests/fast/css/invalidation/class-sibling-universal.html |
| diff --git a/LayoutTests/fast/css/invalidation/class-sibling-universal.html b/LayoutTests/fast/css/invalidation/class-sibling-universal.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..27226e80d48e7e8b6f71335cf3eb5896bead7b36 |
| --- /dev/null |
| +++ b/LayoutTests/fast/css/invalidation/class-sibling-universal.html |
| @@ -0,0 +1,96 @@ |
| +<!DOCTYPE html> |
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +<style> |
| +.t1 .sibling + *, |
| +.t2 .sibling ~ *, |
| +.t3 .sibling + :hover, |
| +.t4 + .sibling, |
|
chrishtr
2014/08/06 02:29:43
please add .t6 ~ .sibling also.
rune
2014/08/07 10:06:45
Done.
|
| +.t5 + * { background-color: rgb(0, 128, 0); } |
| + |
| +#r3 { width: 10px; height: 10px } |
| +</style> |
| +<div> |
| + <div id="t1"> |
| + <div class="sibling"></div> |
| + <div id="r1"></div> |
| + </div> |
| +</div> |
| +<div> |
| + <div id="t2"> |
| + <div class="sibling"></div> |
| + <div></div> |
| + <div id="r2"></div> |
| + </div> |
| +</div> |
| +<div> |
| + <div id="t3"> |
| + <div class="sibling"></div> |
| + <div id="r3"></div> |
| + </div> |
| +</div> |
| +<div> |
| + <div id="t4"></div> |
| + <div id="r4" class="sibling"> |
| + <div></div> |
| + <div></div> |
| + </div> |
| +</div> |
| +<div> |
| + <div id="t5"></div> |
| + <div id="r5"> |
| + <div></div> |
| + <div></div> |
| + </div> |
| +</div> |
| +<script> |
| +document.body.offsetTop; |
| + |
| +test(function() { |
| + assert_true(!!window.internals, "This test only works with internals exposed present"); |
| + assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent"); |
| + |
| + t1.className = "t1"; |
| + assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc"); |
| + assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change"); |
| +}, "Adjacent with universal selector"); |
| + |
| +test(function() { |
| + assert_true(!!window.internals, "This test only works with internals exposed present"); |
| + assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent"); |
| + |
| + t2.className = "t2"; |
| + assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc"); |
| + assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change"); |
| +}, "Indirect adjacent with universal selector"); |
| + |
| +test(function() { |
| + assert_true(!!window.internals, "This test only works with internals exposed present"); |
| + assert_true(!!window.eventSender, "This test only works with eventSender present"); |
| + |
| + eventSender.mouseMoveTo(r3.offsetLeft + 1, r3.offsetTop + 1); |
| + assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent"); |
| + |
| + t3.className = "t3"; |
| + assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc"); |
| + assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change"); |
| +}, "Adjacent with universal :hover selector"); |
| + |
| +test(function() { |
| + assert_true(!!window.internals, "This test only works with internals exposed present"); |
| + assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent"); |
| + |
| + t4.className = "t4"; |
| + assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc"); |
| + assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change"); |
| +}, "Class change affecting selector for sibling class"); |
| + |
| +test(function() { |
| + assert_true(!!window.internals, "This test only works with internals exposed present"); |
| + assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent"); |
| + |
| + t5.className = "t5"; |
| + assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc"); |
| + assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change"); |
| +}, "Class change affecting all sibling subtrees through a universal selector"); |
| +</script> |