OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src='../../resources/testharness.js'></script> |
| 3 <script src='../../resources/testharnessreport.js'></script> |
| 4 <script src='../resources/shadow-dom.js'></script> |
| 5 |
| 6 <div id='host'> |
| 7 <template data-mode='v0'> |
| 8 <content></content> |
| 9 </template> |
| 10 <div id='hostV1'> |
| 11 <template data-mode='open'> |
| 12 <div id='hostV1inV1'> |
| 13 <template data-mode='open'> |
| 14 <div id='hostV0inV1inV1'> |
| 15 <template data-mode='v0'> |
| 16 <canvas></canvas> |
| 17 </template> |
| 18 </div> |
| 19 </template> |
| 20 </div> |
| 21 </template> |
| 22 </div> |
| 23 </div> |
| 24 |
| 25 <script> |
| 26 async_test((test) => { |
| 27 document.onpointerlockerror = () => { |
| 28 assert_true(false, 'onpointerlockerror is not expected.'); |
| 29 test.done(); |
| 30 }; |
| 31 |
| 32 document.onpointerlockchange = () => { |
| 33 // Not interested in handling before or after exitPointerLock. |
| 34 if (document.pointerLockElement === null) |
| 35 return; |
| 36 |
| 37 assert_equals(document.pointerLockElement, canvas, 'if it is in V0 shado
w, return as it is.'); |
| 38 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 39 assert_equals(hostV1.shadowRoot.pointerLockElement, hostV1inV1) |
| 40 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, canvas); |
| 41 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null); |
| 42 |
| 43 document.exitPointerLock(); |
| 44 test.done(); |
| 45 }; |
| 46 |
| 47 convertTemplatesToShadowRootsWithin(host); |
| 48 var hostV1inV1 = hostV1.shadowRoot.querySelector('#hostV1inV1'); |
| 49 var hostV0inV1inV1 = hostV1inV1.shadowRoot.querySelector('#hostV0inV1inV1'); |
| 50 |
| 51 assert_equals(document.pointerLockElement, null); |
| 52 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 53 assert_equals(hostV1.shadowRoot.pointerLockElement, null); |
| 54 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, null); |
| 55 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null); |
| 56 |
| 57 var canvas = hostV0inV1inV1.shadowRoot.querySelector('canvas'); |
| 58 canvas.requestPointerLock(); |
| 59 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
| 60 </script> |
OLD | NEW |