Title: [273007] trunk/Source/WebKit
Revision
273007
Author
drou...@apple.com
Date
2021-02-17 09:36:55 -0800 (Wed, 17 Feb 2021)

Log Message

[iOS] Add support for additional accessibility image extraction contextmenu actions
https://bugs.webkit.org/show_bug.cgi?id=222022
<rdar://problem/74157750>

Reviewed by Tim Horton.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273006 => 273007)


--- trunk/Source/WebKit/ChangeLog	2021-02-17 17:35:49 UTC (rev 273006)
+++ trunk/Source/WebKit/ChangeLog	2021-02-17 17:36:55 UTC (rev 273007)
@@ -1,5 +1,18 @@
 2021-02-17  Devin Rousso  <drou...@apple.com>
 
+        [iOS] Add support for additional accessibility image extraction contextmenu actions
+        https://bugs.webkit.org/show_bug.cgi?id=222022
+        <rdar://problem/74157750>
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView continueContextMenuInteraction:]):
+        (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
+
+2021-02-17  Devin Rousso  <drou...@apple.com>
+
         [iOS] don't "promote" media controls contextmenu items if they are the only item being shown
         https://bugs.webkit.org/show_bug.cgi?id=221939
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (273006 => 273007)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-02-17 17:35:49 UTC (rev 273006)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-02-17 17:36:55 UTC (rev 273007)
@@ -483,7 +483,10 @@
     CGRect _imageExtractionInteractionBounds;
     Vector<BlockPtr<void()>> _actionsToPerformAfterPendingImageExtraction;
     std::unique_ptr<WebKit::SuppressInteractionToken> _suppressImageExtractionToken;
-#endif
+#if USE(UICONTEXTMENU)
+    RetainPtr<UIMenu> _imageExtractionContextMenu;
+#endif // USE(UICONTEXTMENU)
+#endif // ENABLE(IMAGE_EXTRACTION)
 
 #if USE(APPLE_INTERNAL_SDK)
 #import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.h>

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (273006 => 273007)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-02-17 17:35:49 UTC (rev 273006)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-02-17 17:36:55 UTC (rev 273007)
@@ -9716,7 +9716,7 @@
     return actions;
 }
 
-static NSArray<UIMenuElement *> *menuElementsFromDefaultActions(const RetainPtr<NSArray>& defaultElementActions, RetainPtr<_WKActivatedElementInfo> elementInfo)
+static NSMutableArray<UIMenuElement *> *menuElementsFromDefaultActions(const RetainPtr<NSArray>& defaultElementActions, RetainPtr<_WKActivatedElementInfo> elementInfo)
 {
     if (!defaultElementActions || !defaultElementActions.get().count)
         return nil;
@@ -9988,6 +9988,10 @@
 
                 RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = [strongSelf->_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
                 auto actions = menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
+#if ENABLE(IMAGE_EXTRACTION)
+                if (UIMenu *imageExtractionContextMenu = strongSelf->_imageExtractionContextMenu.get())
+                    [actions addObject:imageExtractionContextMenu];
+#endif // ENABLE(IMAGE_EXTRACTION)
                 return [UIMenu menuWithTitle:strongSelf->_positionInformation.title children:actions];
             };
 
@@ -10242,6 +10246,10 @@
     _contextMenuHasRequestedLegacyData = NO;
     _contextMenuElementInfo = nullptr;
 
+#if ENABLE(IMAGE_EXTRACTION)
+    _imageExtractionContextMenu.clear();
+#endif // ENABLE(IMAGE_EXTRACTION)
+
     [animator addCompletion:[weakSelf = WeakObjCPtr<WKContentView>(self)] () {
         auto strongSelf = weakSelf.get();
         if (!strongSelf)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to