зеркало из https://github.com/mozilla/gecko-dev.git
bug 1447196, canceling pointerdown should not affect to scrollbar handling, r=masayuki
--HG-- extra : rebase_source : 3234983256e2d68e0ac6b21f5293b23bf6017b11
This commit is contained in:
Родитель
8f930c02f7
Коммит
8d1253d263
|
@ -388,6 +388,7 @@ PointerEventHandler::PreHandlePointerEventsPreventDefault(
|
|||
return;
|
||||
}
|
||||
aMouseOrTouchEvent->PreventDefault(false);
|
||||
aMouseOrTouchEvent->mFlags.mOnlyChromeDispatch = true;
|
||||
if (aPointerEvent->mMessage == ePointerUp) {
|
||||
pointerInfo->mPreventMouseEventByContent = false;
|
||||
}
|
||||
|
@ -417,6 +418,7 @@ PointerEventHandler::PostHandlePointerEventsPreventDefault(
|
|||
return;
|
||||
}
|
||||
aMouseOrTouchEvent->PreventDefault(false);
|
||||
aMouseOrTouchEvent->mFlags.mOnlyChromeDispatch = true;
|
||||
pointerInfo->mPreventMouseEventByContent = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,44 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1303704
|
|||
<script type="text/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"/>
|
||||
<style>
|
||||
#scrollable {
|
||||
height: 100px;
|
||||
width: 300px;
|
||||
overflow-y: scroll;
|
||||
margin-bottom: 50px;
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1303704">Mozilla Bug 1303704</a>
|
||||
<p id="display"></p>
|
||||
<a id="link1" href="http://www.google.com">Link 1</a>
|
||||
<div id="scrollable">
|
||||
<pre>
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
scroll
|
||||
</pre>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
/** Test for Bug 1303704 **/
|
||||
|
@ -36,7 +69,6 @@ function runTests() {
|
|||
|
||||
link1.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
synthesizeMouseAtCenter(link1, { type: "mousedown",
|
||||
|
@ -45,6 +77,42 @@ function runTests() {
|
|||
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
|
||||
synthesizeMouseAtCenter(link1, { type: "mouseup",
|
||||
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
|
||||
|
||||
if (navigator.userAgent.includes("Android") ||
|
||||
navigator.userAgent.includes("Mac") ||
|
||||
SpecialPowers.Cc["@mozilla.org/gfx/info;1"].
|
||||
getService(SpecialPowers.Ci.nsIGfxInfo).isHeadless) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var scrollable = document.getElementById("scrollable");
|
||||
scrollable.addEventListener('pointerdown', function(ev) {
|
||||
ev.preventDefault();
|
||||
});
|
||||
is(scrollable.scrollTop, 0,
|
||||
"Scrollable element shouldn't be scrolled initially");
|
||||
var rect = scrollable.getBoundingClientRect();
|
||||
var offsetX = rect.width - 4;
|
||||
var offsetY = rect.height - 4
|
||||
synthesizeMouse(scrollable, offsetX, offsetY,
|
||||
{ type: "mousedown",
|
||||
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
|
||||
|
||||
synthesizeMouse(scrollable, offsetX, offsetY,
|
||||
{ type: "mousemove",
|
||||
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
|
||||
|
||||
synthesizeMouse(scrollable, offsetX, offsetY,
|
||||
{ type: "mouseup",
|
||||
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
|
||||
requestAnimationFrame(function() {
|
||||
setTimeout(function() {
|
||||
isnot(scrollable.scrollTop, 0,
|
||||
"Scrollable element should have been scrolled.");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(() => {
|
||||
|
|
|
@ -459,16 +459,6 @@ WidgetEvent::IsAllowedToDispatchDOMEvent() const
|
|||
{
|
||||
switch (mClass) {
|
||||
case eMouseEventClass:
|
||||
// When content PreventDefault on ePointerDown, we will stop dispatching
|
||||
// the subsequent mouse events (eMouseDown, eMouseUp, eMouseMove). But we
|
||||
// still need the mouse events to be handled in EventStateManager to
|
||||
// generate other events (e.g. eMouseClick). So we only stop dispatching
|
||||
// them to DOM.
|
||||
if (DefaultPreventedByContent() &&
|
||||
(mMessage == eMouseMove || mMessage == eMouseDown ||
|
||||
mMessage == eMouseUp)) {
|
||||
return false;
|
||||
}
|
||||
if (mMessage == eMouseTouchDrag) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче