Skip to content

Commit

Permalink
[pip] preferInitialWindowPlacement
Browse files Browse the repository at this point in the history
Add `preferInitialWindowPlacement` to DocumentPictureInPictureOptions
to provide a hint to the UA that the bounds of any previously opened
pip window probably shouldn't be re-used.

See WICG/document-picture-in-picture#119 and
https://chromestatus.com/feature/5183881532932096 for more details.

Change-Id: I3c3cf468046f4e08cbedbde93532e4b34e12a29a
Bug: 312495380
  • Loading branch information
liberato-at-chromium authored and chromium-wpt-export-bot committed Jul 17, 2024
1 parent b469a6e commit b05c599
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>Test that using documentPictureInPicture's preferInitialWindowPlacement
parameter does not cache the window bounds</title>
<body>
<p>
This tests that a document picture-in-picture window opened with the `preferInitialWindowPlacement`
parameter set to `true` does not cache the previous window bounds when it is closed and reopened.
<ol>
<li>Click on the "Open document picture-in-picture window" button below.</li>
<li>Note its approximate position and size.</li>
<li>Move and resize the window.</li>
<li>Close the window.</li>
<li>Click the "Open document picture-in-picture window" button again.</li>
<li>Check that it opens in its original position and size, not where you resized / moved it to.</li>
</ol>
</p>
<input type="button" id="btnOpenPip" value="Open document picture-in-picture window" />
<script>
const btnOpenPip = document.getElementById('btnOpenPip');
btnOpenPip.addEventListener('click', async () => {
const pipWindow = await documentPictureInPicture.requestWindow({ preferInitialWindowPlacement: true });
pipWindow.document.body.innerText = 'Move and resize this window!';
});
</script>
</body>

0 comments on commit b05c599

Please sign in to comment.