Skip to content

[visionOS] Add delegate method to prevent docking from element fullscreen. #46937

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

Conversation

rsfuller
Copy link
Contributor

@rsfuller rsfuller commented Jun 19, 2025

9338c51

[visionOS] Add delegate method to prevent docking from element fullscreen.
rdar://145799817
https://bugs.webkit.org/show_bug.cgi?id=294702

Reviewed by Alex Christensen.

Safari on visionOS would like to prevent docking from element fullscreen when the
browser is in a certain state (spatial browsing).

To accomplish this, add a new delegate method to FullscreenClient that gives the
client the option to preventDocking (only for LinearMediaPlayer).

WKFullScreenViewController checks this method, and if configured to prevent, removes
the environment picker button / prevents it being added.

* Source/WebKit/UIProcess/API/APIFullscreenClient.h:
(API::FullscreenClient::preventDocking):
* Source/WebKit/UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
* Source/WebKit/UIProcess/Cocoa/FullscreenClient.h:
* Source/WebKit/UIProcess/Cocoa/FullscreenClient.mm:
(WebKit::FullscreenClient::setDelegate):
(WebKit::FullscreenClient::preventDocking):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController configureEnvironmentPickerOrFullscreenVideoButtonView]):

Canonical link: https://commits.webkit.org/296597@main

2c4a51f

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@rsfuller rsfuller requested a review from cdumez as a code owner June 19, 2025 00:43
@rsfuller rsfuller self-assigned this Jun 19, 2025
@rsfuller rsfuller added the Media Bugs related to the HTML 5 Media elements. label Jun 19, 2025
@rsfuller rsfuller force-pushed the eng/visionOS-Add-delegate-method-to-prevent-docking-from-element-fullscreen branch from 0b7eab8 to 5583ae2 Compare June 19, 2025 00:51
@@ -57,6 +57,10 @@ class FullscreenClient {
#if PLATFORM(IOS_FAMILY)
virtual void requestPresentingViewController(CompletionHandler<void(UIViewController *, NSError *)>&&) { }
#endif

#if ENABLE(LINEAR_MEDIA_PLAYER)
virtual bool preventDocking(WebKit::WebPageProxy*) { return true; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this return true but the default value of FullscreenClient::preventDocking is false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! I flipped the naming from allow to prevent precisely because I wanted the default to be false not true, but forgot to update this when I made the change. Fixed!

@rsfuller rsfuller force-pushed the eng/visionOS-Add-delegate-method-to-prevent-docking-from-element-fullscreen branch from 5583ae2 to 2c4a51f Compare June 20, 2025 20:59
@amarchenko amarchenko added the merge-queue Applied to send a pull request to merge-queue label Jun 25, 2025
…reen.

rdar://145799817
https://bugs.webkit.org/show_bug.cgi?id=294702

Reviewed by Alex Christensen.

Safari on visionOS would like to prevent docking from element fullscreen when the
browser is in a certain state (spatial browsing).

To accomplish this, add a new delegate method to FullscreenClient that gives the
client the option to preventDocking (only for LinearMediaPlayer).

WKFullScreenViewController checks this method, and if configured to prevent, removes
the environment picker button / prevents it being added.

* Source/WebKit/UIProcess/API/APIFullscreenClient.h:
(API::FullscreenClient::preventDocking):
* Source/WebKit/UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
* Source/WebKit/UIProcess/Cocoa/FullscreenClient.h:
* Source/WebKit/UIProcess/Cocoa/FullscreenClient.mm:
(WebKit::FullscreenClient::setDelegate):
(WebKit::FullscreenClient::preventDocking):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController configureEnvironmentPickerOrFullscreenVideoButtonView]):

Canonical link: https://commits.webkit.org/296597@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/visionOS-Add-delegate-method-to-prevent-docking-from-element-fullscreen branch from 2c4a51f to 9338c51 Compare June 25, 2025 01:48
@webkit-commit-queue
Copy link
Collaborator

Committed 296597@main (9338c51): https://commits.webkit.org/296597@main

Reviewed commits have been landed. Closing PR #46937 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9338c51 into WebKit:main Jun 25, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Bugs related to the HTML 5 Media elements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants