Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[iOS] Refactor some logic around tap gesture handling when VKCImageAn…
…alysisInteraction is active https://bugs.webkit.org/show_bug.cgi?id=240891 rdar://93808100 Reviewed by Aditya Keerthi. Currently, when handling a single tap in WKContentView, we check whether or not the tap occurred over the Live Text button in the `VKCImageAnalysisInteraction`; if so, we manually toggle Live Text interaction highlight state. This special treatment exists (instead of simply relying on the UIButton's tap gesture) because `WKContentView` already has its own synthetic click gesture which conflicts with the UIButton's tap gesture; without this logic, taps on the analysis button would be completely ignored. While this works for the Live Text button, it doesn't work for other actionable buttons in the image analysis interaction. To address this, we install a `UIButtonConfigurationUpdateHandler` on the image analysis interaction just to collect the set of `UIButton`s that are owned by the interaction. When tapping on the content view, if we hit one of these VisionKitCore-owned buttons, then invoke the button action on its behalf. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapIdentified:]): Also, pull this VisionKit interception logic out into a new helper method below, named `-_handleTapOverImageAnalysisInteractionButton:`. This returns whether or not the tap was handled by VisionKit (in which case we avoid treating this as a synthetic click on the page). (-[WKContentView _handleTapOverImageAnalysisInteractionButton:]): (-[WKContentView installImageAnalysisInteraction:]): (-[WKContentView uninstallImageAnalysisInteraction]): Canonical link: https://commits.webkit.org/250968@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information