mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 924983 - Introduce context actions. r=yzen
This commit is contained in:
parent
0737cbdf35
commit
b7c403b9cb
@ -735,6 +735,12 @@ var Input = {
|
||||
case 'swipeleft1':
|
||||
this.moveCursor('movePrevious', 'Simple', 'gesture');
|
||||
break;
|
||||
case 'swipeup1':
|
||||
this.contextAction('backward');
|
||||
break;
|
||||
case 'swipedown1':
|
||||
this.contextAction('forward');
|
||||
break;
|
||||
case 'exploreend1':
|
||||
this.activateCurrent(null, true);
|
||||
break;
|
||||
@ -859,6 +865,12 @@ var Input = {
|
||||
origin: 'top', inputType: aInputType});
|
||||
},
|
||||
|
||||
contextAction: function contextAction(aDirection) {
|
||||
// XXX: For now, the only supported context action is adjusting a range.
|
||||
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
|
||||
mm.sendAsyncMessage('AccessFu:AdjustRange', {direction: aDirection});
|
||||
},
|
||||
|
||||
moveByGranularity: function moveByGranularity(aDetails) {
|
||||
const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
|
||||
|
||||
|
@ -331,6 +331,23 @@ function scroll(aMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
function adjustRange(aMessage) {
|
||||
function sendUpDownKey(aAccessible) {
|
||||
let evt = content.document.createEvent('KeyboardEvent');
|
||||
let keycode = aMessage.json.direction == 'forward' ?
|
||||
content.KeyEvent.DOM_VK_DOWN : content.KeyEvent.DOM_VK_UP;
|
||||
evt.initKeyEvent(
|
||||
"keypress", false, true, null, false, false, false, false, keycode, 0);
|
||||
if (aAccessible.DOMNode) {
|
||||
aAccessible.DOMNode.dispatchEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
let position = Utils.getVirtualCursor(content.document).position;
|
||||
if (!forwardToChild(aMessage, adjustRange, position)) {
|
||||
sendUpDownKey(position);
|
||||
}
|
||||
}
|
||||
addMessageListener(
|
||||
'AccessFu:Start',
|
||||
function(m) {
|
||||
@ -344,6 +361,7 @@ addMessageListener(
|
||||
addMessageListener('AccessFu:Activate', activateCurrent);
|
||||
addMessageListener('AccessFu:ContextMenu', activateContextMenu);
|
||||
addMessageListener('AccessFu:Scroll', scroll);
|
||||
addMessageListener('AccessFu:AdjustRange', adjustRange);
|
||||
addMessageListener('AccessFu:MoveCaret', moveCaret);
|
||||
addMessageListener('AccessFu:MoveByGranularity', moveByGranularity);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user