mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1278268 - Ensure that no-op mousemove synthesizations on Windows still fire a mousemove event. r=jimm
MozReview-Commit-ID: EXZtvqy1BLu --HG-- extra : rebase_source : 7dcaa9370c0733267940ad8374bf783cde65e9e7
This commit is contained in:
parent
c96dfeb86e
commit
bea6d03a52
@ -245,19 +245,13 @@ function synthesizeNativeClick(aElement, aX, aY, aObserver = null) {
|
|||||||
// Move the mouse to (dx, dy) relative to |element|, and scroll the wheel
|
// Move the mouse to (dx, dy) relative to |element|, and scroll the wheel
|
||||||
// at that location.
|
// at that location.
|
||||||
// Moving the mouse is necessary to avoid wheel events from two consecutive
|
// Moving the mouse is necessary to avoid wheel events from two consecutive
|
||||||
// scrollWheelOver() calls on different elements being incorreclty considered
|
// moveMouseAndScrollWheelOver() calls on different elements being incorrectly
|
||||||
// as part of t he same wheel transaction.
|
// considered as part of the same wheel transaction.
|
||||||
// We also wait for the mouse move event to be processed before sending the
|
// We also wait for the mouse move event to be processed before sending the
|
||||||
// wheel event, otherwise there is a chance they might get reordered, and
|
// wheel event, otherwise there is a chance they might get reordered, and
|
||||||
// we have the transaction problem again.
|
// we have the transaction problem again.
|
||||||
// XXX FOOTGUN: On Windows, if the mouse cursor is already at the target
|
|
||||||
// position, the mouse-move event doesn't get dispatched, and
|
|
||||||
// we end up hanging waiting for it. As a result, care must
|
|
||||||
// be taken that the mouse isn't already at the target position
|
|
||||||
// when using this function.
|
|
||||||
function moveMouseAndScrollWheelOver(element, dx, dy, testDriver) {
|
function moveMouseAndScrollWheelOver(element, dx, dy, testDriver) {
|
||||||
return synthesizeNativeMouseMoveAndWaitForMoveEvent(element, dx, dy, function() {
|
return synthesizeNativeMouseMoveAndWaitForMoveEvent(element, dx, dy, function() {
|
||||||
synthesizeNativeWheelAndWaitForScrollEvent(element, dx, dy, 0, -10, testDriver);
|
synthesizeNativeWheelAndWaitForScrollEvent(element, dx, dy, 0, -10, testDriver);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6041,6 +6041,12 @@ nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
|||||||
{
|
{
|
||||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||||
|
|
||||||
|
if (aNativeMessage == MOUSEEVENTF_MOVE) {
|
||||||
|
// Reset sLastMouseMovePoint so that even if we're moving the mouse
|
||||||
|
// to the position it's already at, we still dispatch a mousemove
|
||||||
|
// event, because the callers of this function expect that.
|
||||||
|
sLastMouseMovePoint = {0};
|
||||||
|
}
|
||||||
::SetCursorPos(aPoint.x, aPoint.y);
|
::SetCursorPos(aPoint.x, aPoint.y);
|
||||||
|
|
||||||
INPUT input;
|
INPUT input;
|
||||||
|
Loading…
Reference in New Issue
Block a user