Bug 1478389 [wpt PR 12183] - Locked mouse event check ShouldGenerateAppCommand, a=testonly

Automatic update from web-platform-testsLocked mouse event check ShouldGenerateAppCommand

When pointer is locked, we still need to check ShouldGenerateAppCommand
and set event handled so that won't generate unnecessary navigate
appcommand when kExtendedMouseButtons is enabled. This causes unable
to preventDefault on mouse back/forward buttons to prevent navigation
while pointer is locked.

Bug: 852709
Change-Id: I5f75a68e36037210c38310f8d83825c5efdf311e
Reviewed-on: https://chromium-review.googlesource.com/1148886
Commit-Queue: Ella Ge <eirage@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577889}

--

wpt-commits: 1778b7179d12143b26c0651200257eca39dbc601
wpt-pr: 12183
This commit is contained in:
Ella Ge 2018-07-30 14:56:41 +00:00 коммит произвёл moz-wptsync-bot
Родитель 39b03937d6
Коммит 1ca0bcdfba
2 изменённых файлов: 51 добавлений и 0 удалений

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

@ -13807,6 +13807,12 @@
{}
]
],
"pointerlock/mouse_buttons_back_forward-manual.html": [
[
"/pointerlock/mouse_buttons_back_forward-manual.html",
{}
]
],
"pointerlock/movementX_Y_basic-manual.html": [
[
"/pointerlock/movementX_Y_basic-manual.html",
@ -604152,6 +604158,10 @@
"0838cc19db0518e115adbe07f01b195dc8b5db6f",
"testharness"
],
"pointerlock/mouse_buttons_back_forward-manual.html": [
"0801af4a1f9fc2664a53d7a12d4cbec0092cd1de",
"manual"
],
"pointerlock/movementX_Y_basic-manual.html": [
"45eea8be5393873e6c02331b4aff6f4622be692f",
"manual"

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

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mouse Button Back/Forward</title>
<link rel="author" title="Google" href="http://www.google.com/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var testMouseUp = async_test('Tests that when pointer is locked, the mouseup is preventable.');
var received_back = false;
var received_forward = false;
window.addEventListener('mouseup', function(e) {
if (e.button == 0) {
document.body.requestPointerLock();
} else if (e.button == 3) {
received_back = true;
e.preventDefault();
} else if (e.button == 4) {
received_forward = true;
e.preventDefault();
}
if (document.pointerLockElement && received_back && received_forward) {
testMouseUp.done();
document.exitPointerLock();
}
});
</script>
</head>
<body id="target">
<h4>Test Description: Tests that the mouseup event is prevented.
<ol>
<li>Click the left mouse button to lock pointer</li>
<li>Click the back mouse button</li>
<li>Click the back mouse forward</li>
</ol>
</h4>
</body>
</html>