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