Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / clear-activechain-list-shadow-dom.html
blobb3b056835c2942d9fbec5a588dc7e88541e17a02
1 <!DOCTYPE html>
2 <style>
3 div {
4 background-color: #00ffff;
5 width: 100px;
6 height: 100px;
8 span:active {
9 display: none;
11 </style>
13 <div>
14 <div id='host'>
15 <span>Click Me</span>
16 </div>
17 </div>
19 <pre id='description'></pre>
20 <pre id='console'></pre>
22 <script src='../../resources/js-test.js'></script>
24 <script>
25 var root = document.getElementById('host').createShadowRoot();
26 root.innerHTML =
27 '<style> div {background-color: #00ff00;}div:active {background-color: #ff0000;}</style><div id=shadowdom style="width: 100px; height: 100px"><content></content></div>'
29 function shouldHaveBackground(element, bg) {
30 background = getComputedStyle(element, null).getPropertyValue('background-color');
31 shouldBeEqualToString('background', bg);
34 description('Chain of active elements should be cleared including the Shadow DOM elements');
36 if (window.testRunner) {
37 var shadow = root.querySelector('#shadowdom');
39 eventSender.dragMode = false;
40 // This mouse click seems to be required for WebKit's event handling to
41 // pick up the :hover class. See https://bugs.webkit.org/show_bug.cgi?id=74264
42 eventSender.mouseDown();
43 eventSender.mouseUp();
45 var span = document.querySelector('span');
46 var spanRect = span.getBoundingClientRect();
47 // Mouse over the span.
48 eventSender.mouseMoveTo(spanRect.left + 5, spanRect.top + 5);
49 shouldHaveBackground(shadow, 'rgb(0, 255, 0)');
50 eventSender.mouseDown();
51 shouldHaveBackground(shadow, 'rgb(255, 0, 0)');
52 eventSender.mouseUp();
53 shouldHaveBackground(shadow, 'rgb(0, 255, 0)');
55 </script>