Title: [270350] trunk/Source/WebKit
- Revision
- 270350
- Author
- wenson_hs...@apple.com
- Date
- 2020-12-02 09:30:05 -0800 (Wed, 02 Dec 2020)
Log Message
Context menu should be shown after a long timeout following image extraction
https://bugs.webkit.org/show_bug.cgi?id=219415
<rdar://problem/71872600>
Reviewed by Andy Estes.
Ensures that the context menu can still be shown when triggering an image extraction gesture. To do this, we
add a new long press gesture recognizer with a much longer delay. See WebKitAdditions patch for more details.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKContentView _doAfterPendingImageExtraction:]):
(-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction]):
Drive-by fix: move a couple of methods out of WebKitAdditions and into non-internal source.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (270349 => 270350)
--- trunk/Source/WebKit/ChangeLog 2020-12-02 17:05:39 UTC (rev 270349)
+++ trunk/Source/WebKit/ChangeLog 2020-12-02 17:30:05 UTC (rev 270350)
@@ -1,3 +1,22 @@
+2020-12-02 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Context menu should be shown after a long timeout following image extraction
+ https://bugs.webkit.org/show_bug.cgi?id=219415
+ <rdar://problem/71872600>
+
+ Reviewed by Andy Estes.
+
+ Ensures that the context menu can still be shown when triggering an image extraction gesture. To do this, we
+ add a new long press gesture recognizer with a much longer delay. See WebKitAdditions patch for more details.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
+ (-[WKContentView _doAfterPendingImageExtraction:]):
+ (-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction]):
+
+ Drive-by fix: move a couple of methods out of WebKitAdditions and into non-internal source.
+
2020-12-01 Tim Horton <timothy_hor...@apple.com>
GPU Process: IOSurfaces should not be mapped into the Web Content Process
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (270349 => 270350)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-12-02 17:05:39 UTC (rev 270349)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-12-02 17:30:05 UTC (rev 270350)
@@ -431,6 +431,7 @@
#if ENABLE(IMAGE_EXTRACTION)
RetainPtr<WKImageExtractionGestureRecognizer> _imageExtractionGestureRecognizer;
+ RetainPtr<UILongPressGestureRecognizer> _imageExtractionTimeoutGestureRecognizer;
WebKit::ImageExtractionState _imageExtractionState;
CGRect _imageExtractionInteractionBounds;
Vector<BlockPtr<void()>> _actionsToPerformAfterPendingImageExtraction;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (270349 => 270350)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-12-02 17:05:39 UTC (rev 270349)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-12-02 17:30:05 UTC (rev 270350)
@@ -2188,7 +2188,7 @@
return YES;
#if ENABLE(IMAGE_EXTRACTION)
- if (gestureRecognizer == _imageExtractionGestureRecognizer)
+ if (gestureRecognizer == _imageExtractionGestureRecognizer || gestureRecognizer == _imageExtractionTimeoutGestureRecognizer)
return YES;
#endif
@@ -9035,6 +9035,24 @@
#endif // ENABLE(ATTACHMENT_ELEMENT)
+#if ENABLE(IMAGE_EXTRACTION)
+
+- (void)_doAfterPendingImageExtraction:(dispatch_block_t)block
+{
+ if (_imageExtractionState == WebKit::ImageExtractionState::Pending)
+ _actionsToPerformAfterPendingImageExtraction.append(makeBlockPtr(block));
+ else
+ block();
+}
+
+- (void)_invokeAllActionsToPerformAfterPendingImageExtraction
+{
+ for (auto block : std::exchange(_actionsToPerformAfterPendingImageExtraction, { }))
+ block();
+}
+
+#endif // ENABLE(IMAGE_EXTRACTION)
+
#if USE(APPLE_INTERNAL_SDK)
#import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.mm>
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes