Title: [257659] trunk/Source/WebKit
Revision
257659
Author
timothy_hor...@apple.com
Date
2020-02-28 14:24:32 -0800 (Fri, 28 Feb 2020)

Log Message

macCatalyst: 'Open' context menu item doesn't work
https://bugs.webkit.org/show_bug.cgi?id=208388
<rdar://problem/59820273>

Reviewed by Wenson Hsieh.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanupInteraction]):
(-[WKContentView _webTouchEventsRecognized:]):
(-[WKContentView _doubleTapRecognizedForDoubleClick:]):
(-[WKContentView _singleTapRecognized:]):
(-[WKContentView _attemptClickAtLocation:modifierFlags:]):
(-[WKContentView _mouseGestureRecognizerChanged:]):
In r178980, a mechanism was introduced to ensure that synthetic clicks are
only dispatched to the page that the user originally touched.

macCatalyst's WKMouseGestureRecognizer unintentionally entirely bypassed
this mechanism, never setting _layerTreeTransactionIdAtLastTouchStart,
because the touch event gesture recognizer is disabled. This was generally
fine because in this case, we don't need to send synthetic clicks,
instead sending proper mouse events.

However, the "Open" context menu item works by sending a synthetic click
at the original interaction location. Since we did not set 
_layerTreeTransactionIdAtLastTouchStart, the Web Content process will
ignore the click, and perform no action.

Fix this by also setting _layerTreeTransactionIdAtLastTouchStart
on mouseDown.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257658 => 257659)


--- trunk/Source/WebKit/ChangeLog	2020-02-28 21:42:06 UTC (rev 257658)
+++ trunk/Source/WebKit/ChangeLog	2020-02-28 22:24:32 UTC (rev 257659)
@@ -1,3 +1,36 @@
+2020-02-28  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: 'Open' context menu item doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=208388
+        <rdar://problem/59820273>
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView _webTouchEventsRecognized:]):
+        (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
+        (-[WKContentView _singleTapRecognized:]):
+        (-[WKContentView _attemptClickAtLocation:modifierFlags:]):
+        (-[WKContentView _mouseGestureRecognizerChanged:]):
+        In r178980, a mechanism was introduced to ensure that synthetic clicks are
+        only dispatched to the page that the user originally touched.
+
+        macCatalyst's WKMouseGestureRecognizer unintentionally entirely bypassed
+        this mechanism, never setting _layerTreeTransactionIdAtLastTouchStart,
+        because the touch event gesture recognizer is disabled. This was generally
+        fine because in this case, we don't need to send synthetic clicks,
+        instead sending proper mouse events.
+
+        However, the "Open" context menu item works by sending a synthetic click
+        at the original interaction location. Since we did not set 
+        _layerTreeTransactionIdAtLastTouchStart, the Web Content process will
+        ignore the click, and perform no action.
+
+        Fix this by also setting _layerTreeTransactionIdAtLastTouchStart
+        on mouseDown.
+
 2020-02-28  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Remove access to the "com.apple.lsd.open" mach service from the WebContent process

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (257658 => 257659)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-02-28 21:42:06 UTC (rev 257658)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-02-28 22:24:32 UTC (rev 257659)
@@ -306,7 +306,7 @@
     BlockPtr<void(::WebEvent *, BOOL)> _keyWebEventHandler;
 
     CGPoint _lastInteractionLocation;
-    WebKit::TransactionID _layerTreeTransactionIdAtLastTouchStart;
+    WebKit::TransactionID _layerTreeTransactionIdAtLastInteractionStart;
 
     WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (257658 => 257659)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-02-28 21:42:06 UTC (rev 257658)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-02-28 22:24:32 UTC (rev 257659)
@@ -998,7 +998,7 @@
     [self removeGestureRecognizer:_touchActionDownSwipeGestureRecognizer.get()];
 #endif
 
-    _layerTreeTransactionIdAtLastTouchStart = { };
+    _layerTreeTransactionIdAtLastInteractionStart = { };
 
 #if ENABLE(DATA_INTERACTION)
     [existingLocalDragSessionContext(_dragDropInteractionState.dragSession()) cleanUpTemporaryDirectories];
@@ -1463,7 +1463,7 @@
     _lastInteractionLocation = lastTouchEvent->locationInDocumentCoordinates;
     if (lastTouchEvent->type == UIWebTouchEventTouchBegin) {
         [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
-        _layerTreeTransactionIdAtLastTouchStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
+        _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
 
 #if ENABLE(TOUCH_EVENTS)
         _page->resetPotentialTapSecurityOrigin();
@@ -2627,7 +2627,7 @@
 
 - (void)_doubleTapRecognizedForDoubleClick:(UITapGestureRecognizer *)gestureRecognizer
 {
-    _page->handleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint(gestureRecognizer.location), WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastTouchStart);
+    _page->handleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint(gestureRecognizer.location), WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastInteractionStart);
 }
 
 - (void)_twoFingerSingleTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
@@ -2794,7 +2794,7 @@
         m_commitPotentialTapPointerId = pointerId;
     }
 #endif
-    _page->commitPotentialTap(WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastTouchStart, pointerId);
+    _page->commitPotentialTap(WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastInteractionStart, pointerId);
 
     if (!_isExpectingFastSingleTapCommit)
         [self _finishInteraction];
@@ -2835,7 +2835,7 @@
         [self becomeFirstResponder];
 
     [_inputPeripheral endEditing];
-    _page->handleTap(location, WebKit::webEventModifierFlags(modifierFlags), _layerTreeTransactionIdAtLastTouchStart);
+    _page->handleTap(location, WebKit::webEventModifierFlags(modifierFlags), _layerTreeTransactionIdAtLastInteractionStart);
 }
 
 - (void)setUpTextSelectionAssistant
@@ -8057,8 +8057,12 @@
     if (!_page->hasRunningProcess())
         return;
 
-    if (auto event = gestureRecognizer.lastMouseEvent)
+    if (auto event = gestureRecognizer.lastMouseEvent) {
+        if (event->type() == WebKit::WebEvent::MouseDown)
+            _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
+
         _page->handleMouseEvent(*event);
+    }
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to