Skip to content

Commit

Permalink
Bug 1908394 [wpt PR 47178] - [pip] preferInitialWindowPlacement, a=te…
Browse files Browse the repository at this point in the history
…stonly

Automatic update from web-platform-tests
[pip] preferInitialWindowPlacement

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
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5608743
Reviewed-by: Philip Rogers <[email protected]>
Commit-Queue: Frank Liberato <[email protected]>
Reviewed-by: Tommy Steimel <[email protected]>
Auto-Submit: Frank Liberato <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1328934}

--

wpt-commits: e8d28702c3fdb25e0e049f60a258b56bdce673ea
wpt-pr: 47178
  • Loading branch information
liberato-at-chromium authored and moz-wptsync-bot committed Jul 19, 2024
1 parent 5188511 commit dac201d
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 dac201d

Please sign in to comment.