I just realized I didn't reply-all on this message. Whoops. The latest version of the diagram I refer to below can be found at https://hg.mozilla.org/mozilla-central/raw-file/tip/gfx/doc/B2GInputFlow.svg
---------- Forwarded message ---------- From: Kartikaya Gupta <[email protected]> Date: Wed, Sep 9, 2015 at 9:36 AM Subject: Re: Can `iframe.sendTouchEvent` trigger the copy/paste menu? To: Marcus Cavanaugh <[email protected]> On Wed, Sep 9, 2015 at 12:42 AM, Marcus Cavanaugh <[email protected]> wrote: > Is it possible to trigger the copy/paste context menu from the System app by > passing touch events to HTMLIFrameElement.sendTouchEvent? In general, no. This API (which is something I would very much like to get rid of) inserts events partway through the flow of input events, and in particular, inserts them after the gesture detection that detects long-presses. I would instead suggest trying to use the DOMWindowUtils sendNativeTouchPoint function - http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIDOMWindowUtils.idl?rev=6846ace10478#665 > Sending 'touchstart' and/or 'mousedown' events does not trigger the menu; it > seems `sendTouchEvent` doesn't produce any meaningful selection events > otherwise. (Our marionette tests are able to produce this context menu, but > I presume that's through a different codepath.) I'm admittedly unfamiliar > with how input events flow through Gecko to produce this menu, and my dxr-fu > isn't great. Here's a (possibly slightly-off) diagram showing how touch events flow through Gecko on B2G: http://people.mozilla.org/~kgupta/tmp/B2GInputFlow.svg In the context of this diagram, the sendTouchEvent function you're trying to use inserts stuff at the box labelled "BEParent.jsm sendTouchEvent" whereas the sendNativeTouchPoint function I referenced above will insert them between "Android/Gonk" and "APZ hit test". I'll update the diagram to actually include this information and put it somewhere more useful (it previously lived on bug 930939). > Additional context: I'd like to intercept touch events (which works) and > pass them onto the appropriate element/iframe (which works, in general), but > I haven't been able to figure out how to forward the long-press gesture that > triggers the copy/paste menu. This is relevant for the incoming native > utility tray enhancements. > > Any pointers or tips would be appreciated. Based on what I've seen so far, > it appears that this isn't possible as-is. Using the sendNativeTouchPoint function would be the way to go; I'm not sure if you have access to the DOMWindowUtils API though. Cheers, kats _______________________________________________ dev-fxos mailing list [email protected] https://lists.mozilla.org/listinfo/dev-fxos

