[webkit-changes] [WebKit/WebKit] f1278a: Use CompactContextMenuPresenter to show context me...

Wenson Hsieh noreply at github.com
Tue Nov 7 21:56:56 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f1278a15b8232ad9b2d90746f59f373a6ccbe576
      https://github.com/WebKit/WebKit/commit/f1278a15b8232ad9b2d90746f59f373a6ccbe576
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/CompactContextMenuPresenter.h
    M Source/WebKit/UIProcess/ios/CompactContextMenuPresenter.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm
    M Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm

  Log Message:
  -----------
  Use CompactContextMenuPresenter to show context menus for focused elements with datalist
https://bugs.webkit.org/show_bug.cgi?id=264038
rdar://117809656

Reviewed by Richard Robinson and Megan Gardner.

Deploy `CompactContextMenuPresenter` in `WKDataListSuggestionsDropdown`, to support compact context
menu presentation without relying on UIKit SPI. Note that this (in theory) means we no longer need
logic to manually specify preferred edge insets for the suggestions menu, since we now lay out the
hidden native `UIButton` over the bounds of the focused datalist element, which UIKit will
automatically avoid obscuring when presenting or updating the menu.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Remove SPI declarations that are no longer necessary.

* Source/WebKit/UIProcess/ios/CompactContextMenuPresenter.h:
* Source/WebKit/UIProcess/ios/CompactContextMenuPresenter.mm:
(WebKit::CompactContextMenuPresenter::updateVisibleMenu):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement:]):
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement]): Deleted.

Add support for an option to create a targeted context menu hint that's positioned against the left
or right edge of the input, provided there's sufficient space to fit the 250pt (by default) menu.
When the view is RTL, note that we'll prefer to position the menu at the the right edge of the
element, fall back to the left edge if there's not enough horizonal space, and finally fall back to
the element rect itself if there's no space on either side.

* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown _showSuggestions]):
(-[WKDataListSuggestionsDropdown _removeContextMenuInteraction]):
(-[WKDataListSuggestionsDropdown contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):
(-[WKDataListSuggestionsDropdown _preferredEdgeInsetsForSuggestionsMenu]): Deleted.
(-[WKDataListSuggestionsDropdown _contextMenuInteraction:styleForMenuWithConfiguration:]): Deleted.
* Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):

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




More information about the webkit-changes mailing list