Title: [281646] trunk/Source/WebKit
Revision
281646
Author
akeer...@apple.com
Date
2021-08-26 12:33:37 -0700 (Thu, 26 Aug 2021)

Log Message

[iOS] Photo picker appears at incorrect locations when opened using a trackpad
https://bugs.webkit.org/show_bug.cgi?id=229568
rdar://80268735

Reviewed by Wenson Hsieh.

On iOS, file inputs that accept photos give the user the option to
select from a photo picker rather than a standard document picker.
The photo picker is presented as a popover, and uses the content
view's `lastInteractionLocation` to determine the source rect.
However, `lastInteractionLocation` is not updated when mouse events
are recognized, leading to the popover being presented at the location
of the most recent tap / long press / touch event.

To fix, ensure `lastInteractionLocation` is updated when a mouse down
event is recognized.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView mouseGestureRecognizerChanged:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (281645 => 281646)


--- trunk/Source/WebKit/ChangeLog	2021-08-26 19:31:45 UTC (rev 281645)
+++ trunk/Source/WebKit/ChangeLog	2021-08-26 19:33:37 UTC (rev 281646)
@@ -1,3 +1,25 @@
+2021-08-26  Aditya Keerthi  <akeer...@apple.com>
+
+        [iOS] Photo picker appears at incorrect locations when opened using a trackpad
+        https://bugs.webkit.org/show_bug.cgi?id=229568
+        rdar://80268735
+
+        Reviewed by Wenson Hsieh.
+
+        On iOS, file inputs that accept photos give the user the option to
+        select from a photo picker rather than a standard document picker.
+        The photo picker is presented as a popover, and uses the content
+        view's `lastInteractionLocation` to determine the source rect.
+        However, `lastInteractionLocation` is not updated when mouse events
+        are recognized, leading to the popover being presented at the location
+        of the most recent tap / long press / touch event.
+
+        To fix, ensure `lastInteractionLocation` is updated when a mouse down
+        event is recognized.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView mouseGestureRecognizerChanged:]):
+
 2021-08-26  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Clean up logging #includes

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (281645 => 281646)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-26 19:31:45 UTC (rev 281645)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-26 19:33:37 UTC (rev 281646)
@@ -9503,9 +9503,13 @@
     if (!event)
         return;
 
-    if (event->type() == WebKit::WebEvent::MouseDown)
+    if (event->type() == WebKit::WebEvent::MouseDown) {
         _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
 
+        if (auto lastMouseLocation = gestureRecognizer.lastMouseLocation)
+            _lastInteractionLocation = *lastMouseLocation;
+    }
+
     if (event->type() == WebKit::WebEvent::MouseUp && self.hasHiddenContentEditable && self._hasFocusedElement && !self.window.keyWindow)
         [self.window makeKeyWindow];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to