[webkit-changes] [WebKit/WebKit] 6e1c1a: REGRESSION (272869 at main): Actions for QR codes som...
Wenson Hsieh
noreply at github.com
Wed Feb 7 10:18:28 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6e1c1a40d3481d2c8207408e85fc4ccf6ad9ad72
https://github.com/WebKit/WebKit/commit/6e1c1a40d3481d2c8207408e85fc4ccf6ad9ad72
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-02-07 (Wed, 07 Feb 2024)
Changed paths:
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Log Message:
-----------
REGRESSION (272869 at main): Actions for QR codes sometimes fail to show up when long pressing
https://bugs.webkit.org/show_bug.cgi?id=268889
rdar://122433291
Reviewed by Megan Gardner.
Fix several issues in the dynamically-inserted image analysis menu item codepath below, following
the changes in 272869 at main; importantly, this allows long-pressing ESIM and EID QR codes to show
"Add eSIM" menu items by default in WebKit apps, such as Mail. See below for more details:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _insertDynamicImageAnalysisContextMenuItemsIfPossible]):
1. Stop looking for the "Look Up" placeholder item. Prior to 272869 at main, this hidden item was
immediately inserted into the menu if image analysis results were not available upon long press,
and only replaced with the final image analysis menu items in the case where the client didn't
explicitly remove the Look Up item (`_WKElementActionTypeRevealImage`). However, the "Look Up"
item may now be added immediately (in disabled state), which replaces the placeholder item and
causes us to return early from `-_insertDynamicImageAnalysisContextMenuItemsIfPossible` due to
not having a placeholder to replace, even if there are MRC menu items that need to be added.
Fix this by changing the `indexOfPlaceholderItem` to a single boolean flag, always inserting the
dynamic items at the end of the menu, and leave out the check for the `.hidden` menu item
attribute, so that we'll only withhold the MRC items in the case where the client explicitly
removed the "Look Up" item (which matches existing behavior).
2. In a similar vein, it no longer makes sense to key the enablement of "Look Up" / "Copy Subject"
off of whether or not the placeholder item exists, since the disabled menu item is already
present; as such, we should remove this early return entirely and always enable these disabled
items if necessary.
3. Lastly, only attempt to dynamically add the "Show Text" action in the case where "Show Text"
wasn't already in the menu, to prevent the "Show Text" action from unnecessarily moving within
the menu in the case where OCR finishes quickly for an image with results.
Canonical link: https://commits.webkit.org/274222@main
More information about the webkit-changes
mailing list