Title: [294964] trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Revision
294964
Author
wenson_hs...@apple.com
Date
2022-05-27 16:08:57 -0700 (Fri, 27 May 2022)

Log Message

[iOS] Performing the image markup action should reset `_imageAnalysisMarkupData`
https://bugs.webkit.org/show_bug.cgi?id=241024

Reviewed by Aditya Keerthi.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView imageAnalysisMarkupMenu]):

Canonical link: https://commits.webkit.org/251068@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (294963 => 294964)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-05-27 23:02:13 UTC (rev 294963)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-05-27 23:08:57 UTC (rev 294964)
@@ -4677,10 +4677,11 @@
         return nil;
 
     return [self menuWithInlineAction:WebCore::contextMenuItemTitleMarkupImage() identifier:@"WKActionMarkupImage" handler:[](WKContentView *view) {
-        if (!view->_imageAnalysisMarkupData)
+        auto markupData = std::exchange(view->_imageAnalysisMarkupData, { });
+        if (!markupData)
             return;
 
-        auto [elementContext, image, preferredMIMEType] = *view->_imageAnalysisMarkupData;
+        auto [elementContext, image, preferredMIMEType] = *markupData;
         if (auto [data, type] = WebKit::imageDataForCroppedImageResult(image.get(), preferredMIMEType.createCFString().get()); data)
             view->_page->replaceImageWithMarkupResults(elementContext, { String { type.get() } }, { static_cast<const uint8_t*>([data bytes]), [data length] });
     }];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to