Skip to content
Permalink
Browse files
[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:]):


Canonical link: https://commits.webkit.org/241002@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pxlcoder committed Aug 26, 2021
1 parent a1fa4bd commit 999b1f6a11dcf13c9e2063843f2244432749b4ab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
@@ -1,3 +1,25 @@
2021-08-26 Aditya Keerthi <akeerthi@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 <mmaxfield@apple.com>

Clean up logging #includes
@@ -9503,9 +9503,13 @@ - (void)mouseGestureRecognizerChanged:(WKMouseGestureRecognizer *)gestureRecogni
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];

0 comments on commit 999b1f6

Please sign in to comment.