forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1767165 - Fix dragend coordinates in child processes after bug 17…
…56241. r=tnikkel Bug 1756241 changed nsDragService::mDragEndPoint to be relative to the window. I didn't realize, but that point is passed as-is to child widgets. Changing the widget event to actually have a widget made the point be interpreted as widget-relative (which is correct in the parent process, but not in the child process). Account for this and fix the mDragEndPoint documentation while at it. Differential Revision: https://phabricator.services.mozilla.com/D145182
- Loading branch information
Showing
6 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!doctype html> | ||
<title>Test for drag event coordinates</title> | ||
<script src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<script src="/tests/SimpleTest/EventUtils.js"></script> | ||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/> | ||
<style> | ||
#draggable { | ||
display: inline-block; | ||
border: 1px solid; | ||
} | ||
</style> | ||
<div draggable="true" id="draggable">Drag me</div> | ||
<script> | ||
add_task(async function test_drag_coords() { | ||
let target = document.getElementById("draggable"); | ||
let coords = {}; | ||
let promises = []; | ||
for (let type of ["dragstart", "dragend"]) { | ||
promises.push(new Promise(function(resolve) { | ||
target.addEventListener(type, function(e) { | ||
info("Got " + e.type); | ||
coords[e.type] = { | ||
screen: { | ||
x: e.screenX, | ||
y: e.screenY, | ||
}, | ||
client: { | ||
x: e.clientX, | ||
y: e.clientY, | ||
}, | ||
}; | ||
resolve(); | ||
}); | ||
})); | ||
} | ||
synthesizePlainDragAndDrop({ | ||
srcElement: target, | ||
srcX: 2, | ||
srcY: 2, | ||
stepX: 10, | ||
stepY: 10, | ||
}); | ||
await Promise.all(promises); | ||
info(JSON.stringify(coords)); | ||
for (let coordType of ["screen", "client"]) { | ||
is(coords.dragend[coordType].x, coords.dragstart[coordType].x + 12, `x ${coordType} is correct`); | ||
is(coords.dragend[coordType].y, coords.dragstart[coordType].y + 12, `y ${coordType} is correct`); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters