[webkit-changes] [WebKit/WebKit] c007fb: [visionOS] Add menu button to control scene dimmin...

Aditya Keerthi noreply at github.com
Mon Aug 14 18:32:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c007fbf1d5da3f2a2420cc40fe7689edcf9f2cd9
      https://github.com/WebKit/WebKit/commit/c007fbf1d5da3f2a2420cc40fe7689edcf9f2cd9
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/en.lproj/Localizable.strings
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm

  Log Message:
  -----------
  [visionOS] Add menu button to control scene dimming in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=260164
rdar://110675100

Reviewed by Wenson Hsieh.

In <video> fullscreen, "Auto Dimming" will be offered as an option alongside
the rest of the overflow controls menu. In element fullscreen, a new menu is
added to the top left to hold the new action.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Enable fullscreen scene dimming by default.

* Source/WebCore/en.lproj/Localizable.strings:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView fullScreenWindowSceneDimmingAction]):

Expose the action as a method on `WKWebView` so that the logic may be shared
between <video> and element fullscreen.

Use a `UIDeferredMenuElement` so that the action is initialized each time its
menu is presented, and the selected state is accurately reflected.

Use `UIMenuOptionsDisplayInline` in order to display a separator.

* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showMediaControlsContextMenu:items:completionHandler:]):

Augment media controls context menu logic to add support for actions that are
completely handled on the UI process side.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView additionalMediaControlsContextMenuItemsForActionSheetAssistant:]):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h:
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm:

Add `_WKExtrinsicButtonDelegate` in order to know if/when a button is presenting
a menu. If a menu is visible, the auto-hide logic needs to be prevented.

(-[_WKExtrinsicButton contextMenuInteraction:willDisplayMenuForConfiguration:animator:]):
(-[_WKExtrinsicButton contextMenuInteraction:willEndForConfiguration:animator:]):
(-[WKFullScreenViewController initWithWebView:]):
(-[WKFullScreenViewController hideUI]):
(-[WKFullScreenViewController videoControlsManagerDidChange]):
(-[WKFullScreenViewController loadView]):
(-[WKFullScreenViewController _createButtonWithExtrinsicContentSize:]):
(-[WKFullScreenViewController _wkExtrinsicButtonWillDisplayMenu:]):

Cancel auto-hide when a menu is presented.

(-[WKFullScreenViewController _wkExtrinsicButtonWillDismissMenu:]):

Auto-hide UI when the menu is dismissed, and playback is active.

(-[WKFullScreenViewController setSceneDimmed:]): Deleted.
(-[WKFullScreenViewController _toggleDimmingAction:]): Deleted.
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController prefersSceneDimming]):
(-[WKFullScreenWindowController _performSpatialFullScreenTransition:completionHandler:]):

Update logic to ensure dimming state is restored when exiting fullscreen, if the
preference is toggled while in fullscreen.

(-[WKFullScreenWindowController toggleSceneDimming]):
(-[WKFullScreenWindowController _prefersSceneDimming]): Deleted.
(-[WKFullScreenWindowController toggleDimming]): Deleted.

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




More information about the webkit-changes mailing list