diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index 806eba8f11ef..2232073e0818 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -194,6 +194,9 @@ this.AccessFu = { case 'AccessFu:Input': this.Input.setEditState(aMessage.json); break; + case 'AccessFu:ActivateContextMenu': + this.Input.activateContextMenu(aMessage.json); + break; } }, @@ -232,12 +235,14 @@ this.AccessFu = { aMessageManager.addMessageListener('AccessFu:Present', this); aMessageManager.addMessageListener('AccessFu:Input', this); aMessageManager.addMessageListener('AccessFu:Ready', this); + aMessageManager.addMessageListener('AccessFu:ActivateContextMenu', this); }, _removeMessageListeners: function _removeMessageListeners(aMessageManager) { aMessageManager.removeMessageListener('AccessFu:Present', this); aMessageManager.removeMessageListener('AccessFu:Input', this); aMessageManager.removeMessageListener('AccessFu:Ready', this); + aMessageManager.removeMessageListener('AccessFu:ActivateContextMenu', this); }, _handleMessageManager: function _handleMessageManager(aMessageManager) { @@ -532,6 +537,9 @@ var Input = { case 'doubletap1': this.activateCurrent(); break; + case 'doubletaphold1': + this.sendContextMenuMessage(); + break; case 'swiperight1': this.moveCursor('moveNext', 'Simple', 'gestures'); break; @@ -658,6 +666,17 @@ var Input = { mm.sendAsyncMessage('AccessFu:Activate', {}); }, + sendContextMenuMessage: function sendContextMenuMessage() { + let mm = Utils.getMessageManager(Utils.CurrentBrowser); + mm.sendAsyncMessage('AccessFu:ContextMenu', {}); + }, + + activateContextMenu: function activateContextMenu(aMessage) { + if (Utils.MozBuildApp === 'mobile/android') + Services.obs.notifyObservers(null, 'Gesture:LongPress', + JSON.stringify({x: aMessage.x, y: aMessage.y})); + }, + setEditState: function setEditState(aEditState) { this.editState = aEditState; }, diff --git a/accessible/src/jsat/TouchAdapter.jsm b/accessible/src/jsat/TouchAdapter.jsm index bd1d67f36325..f61e5aa99aed 100644 --- a/accessible/src/jsat/TouchAdapter.jsm +++ b/accessible/src/jsat/TouchAdapter.jsm @@ -227,6 +227,9 @@ this.TouchAdapter = { case 'doubletap-tap': details.type = 'tripletap'; break; + case 'doubletap-dwell': + details.type = 'doubletaphold'; + break; case 'tap-dwell': details.type = 'taphold'; break; @@ -260,6 +263,9 @@ this.TouchAdapter = { if (aDetails.type == 'tap') { emitDelay = 50; aDetails.type = 'doubletap'; + } else if (aDetails.type == 'dwell') { + emitDelay = 50; + aDetails.type = 'doubletaphold'; } else { aDetails.touches.push(this.MOUSE_ID); } diff --git a/accessible/src/jsat/content-script.js b/accessible/src/jsat/content-script.js index f67748f40ae8..92c36b40383a 100644 --- a/accessible/src/jsat/content-script.js +++ b/accessible/src/jsat/content-script.js @@ -156,6 +156,20 @@ function activateCurrent(aMessage) { activateAccessible(vc.position); } +function activateContextMenu(aMessage) { + function sendContextMenuCoordinates(aAccessible) { + let objX = {}, objY = {}, objW = {}, objH = {}; + aAccessible.getBounds(objX, objY, objW, objH); + let x = objX.value + objW.value / 2; + let y = objY.value + objH.value / 2; + sendAsyncMessage('AccessFu:ActivateContextMenu', {x: x, y: y}); + } + + let vc = Utils.getVirtualCursor(content.document); + if (!forwardMessage(vc, aMessage)) + sendContextMenuCoordinates(vc.position); +} + function scroll(aMessage) { let vc = Utils.getVirtualCursor(content.document); @@ -248,6 +262,7 @@ addMessageListener( addMessageListener('AccessFu:VirtualCursor', virtualCursorControl); addMessageListener('AccessFu:Activate', activateCurrent); + addMessageListener('AccessFu:ContextMenu', activateContextMenu); addMessageListener('AccessFu:Scroll', scroll); if (!eventManager) { @@ -263,6 +278,7 @@ addMessageListener( removeMessageListener('AccessFu:VirtualCursor', virtualCursorControl); removeMessageListener('AccessFu:Activate', activateCurrent); + removeMessageListener('AccessFu:ContextMenu', activateContextMenu); removeMessageListener('AccessFu:Scroll', scroll); eventManager.stop();