Currently, gecko does not support any touch/mouse events or selection modification by Javascript to trigger copy & paste menu. One exception is the select-all Steve mentioned.
This is how firefox os handle the input flow to bring up the copy & paste menu. When you long-pressing on a word: 1. AccessibleCaretEventHub::HandleMouseEvent will handle eMouseLongTap [1] event fired by APZ (async-pan-zoom). 2. After handing the event and updating the carets, gecko fires a CaretStateChanged event [2] to tell Gaia to update copy & paste menu. 3. In Gaia, the caretstatechanged event will be handled in [3] to show the menu. Ting-Yu (:TYLin) [1] https://dxr.mozilla.org/mozilla-central/rev/01ae99b53561a2c3b40533d8c1c92bd3efc42d00/layout/base/AccessibleCaretEventHub.cpp#526 [2] https://dxr.mozilla.org/mozilla-central/rev/01ae99b53561a2c3b40533d8c1c92bd3efc42d00/layout/base/AccessibleCaretManager.cpp?offset=0#899 [3] https://github.com/mozilla-b2g/gaia/blob/14143fbdbeae85014cb193c756387af6c7b58d64/apps/system/js/app_text_selection_dialog.js#L155 On Wed, Sep 9, 2015 at 2:59 PM, Steve Chung <[email protected]> wrote: > Hey Marcus , > > If you want to trigger the copy paste menu manually, there is an > alternative way to do so. Please reference message app[1] that we use > selection API to trigger the menu because there is no user interaction > could trigger the menu in some scenario in message app. If you want to know > more about the copy paste behavior, maybe you can ask Ting-Yu ( > [email protected]) for more details. > > Steve. > > [1] > https://github.com/mozilla-b2g/gaia/blob/master/apps/sms/views/conversation/js/conversation.js#L3115 > > > > On Wed, Sep 9, 2015 at 12:42 PM, 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 >> <https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/sendTouchEvent> >> ? >> >> 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. >> >> 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 <https://bugzilla.mozilla.org/show_bug.cgi?id=1178162>. >> >> Any pointers or tips would be appreciated. Based on what I've seen so >> far, it appears that this isn't possible as-is. >> >> >> Marcus >> >> >> >> >> _______________________________________________ >> dev-fxos mailing list >> [email protected] >> https://lists.mozilla.org/listinfo/dev-fxos >> >> >
_______________________________________________ dev-fxos mailing list [email protected] https://lists.mozilla.org/listinfo/dev-fxos

