| <!doctype HTML> |
| |
| <!-- |
| Runs an acquireDisplayLock on an element that doesn't have containment. |
| The callback adds containment. |
| --> |
| |
| <style> |
| .contained { |
| contain: content; |
| width: 100px; |
| height: 100px; |
| background: lightblue; |
| } |
| </style> |
| <div id="log"></div> |
| |
| <script> |
| if (window.testRunner) |
| window.testRunner.waitUntilDone(); |
| |
| function addContainment(context) { |
| context.lockedElement.classList = "contained"; |
| } |
| |
| function finishTest(status_string) { |
| if (document.getElementById("log").innerHTML === "") |
| document.getElementById("log").innerHTML = status_string; |
| if (window.testRunner) |
| window.testRunner.notifyDone(); |
| } |
| |
| function acquire() { |
| let container = document.createElement("div"); |
| container.acquireDisplayLock(addContainment).then( |
| () => { finishTest("PASS"); }, |
| () => { finishTest("FAIL"); }); |
| document.body.appendChild(container); |
| } |
| |
| window.onload = acquire; |
| </script> |
| |