Commit 7d9b96a1 authored by Shannon Chen's avatar Shannon Chen Committed by Commit Bot

Allow the option to send selected mouse key event

Add a rightMouseKey in SyntheticMouseEvent in accessibility API to allow the option of
sending the event on the selected mouse key (left, right, middle, forward, back).
Signed-off-by: default avatarShannon Chen <shannc@chromium.org>
Bug: None
Change-Id: Ib5cd2b1ac30dc7a5efe41b09e0bc17650916ad7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2531094
Commit-Queue: Shannon Chen <shannc@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826676}
parent b8a68ab6
......@@ -339,8 +339,24 @@ AccessibilityPrivateSendSyntheticMouseEventFunction::Run() {
}
int flags = 0;
if (type != ui::ET_MOUSE_MOVED)
flags |= ui::EF_LEFT_MOUSE_BUTTON;
if (type != ui::ET_MOUSE_MOVED) {
switch (mouse_data->mouse_button) {
case accessibility_private::SYNTHETIC_MOUSE_EVENT_BUTTON_MIDDLE:
flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
break;
case accessibility_private::SYNTHETIC_MOUSE_EVENT_BUTTON_RIGHT:
flags |= ui::EF_RIGHT_MOUSE_BUTTON;
break;
case accessibility_private::SYNTHETIC_MOUSE_EVENT_BUTTON_BACK:
flags |= ui::EF_BACK_MOUSE_BUTTON;
break;
case accessibility_private::SYNTHETIC_MOUSE_EVENT_BUTTON_FOWARD:
flags |= ui::EF_FORWARD_MOUSE_BUTTON;
break;
default:
flags |= ui::EF_LEFT_MOUSE_BUTTON;
}
}
int changed_button_flags = flags;
......
......@@ -121,6 +121,12 @@
"description": "The type of event to send",
"enum": ["press", "release", "drag", "move", "enter", "exit"]
},
{
"id": "SyntheticMouseEventButton",
"type": "string",
"description": "The button to send event on",
"enum": ["left", "middle", "right", "back", "foward"]
},
{
"id": "SyntheticMouseEvent",
"type": "object",
......@@ -132,6 +138,11 @@
"type": "boolean",
"description": "True if the touch accessibility flag should be set.",
"optional": true
},
"mouseButton": {
"$ref": "SyntheticMouseEventButton",
"description": "The default mouse button is set to left if mouseButton is not specified.",
"optional": true
}
}
},
......
......@@ -155,12 +155,24 @@ chrome.accessibilityPrivate.SyntheticMouseEventType = {
EXIT: 'exit',
};
/**
* @enum {string}
*/
chrome.accessibilityPrivate.SyntheticMouseEventButton = {
LEFT: 'left',
MIDDLE: 'middle',
RIGHT: 'right',
BACK: 'back',
FOWARD: 'foward',
};
/**
* @typedef {{
* type: !chrome.accessibilityPrivate.SyntheticMouseEventType,
* x: number,
* y: number,
* touchAccessibility: (boolean|undefined)
* touchAccessibility: (boolean|undefined),
* mouseButton: (!chrome.accessibilityPrivate.SyntheticMouseEventButton|undefined)
* }}
*/
chrome.accessibilityPrivate.SyntheticMouseEvent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment