Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disallowPositionReuse #119

Merged
merged 11 commits into from
Aug 19, 2024

Conversation

liberato-at-chromium
Copy link
Contributor

A UA is free to select a position and size for a document PiP window that does not conform to the size requested by the site with requestWindow(). A typical use is to allow user resizes to take precedence if a PiP window is closed and reopened later by the same site, so that the user's preference takes precedence.

This change adds the disallowPositionReuse flag to notify the user agent that this PiP window is semantically unrelated to the previous one, so ignoring the most recent user-selected size might be more appropriate, as if this were the first PiP window opened by the site.

Copy link
Collaborator

@steimelchrome steimelchrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be useful to include a note after steps 12 and 13 of the requestWindow(options) method steps, saying something along the lines of "if the website says disallowPositionReuse, then you might want to not do that"

spec.bs Outdated Show resolved Hide resolved
@liberato-at-chromium
Copy link
Contributor Author

I think it could be useful to include a note after steps 12 and 13 of the requestWindow(options) method steps, saying something along the lines of "if the website says disallowPositionReuse, then you might want to not do that"

+1 to adding a note. However, 12 and 13 don't mention bounds caching at all. i'll add some text that disallowPositionReuse may be considered as part of this decision, but it's hard to be more specific without bigger changes to 12,13. please let me know if you'd like me to try making those bigger changes.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
Copy link
Contributor

@beaufortfrancois beaufortfrancois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: https://wicg.github.io/document-picture-in-picture/ spec is still showing allowReturnToOpener, not disallowReturnToOpener. @steimelchrome I assume https://github.com/WICG/document-picture-in-picture/actions/runs/8284843825/job/22671289688 is the culprit one. Can you fix it?

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@steimelchrome
Copy link
Collaborator

Note: https://wicg.github.io/document-picture-in-picture/ spec is still showing allowReturnToOpener, not disallowReturnToOpener. @steimelchrome I assume https://github.com/WICG/document-picture-in-picture/actions/runs/8284843825/job/22671289688 is the culprit one. Can you fix it?

Good catch. I re-ran the failed job and it should be fixed now

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@eladalon1983
Copy link

eladalon1983 commented Apr 29, 2024

nit: Please consider if rephrasing in the positive might be clearer. For example, usePreviousWindowBounds, defaulting to true. Or possibly preferPreviousWindowBounds, indicating to the Web developer both that it's a hint the UA could ignore, as well as that things might have changed in the meantime to the point of inability to accommodate (e.g. change of screens and/or resolution).

@beaufortfrancois
Copy link
Contributor

nit: Please consider if rephrasing in the positive might be clearer. For example, usePreviousWindowBounds, defaulting to true. Or possibly preferPreviousWindowBounds, indicating to the Web developer both that it's a hint the UA could ignore, as well as that things might have changed in the meantime to the point of inability to accommodate (e.g. change of screens and/or resolution).

Defaulting to true was avoided on purpose. See #115 (comment)

@eladalon1983
Copy link

Defaulting to true was avoided on purpose.

Would using an enum be a valid way of sidestepping that?
windowBoundsPreference set to either "previous" or "new" perhaps?

@liberato-at-chromium
Copy link
Contributor Author

Would using an enum be a valid way of sidestepping that?

An enum would let us specify a default value, but it feels like cheating a bit if it's just a boolean in disguise. I don't know if we ever plan to have multiple options for this. windowPlacementStrategy = { preferInitial, preferMostRecent }?

indicating to the Web developer both that it's a hint the UA could ignore

I agree that the original name disallow... was a little too strong for a hint. ignore... might also suffer from this. prefer is a lot clearer in this regard, in my opinion. I wouldn't mind naming this with something that starts with prefer.

@eladalon1983
Copy link

eladalon1983 commented Apr 29, 2024

but it feels like cheating a bit if it's just a boolean in disguise

If the guidance were against booleans in an of themselves, yes, that'd have been cheating. But since the problem stated was with auto-conversion of undefined to false rather than to true, I think an enum would be fine. Wdyt?

@liberato-at-chromium
Copy link
Contributor Author

i'm fairly new at spec-land, so i'll not have too strong an opinion on booleans vs enums.

If we go the enum route, windowPlacementStrategy sgtm.

If we stay with the boolean, maybe preferInitialWindowPlacement in place of ignorePreviousWindowBounds given that it's more clearly a hint than a requirement.

@beaufortfrancois @steimelchrome WDYT?

@eladalon1983
Copy link

If precedents are useful, btw, here is a case where we have four enums (as of the time of writing) that are all just "include"/"exclude" - so basically an enum.

@liberato-at-chromium
Copy link
Contributor Author

After some thought, i decided to go with boolean preferInitialWindowPlacement. Keeps false as the default.

I considered an enum, but couldn't come up with a case where we'd want more than two options (640k is enough!), and prefer... seemed pretty natural.

As an aside, I expect that we'll have another option to describe how initial window placement should work ("upper left"), so "prefer initial" as a boolean fits pretty well into that.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 17, 2024
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
aarongable pushed a commit to chromium/chromium that referenced this pull request Jul 17, 2024
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 17, 2024
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 17, 2024
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}
sadym-chromium pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 18, 2024
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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 19, 2024
…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
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jul 19, 2024
…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
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jul 20, 2024
…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
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 22, 2024
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}
spec.bs Outdated Show resolved Hide resolved
@steimelchrome steimelchrome merged commit 0087f9c into WICG:main Aug 19, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants