Bug 773427 - Ensure that when moving click points, we don't allow it to get rounded incorrectly. r=wesj

This commit is contained in:
Kartikaya Gupta 2012-07-24 12:08:40 -04:00
parent 1ca56b02ad
commit 221d163724

View File

@ -3500,7 +3500,7 @@ var BrowserEventHandler = {
for (let i = 0; i < rects.length; i++) {
let rect = rects[i];
let inBounds =
(aX> rect.left && aX < (rect.left + rect.width)) &&
(aX > rect.left && aX < (rect.left + rect.width)) &&
(aY > rect.top && aY < (rect.top + rect.height));
if (inBounds) {
isTouchClick = false;
@ -3511,8 +3511,8 @@ var BrowserEventHandler = {
if (isTouchClick) {
let rect = rects[0];
if (rect.width != 0 || rect.height != 0) {
aX = Math.min(rect.left + rect.width, Math.max(rect.left, aX));
aY = Math.min(rect.top + rect.height, Math.max(rect.top, aY));
aX = Math.min(Math.floor(rect.left + rect.width), Math.max(Math.ceil(rect.left), aX));
aY = Math.min(Math.floor(rect.top + rect.height), Math.max(Math.ceil(rect.top), aY));
}
}
}
@ -3523,7 +3523,7 @@ var BrowserEventHandler = {
let window = aElement.ownerDocument.defaultView;
try {
let cwu = window.top.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
cwu.sendMouseEventToWindow(aName, Math.round(aX), Math.round(aY), 0, 1, 0, true);
cwu.sendMouseEventToWindow(aName, aX, aY, 0, 1, 0, true);
} catch(e) {
Cu.reportError(e);
}