Bug 1534562, setPointerCapture should work also in Shadow DOM, r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D23574

--HG--
extra : rebase_source : f92b749784928d8c12d823a0fc3b36e2f7894986
This commit is contained in:
Olli Pettay 2019-03-14 21:40:19 +02:00
Родитель 58380f1019
Коммит d18aece015
3 изменённых файлов: 54 добавлений и 1 удалений

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

@ -1131,7 +1131,7 @@ class Element : public FragmentOrElement {
aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR);
return;
}
if (!IsInUncomposedDoc()) {
if (!IsInComposedDoc()) {
aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}

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

@ -209,6 +209,8 @@ support-files = window_bug1447993.html
skip-if = toolkit == 'android'
[test_bug1484371.html]
support-files = file_bug1484371.html
[test_bug1534562.html]
skip-if = toolkit == 'android' # Bug 1312791
[test_dnd_with_modifiers.html]
[test_hover_mouseleave.html]
[test_marquee_events.html]

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

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1534562
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1534562</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1534562 **/
function runTest() {
var host = document.getElementById("host");
var shadow = host.attachShadow({mode: 'open'});
var shadowDiv = document.createElement('div');
shadowDiv.style.cssText = "height: 100%; width: 100%";
shadowDiv.onpointerdown = function (e) {
shadowDiv.setPointerCapture(e.pointerId);
};
var shadowDivGotPointerMove = false;
shadowDiv.onpointermove = function(e) {
shadowDivGotPointerMove = true;
}
shadow.appendChild(shadowDiv);
host.offsetLeft; // Flush layout.
synthesizeMouseAtCenter(shadowDiv, { type: "mousedown" });
synthesizeMouseAtCenter(document.getElementById("lightDOM"), { type: "mousemove" });
ok(shadowDivGotPointerMove, "shadowDiv should have got pointermove event.");
synthesizeMouseAtCenter(document.getElementById("lightDOM"), { type: "mouseup" });
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1534562">Mozilla Bug 1534562</a>
<div id="host" style="height: 50px; width: 50px;">
</div>
<div id="lightDOM" style="height: 50px; width: 50px;">
</div>
</body>
</html>