Bug 1686625 - Use proper numbers for mouse 4th/5th buttons r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D101855
This commit is contained in:
Kagami Sascha Rosylight 2021-01-15 01:39:35 +00:00
Родитель bbfb26d085
Коммит d4ad0997cf
2 изменённых файлов: 26 добавлений и 2 удалений

Просмотреть файл

@ -8059,9 +8059,9 @@ int16_t nsContentUtils::GetButtonsFlagForButton(int32_t aButton) {
return MouseButtonsFlag::eMiddleFlag;
case MouseButton::eSecondary:
return MouseButtonsFlag::eSecondaryFlag;
case 4:
case 3:
return MouseButtonsFlag::e4thFlag;
case 5:
case 4:
return MouseButtonsFlag::e5thFlag;
default:
NS_ERROR("Button not known.");

Просмотреть файл

@ -55,6 +55,28 @@ function test_sendMouseEventOptionals() {
false, pressure, source, false);
}
function test_sendMouseEvent4thButton() {
const x = 1, y = 2, button = 3, clickCount = 1, modifiers = 0;
window.addEventListener("mousedown", evt => {
is(evt.buttons, 2 ** button, "check button");
SimpleTest.executeSoon(next);
}, { once: true });
utils.sendMouseEvent("mousedown", x, y, button, clickCount, modifiers);
}
function test_sendMouseEvent5thButton() {
const x = 1, y = 2, button = 4, clickCount = 1, modifiers = 0;
window.addEventListener("mousedown", evt => {
is(evt.buttons, 2 ** button, "check button");
SimpleTest.executeSoon(next);
}, { once: true });
utils.sendMouseEvent("mousedown", x, y, button, clickCount, modifiers);
}
function test_getUnanimatedComputedStyle() {
SpecialPowers.pushPrefEnv(
{
@ -77,6 +99,8 @@ function test_setDynamicToolbarMaxHeight() {
var tests = [
test_sendMouseEventDefaults,
test_sendMouseEventOptionals,
test_sendMouseEvent4thButton,
test_sendMouseEvent5thButton,
test_getUnanimatedComputedStyle,
test_setDynamicToolbarMaxHeight
];