Title: [280616] branches/safari-612.1-branch/Source
Revision
280616
Author
repst...@apple.com
Date
2021-08-03 13:54:22 -0700 (Tue, 03 Aug 2021)

Log Message

Cherry-pick r280603. rdar://problem/81473647

    [Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
    https://bugs.webkit.org/show_bug.cgi?id=228722

    Reviewed by Tim Horton.

    Source/WebCore/PAL:

    * pal/spi/cocoa/VisionKitCoreSPI.h:

    Source/WebKit:

    * UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView _updateContextMenuForMachineReadableCodeForImageAnalysis:]): Added.
    (-[WKContentView imageAnalysisGestureDidBegin:]):
    (-[WKContentView imageAnalysisGestureDidTimeOut:]):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280603 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612.1-branch/Source/WebCore/PAL/ChangeLog (280615 => 280616)


--- branches/safari-612.1-branch/Source/WebCore/PAL/ChangeLog	2021-08-03 20:54:19 UTC (rev 280615)
+++ branches/safari-612.1-branch/Source/WebCore/PAL/ChangeLog	2021-08-03 20:54:22 UTC (rev 280616)
@@ -1,3 +1,35 @@
+2021-08-03  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r280603. rdar://problem/81473647
+
+    [Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
+    https://bugs.webkit.org/show_bug.cgi?id=228722
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/VisionKitCoreSPI.h:
+    
+    Source/WebKit:
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _updateContextMenuForMachineReadableCodeForImageAnalysis:]): Added.
+    (-[WKContentView imageAnalysisGestureDidBegin:]):
+    (-[WKContentView imageAnalysisGestureDidTimeOut:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-03  Devin Rousso  <drou...@apple.com>
+
+            [Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
+            https://bugs.webkit.org/show_bug.cgi?id=228722
+
+            Reviewed by Tim Horton.
+
+            * pal/spi/cocoa/VisionKitCoreSPI.h:
+
 2021-08-02  Devin Rousso  <drou...@apple.com>
 
         [Live Text] SPI for machine readable codes is only available on iOS

Modified: branches/safari-612.1-branch/Source/WebCore/PAL/pal/spi/cocoa/VisionKitCoreSPI.h (280615 => 280616)


--- branches/safari-612.1-branch/Source/WebCore/PAL/pal/spi/cocoa/VisionKitCoreSPI.h	2021-08-03 20:54:19 UTC (rev 280615)
+++ branches/safari-612.1-branch/Source/WebCore/PAL/pal/spi/cocoa/VisionKitCoreSPI.h	2021-08-03 20:54:22 UTC (rev 280616)
@@ -130,6 +130,7 @@
 @property (nonatomic, readonly) NSArray<VKWKLineInfo *> *allLines;
 #if HAVE(VK_IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
 @property (nonatomic) UIMenu *mrcMenu;
+@property (nonatomic, nullable, weak) UIViewController *presentingViewControllerForMrcAction;
 #endif
 @end
 

Modified: branches/safari-612.1-branch/Source/WebKit/ChangeLog (280615 => 280616)


--- branches/safari-612.1-branch/Source/WebKit/ChangeLog	2021-08-03 20:54:19 UTC (rev 280615)
+++ branches/safari-612.1-branch/Source/WebKit/ChangeLog	2021-08-03 20:54:22 UTC (rev 280616)
@@ -1,3 +1,38 @@
+2021-08-03  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r280603. rdar://problem/81473647
+
+    [Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
+    https://bugs.webkit.org/show_bug.cgi?id=228722
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/VisionKitCoreSPI.h:
+    
+    Source/WebKit:
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _updateContextMenuForMachineReadableCodeForImageAnalysis:]): Added.
+    (-[WKContentView imageAnalysisGestureDidBegin:]):
+    (-[WKContentView imageAnalysisGestureDidTimeOut:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-03  Devin Rousso  <drou...@apple.com>
+
+            [Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
+            https://bugs.webkit.org/show_bug.cgi?id=228722
+
+            Reviewed by Tim Horton.
+
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _updateContextMenuForMachineReadableCodeForImageAnalysis:]): Added.
+            (-[WKContentView imageAnalysisGestureDidBegin:]):
+            (-[WKContentView imageAnalysisGestureDidTimeOut:]):
+
 2021-08-02  Peng Liu  <peng.l...@apple.com>
 
         [GPUP] RemoteAudioSession::setPreferredBufferSize() does not change its preferredBufferSize

Modified: branches/safari-612.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (280615 => 280616)


--- branches/safari-612.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-03 20:54:19 UTC (rev 280615)
+++ branches/safari-612.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-03 20:54:22 UTC (rev 280616)
@@ -10156,6 +10156,16 @@
     return [self createImageAnalysisRequest:analysisTypes image:image imageURL:_positionInformation.imageURL];
 }
 
+#if USE(UICONTEXTMENU) && ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
+
+- (void)_updateContextMenuForMachineReadableCodeForImageAnalysis:(VKImageAnalysis *)analysis
+{
+    analysis.presentingViewControllerForMrcAction = [UIViewController _viewControllerForFullScreenPresentationFromView:self];
+    _contextMenuForMachineReadableCode = [analysis hasResultsForAnalysisTypes:VKAnalysisTypeMachineReadableCode | VKAnalysisTypeAppClip] ? analysis.mrcMenu : nil;
+}
+
+#endif // USE(UICONTEXTMENU) && ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
+
 - (BOOL)validateImageAnalysisRequestIdentifier:(WebKit::ImageAnalysisRequestIdentifier)identifier
 {
     if (_pendingImageAnalysisRequestIdentifier == identifier)
@@ -10323,7 +10333,7 @@
                     UNUSED_PARAM(hasTextResults);
 #endif
 #if USE(UICONTEXTMENU) && ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
-                    strongSelf->_contextMenuForMachineReadableCode = [result hasResultsForAnalysisTypes:VKAnalysisTypeMachineReadableCode | VKAnalysisTypeAppClip] ? result.mrcMenu : nil;
+                    [strongSelf _updateContextMenuForMachineReadableCodeForImageAnalysis:result];
 #endif // USE(UICONTEXTMENU) && ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
                     [strongSelf _invokeAllActionsToPerformAfterPendingImageAnalysis:WebKit::ProceedWithTextSelectionInImage::No];
                 }];
@@ -10392,7 +10402,7 @@
 
 #if USE(UICONTEXTMENU)
 #if ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
-            strongSelf->_contextMenuForMachineReadableCode = [result hasResultsForAnalysisTypes:VKAnalysisTypeMachineReadableCode | VKAnalysisTypeAppClip] ? result.mrcMenu : nil;
+            [strongSelf _updateContextMenuForMachineReadableCodeForImageAnalysis:result];
 #endif // ENABLE(IMAGE_ANALYSIS_FOR_MACHINE_READABLE_CODES)
             strongSelf->_contextMenuWasTriggeredByImageAnalysisTimeout = YES;
             [strongSelf->_contextMenuInteraction _presentMenuAtLocation:location];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to