From 625b28b9c48b65229372b72bb5cec8b3a4711ba0 Mon Sep 17 00:00:00 2001
From: Kartikaya Gupta <kgupta@mozilla.com>
Date: Tue, 24 Jul 2012 12:08:40 -0400
Subject: [PATCH] Bug 773427 - Ensure that when moving click points, we don't
 allow it to get rounded incorrectly. r=wesj

---
 mobile/android/chrome/content/browser.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
index 5f9173031ee4..442fd8110617 100644
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -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);
     }