| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title> |
| Forced colors mode - inactive selection. |
| </title> |
| <link rel="help" href="https://www.w3.org/TR/css-color-adjust-1/#forced-colors-properties"> |
| <link rel=match href="forced-colors-mode-15-expected.html"> |
| <style> |
| br::selection:window-inactive { |
| background-color: transparent; |
| forced-color-adjust: none; |
| } |
| span { |
| /* inline-block to ensure the selection bounding rectangle matches that of the |
| span. This allows us to test selection using a reference test. */ |
| display: inline-block; |
| } |
| .select::selection:window-inactive { |
| background-color: rgba(255, 0, 0, 0.99); /* alpha < 1 so that we don't blend the background color with white. */ |
| color: blue; |
| } |
| #adjust-none::selection:window-inactive { |
| forced-color-adjust: none; |
| } |
| </style> |
| <body> |
| <span class="select">AAA</span> |
| <br> |
| <span class="select" id="adjust-none">AAA</span> |
| </body> |
| |
| <script> |
| function runTest() { |
| var node1 = document.getElementsByClassName('select')[0].firstChild; |
| var node2 = document.getElementsByClassName('select')[1].firstChild; |
| var range = document.createRange(); |
| range.setStart(node1, 0); |
| range.setEnd(node2, node2.length); |
| window.getSelection().addRange(range); |
| if (window.testRunner) { |
| testRunner.setWindowFocus(false); |
| setTimeout(function() { testRunner.notifyDone(); }, 0); |
| } |
| } |
| |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| // Add some delay to avoid the initial focus event. |
| setTimeout(runTest, 100); |
| } |
| </script> |