WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-239391-20220415142343.patch (text/plain), 6.68 KB, created by
Wenson Hsieh
on 2022-04-15 14:23:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2022-04-15 14:23:44 PDT
Size:
6.68 KB
patch
obsolete
>Subversion Revision: 292898 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ec0eb243ea3455485054e59c6cb981156ef5cd96..9338aaf2d1742adcf9ce4605fbf05b695ebf8906 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2022-04-15 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add a helper function to perform additional setup on VKCImageAnalysis(Interaction|OverlayView) >+ https://bugs.webkit.org/show_bug.cgi?id=239391 >+ rdar://91466567 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a helper function to ImageAnalysisUtilities, and call it on both iOS (WKContentView) and macOS >+ (WebViewImpl). >+ >+ * Platform/cocoa/ImageAnalysisUtilities.h: >+ * UIProcess/Cocoa/WebViewImpl.mm: >+ (WebKit::WebViewImpl::installImageAnalysisOverlayView): >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _singleTapIdentified:]): >+ (-[WKContentView installImageAnalysisInteraction:]): >+ (-[WKContentView imageAnalysisInteraction:shouldBeginAtPoint:forAnalysisType:]): >+ >+ Add support for toggling the Live Text overlay when tapping on the image analysis button owned by the >+ interaction. This custom handling is necessary, since the synthetic tap gesture recognizer does not recognize >+ simultaneously alongside the tap gesture for VisionKit's UIButton, and we can't (easily) grab VisionKit's >+ button's tap gesture to add failure requirements to our synthetic tap gesture. >+ > 2022-04-14 Wenson Hsieh <wenson_hsieh@apple.com> > > Undo option after invoking "Markup Image" says "Undo Paste" >diff --git a/Source/WebKit/Platform/cocoa/ImageAnalysisUtilities.h b/Source/WebKit/Platform/cocoa/ImageAnalysisUtilities.h >index de745b5f1a6b972f696b30fc3d82b8b322c61e9e..795fc2cabffa40b6502e4d1914ba18f09f1b33fd 100644 >--- a/Source/WebKit/Platform/cocoa/ImageAnalysisUtilities.h >+++ b/Source/WebKit/Platform/cocoa/ImageAnalysisUtilities.h >@@ -60,7 +60,14 @@ RetainPtr<CocoaImageAnalyzerRequest> createImageAnalyzerRequest(CGImageRef, VKAn > #if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS) > void requestImageAnalysisWithIdentifier(CocoaImageAnalyzer *, const String& identifier, CGImageRef, CompletionHandler<void(WebCore::TextRecognitionResult&&)>&&); > void requestImageAnalysisMarkup(CGImageRef, CompletionHandler<void(CGImageRef, CGRect)>&&); >+ >+#if PLATFORM(IOS_FAMILY) >+using PlatformImageAnalysisObject = VKCImageAnalysisInteraction; >+#else >+using PlatformImageAnalysisObject = VKCImageAnalysisOverlayView; > #endif >+void setUpAdditionalImageAnalysisBehaviors(PlatformImageAnalysisObject *); >+#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS) > > } > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 015a66840dbc8788bd34d79fd7c3bbe59ced1742..7e4e9d603ffe179dfada1fe6fd585f0cdc23e244 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -5938,6 +5938,7 @@ void WebViewImpl::installImageAnalysisOverlayView(VKCImageAnalysis *analysis) > [m_imageAnalysisOverlayView setDelegate:m_imageAnalysisOverlayViewDelegate.get()]; > [m_imageAnalysisOverlayView setActiveInteractionTypes:VKImageAnalysisInteractionTypeTextSelection | VKImageAnalysisInteractionTypeDataDetectors]; > [m_imageAnalysisOverlayView setWantsAutomaticContentsRectCalculation:NO]; >+ setUpAdditionalImageAnalysisBehaviors(m_imageAnalysisOverlayView.get()); > } > > [m_imageAnalysisOverlayView setAnalysis:analysis]; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 616d2918e9a2d08f3fb2a91dfe00c03e4dafaf6f..28836ceff5a7473a1dbb0daf96a1652db6c08fc9 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -3273,6 +3273,19 @@ - (void)_endPotentialTapAndEnableDoubleTapGesturesIfNecessary > > - (void)_singleTapIdentified:(UITapGestureRecognizer *)gestureRecognizer > { >+ auto position = [self _locationForGesture:gestureRecognizer]; >+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS) >+ if (UIButton *analysisButton = [_imageAnalysisInteraction analysisButton]) { >+ auto hitTestedView = dynamic_objc_cast<UIButton>([self hitTest:position withEvent:nil]); >+ // FIXME: Instead of a class check, this should be a straightforward equality check. >+ // However, rdar://91828384 currently prevents us from doing so. We can simplify this logic >+ // once the fix for that bug has landed. >+ if (hitTestedView.class == analysisButton.class) >+ [_imageAnalysisInteraction setHighlightSelectableItems:![_imageAnalysisInteraction highlightSelectableItems]]; >+ return; >+ } >+#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS) >+ > ASSERT(gestureRecognizer == _singleTapGestureRecognizer); > ASSERT(!_potentialTapInProgress); > [self _resetIsDoubleTapPending]; >@@ -3289,7 +3302,7 @@ - (void)_singleTapIdentified:(UITapGestureRecognizer *)gestureRecognizer > if (shouldRequestMagnificationInformation) > RELEASE_LOG(ViewGestures, "Single tap identified. Request details on potential zoom. (%p, pageProxyID=%llu)", self, _page->identifier().toUInt64()); > >- _page->potentialTapAtPosition([self _locationForGesture:gestureRecognizer], shouldRequestMagnificationInformation, [self nextTapIdentifier]); >+ _page->potentialTapAtPosition(position, shouldRequestMagnificationInformation, [self nextTapIdentifier]); > _potentialTapInProgress = YES; > _isTapHighlightIDValid = YES; > _isExpectingFastSingleTapCommit = !_doubleTapGestureRecognizer.get().enabled; >@@ -11016,6 +11029,7 @@ - (void)installImageAnalysisInteraction:(VKCImageAnalysis *)analysis > [_imageAnalysisInteraction setActiveInteractionTypes:VKImageAnalysisInteractionTypeTextSelection | VKImageAnalysisInteractionTypeDataDetectors]; > [_imageAnalysisInteraction setDelegate:self]; > [_imageAnalysisInteraction setWantsAutomaticContentsRectCalculation:NO]; >+ WebKit::setUpAdditionalImageAnalysisBehaviors(_imageAnalysisInteraction.get()); > [self addInteraction:_imageAnalysisInteraction.get()]; > } > [_imageAnalysisInteraction setAnalysis:analysis]; >@@ -11047,7 +11061,7 @@ - (CGRect)contentsRectForImageAnalysisInteraction:(VKCImageAnalysisInteraction * > > - (BOOL)imageAnalysisInteraction:(VKCImageAnalysisInteraction *)interaction shouldBeginAtPoint:(CGPoint)point forAnalysisType:(VKImageAnalysisInteractionTypes)analysisType > { >- return [_imageAnalysisInteraction interactableItemExistsAtPoint:point]; >+ return interaction.hasActiveTextSelection || [interaction interactableItemExistsAtPoint:point]; > } > > #endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-feeder
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 239391
: 457725