Title: [270853] trunk/Source/WebKit
Revision
270853
Author
[email protected]
Date
2020-12-15 10:53:06 -0800 (Tue, 15 Dec 2020)

Log Message

Image extraction interaction should remain active while scrolling
https://bugs.webkit.org/show_bug.cgi?id=219895
<rdar://problem/72344814>

Reviewed by Devin Rousso.

Make our image extraction interaction behave more like the rest of the system by making it persist until
explicitly dismissed via tap gesture (or any other competing interaction, such as text interactions, drag
interactions and context menu interactions, as long as the interaction location is outside of the active image
extraction interaction).

We currently just dismiss any active image extraction upon starting a new touch, which prevents scrolling from
working as expected with image extraction. See radar for more details.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _webTouchEventsRecognized:]):
(-[WKContentView hasSelectablePositionAtPoint:]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
(-[WKContentView _singleTapIdentified:]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (270852 => 270853)


--- trunk/Source/WebKit/ChangeLog	2020-12-15 18:27:57 UTC (rev 270852)
+++ trunk/Source/WebKit/ChangeLog	2020-12-15 18:53:06 UTC (rev 270853)
@@ -1,3 +1,27 @@
+2020-12-15  Wenson Hsieh  <[email protected]>
+
+        Image extraction interaction should remain active while scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=219895
+        <rdar://problem/72344814>
+
+        Reviewed by Devin Rousso.
+
+        Make our image extraction interaction behave more like the rest of the system by making it persist until
+        explicitly dismissed via tap gesture (or any other competing interaction, such as text interactions, drag
+        interactions and context menu interactions, as long as the interaction location is outside of the active image
+        extraction interaction).
+
+        We currently just dismiss any active image extraction upon starting a new touch, which prevents scrolling from
+        working as expected with image extraction. See radar for more details.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _webTouchEventsRecognized:]):
+        (-[WKContentView hasSelectablePositionAtPoint:]):
+        (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
+        (-[WKContentView _singleTapIdentified:]):
+        (-[WKContentView _dragInteraction:prepareForSession:completion:]):
+        (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
+
 2020-12-15  Kate Cheney  <[email protected]>
 
         CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper<WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests()

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (270852 => 270853)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-12-15 18:27:57 UTC (rev 270852)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-12-15 18:53:06 UTC (rev 270853)
@@ -1521,10 +1521,6 @@
         [self doAfterPositionInformationUpdate:[assistant = WeakObjCPtr<WKActionSheetAssistant>(_actionSheetAssistant.get())] (WebKit::InteractionInformationAtPosition information) {
             [assistant interactionDidStartWithPositionInformation:information];
         } forRequest:positionInformationRequest];
-
-#if ENABLE(IMAGE_EXTRACTION)
-        [self _cancelImageExtractionIfNeededAfterTouchAt:_lastInteractionLocation];
-#endif
     }
 
 #if ENABLE(TOUCH_EVENTS)
@@ -2568,6 +2564,8 @@
 #if ENABLE(IMAGE_EXTRACTION)
     if ([self _imageExtractionShouldPreventTextInteractionAtPoint:point])
         return NO;
+
+    [self _cancelImageExtraction];
 #endif
 
     if (_inspectorNodeSearchEnabled)
@@ -2618,6 +2616,8 @@
 #if ENABLE(IMAGE_EXTRACTION)
     if ([self _imageExtractionShouldPreventTextInteractionAtPoint:point])
         return NO;
+
+    [self _cancelImageExtraction];
 #endif
 
     if (!self.isFocusingElement) {
@@ -2787,6 +2787,10 @@
     _potentialTapInProgress = YES;
     _isTapHighlightIDValid = YES;
     _isExpectingFastSingleTapCommit = !_doubleTapGestureRecognizer.get().enabled;
+
+#if ENABLE(IMAGE_EXTRACTION)
+    [self _cancelImageExtractionIfNeededAfterTouchAt:gestureRecognizer.location];
+#endif
 }
 
 static void cancelPotentialTapIfNecessary(WKContentView* contentView)
@@ -8170,7 +8174,9 @@
         if (!strongSelf)
             return;
 
+        auto dragOrigin = [session locationInView:strongSelf.get()];
 #if ENABLE(IMAGE_EXTRACTION)
+        [strongSelf _cancelImageExtractionIfNeededAfterTouchAt:dragOrigin];
         if (strongSelf->_imageExtractionState == WebKit::ImageExtractionState::Active) {
             RELEASE_LOG(DragAndDrop, "Drag session failed: %p (deferring to active image extraction)", session.get());
             completion();
@@ -8179,10 +8185,8 @@
 #endif
 
         strongSelf->_dragDropInteractionState.prepareForDragSession(session.get(), completion.get());
-
-        auto dragOrigin = WebCore::roundedIntPoint([session locationInView:strongSelf.get()]);
-        strongSelf->_page->requestDragStart(dragOrigin, WebCore::roundedIntPoint([strongSelf convertPoint:dragOrigin toView:[strongSelf window]]), [strongSelf _allowedDragSourceActions]);
-        RELEASE_LOG(DragAndDrop, "Drag session requested: %p at origin: {%d, %d}", session.get(), dragOrigin.x(), dragOrigin.y());
+        strongSelf->_page->requestDragStart(WebCore::roundedIntPoint(dragOrigin), WebCore::roundedIntPoint([strongSelf convertPoint:dragOrigin toView:[strongSelf window]]), [strongSelf _allowedDragSourceActions]);
+        RELEASE_LOG(DragAndDrop, "Drag session requested: %p at origin: {%.0f, %.0f}", session.get(), dragOrigin.x, dragOrigin.y);
     };
 
 #if ENABLE(IMAGE_EXTRACTION)
@@ -9544,7 +9548,9 @@
         if (!strongSelf)
             return;
 
+        auto position = [interaction locationInView:strongSelf.get()];
 #if ENABLE(IMAGE_EXTRACTION)
+        [strongSelf _cancelImageExtractionIfNeededAfterTouchAt:position];
         if (strongSelf->_imageExtractionState == WebKit::ImageExtractionState::Active) {
             completion(nil);
             return;
@@ -9557,7 +9563,6 @@
         if (NSNumber *value = [[NSUserDefaults standardUserDefaults] objectForKey:webkitShowLinkPreviewsPreferenceKey])
             strongSelf->_showLinkPreviews = value.boolValue;
 
-        const auto position = [interaction locationInView:strongSelf.get()];
         WebKit::InteractionInformationRequest request { WebCore::roundedIntPoint(position) };
         request.includeSnapshot = true;
         request.includeLinkIndicator = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to