Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: da7c22be146a7336b4e42e4ff40bae5df7064cc0
https://github.com/WebKit/WebKit/commit/da7c22be146a7336b4e42e4ff40bae5df7064cc0
Author: Wenson Hsieh <[email protected]>
Date: 2023-09-28 (Thu, 28 Sep 2023)
Changed paths:
M Source/WTF/wtf/PlatformHave.h
M Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISoftLink.h
M Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISoftLink.mm
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.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/WKFileUploadPanel.mm
M Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm
Log Message:
-----------
Stop using `-_contextMenuInteraction:styleForMenuWithConfiguration:` in
WKContentView
https://bugs.webkit.org/show_bug.cgi?id=262312
Reviewed by Aditya Keerthi.
Work towards refactoring `UIContextMenuInteraction` support on iOS to stop
relying on SPI. To
accomplish this, we first remove the
`-_contextMenuInteraction:styleForMenuWithConfiguration:` SPI
delegate method implementation from `WKContentView`, which puts us in a
position where all of the
context menu interactions in WebKit either use compact layout (e.g. form
controls) or non-compact
layout (i.e. the web view's context menu interaction) consistently.
In a subsequent patch, we'll take advantage of this refactoring to refactor all
compact-layout menus
in WebKit to present their menus from a hidden `UIControl` subclass, which in
turn allows us to
remove our dependency on `_UIContextMenuStyle` and related SPIs altogether.
See below for more details.
* Source/WTF/wtf/PlatformHave.h:
Remove a compile-time flag that's now unnecessary.
* Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISoftLink.h:
* Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISoftLink.mm:
Add a DDUI string constant.
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):
(-[WKActionSheetAssistant
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
Deleted.
Drive-by fix: remove dead codepaths guarded by
`!HAVE(UI_CONTEXT_MENU_PREVIEW_ITEM_IDENTIFIER)`.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dataDetectionContextForPositionInformation:]):
(-[WKContentView
_contextMenuInteraction:configurationForMenuAtLocation:completion:]):
(-[WKContentView continueContextMenuInteraction:]):
(-[WKContentView
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):
(-[WKContentView
contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:]):
(-[WKContentView
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
Deleted.
(-[WKContentView
contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
Deleted.
(-[WKContentView _contextMenuInteraction:styleForMenuWithConfiguration:]):
Deleted.
Stop using this delegate method altogether. There are two reasons we adopted it
in the first place:
1. In the case where `-[DDContextMenuConfiguration prefersActionMenuStyle]` is
set, we set the
style's preferred layout to `_UIContextMenuLayoutActionsOnly`. In my
testing in both Safari,
Mail and (HTML) Notes, this codepath is only taken for data-detected phone
numbers, where the
behavior upon showing and tapping on the preview view controller is the
same.
Since this was originally adopted to address instances of rdar://53728250
in Safari, it's likely
that the preview view controller UI either changed to avoid this problem
(i.e. showing a view
controller with the phone number in large text, instead of a
non-interactable preview), or a
bug was introduced in UIKit or DataDetectorsUI. In either case, it seems
safe to remove this
code from WebKit without introducing any behavior change; in the case where
we need to address
this bug in the future, we can instead add the `-prefersActionMenuStyle`
check in UIKit when
`_UIContextMenuLayoutAutomatic` is set, rather than dealing with it in the
client layer.
2. In the case where either advanced privacy protections are enabled or we're
in an ephemeral
session, we force compact layout to prevent the preview from showing up.
Rather than specify the
menu style, we can instead set `kDDContextMenuWantsPreviewKey` to `NO` in
the context dictionary
when creating the menu configuration.
* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):
(-[WKDataListSuggestionsDropdown
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
Deleted.
* Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:
* Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]):
(-[WKSelectPicker
contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
Deleted.
Canonical link: https://commits.webkit.org/268616@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes