| <!doctype HTML> |
| |
| <!-- |
| Runs an acquire, then tries to scroll a locked subtree element into view using anchor link navigation. |
| --> |
| |
| <style> |
| .spacer { |
| width: 150px; |
| height: 3000px; |
| background: lightblue; |
| } |
| #container { |
| contain: style layout; |
| width: 150px; |
| height: 150px; |
| background: lightgreen; |
| } |
| #target { |
| width: 100px; |
| height: 100px; |
| background: green; |
| } |
| </style> |
| |
| <div class="spacer"></div> |
| <div id="container"><div id="target"></div></div> |
| |
| <script> |
| // TODO(vmpstr): In WPT this needs to be replaced with reftest-wait. |
| if (window.testRunner) |
| window.testRunner.waitUntilDone(); |
| |
| function finishTest() { |
| if (window.testRunner) |
| window.testRunner.notifyDone(); |
| } |
| |
| function runTest() { |
| let container = document.getElementById("container"); |
| container.displayLock.acquire({ timeout: Infinity }).then(() => { |
| location.href += "#target"; |
| requestAnimationFrame(finishTest); |
| }); |
| } |
| |
| window.onload = () => { requestAnimationFrame(runTest); }; |
| </script> |