Bug 575295 - Clicking links broken after scrolling via in-page (uri fragment) link [r=vingtetun]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 29 Jun 2010 20:34:48 +0200
changeset 66331 55a1b13435088238ba735e30b21e91b2e6525cb1
parent 66330 4fd1df1617f55cebe1961dd3c822cc740b6c8036
child 66332 96ef534a1ab7fe50635e44248e684ce9facd312e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs575295
Bug 575295 - Clicking links broken after scrolling via in-page (uri fragment) link [r=vingtetun]
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -547,20 +547,16 @@ Content.prototype = {
           rect = getBoundingContentRect(element);
         sendAsyncMessage("Browser:ZoomToPoint:Return", { x: x, y: y, rect: rect });
         break;
       }
     }
   },
 
   _sendMouseEvent: function _sendMouseEvent(aName, aElement, aX, aY) {
-    let scrollOffset = Util.getScrollOffset(content);
-    aX -= scrollOffset.x;
-    aY -= scrollOffset.y;
-
     // the element can be out of the aX/aY point because of the touch radius
     if (!(aElement instanceof HTMLHtmlElement)) {
       let isTouchClick = true;
       let rects = getContentClientRects(aElement);
       for (let i = 0; i < rects.length; i++) {
         let rect = rects[i];
         if ((aX > rect.left && aX < (rect.left + rect.width)) &&
             (aY > rect.top && aY < (rect.top + rect.height))) {
@@ -572,18 +568,19 @@ Content.prototype = {
       if (isTouchClick) {
         let rect = rects[0];
         let point = (new Rect(rect.left, rect.top, rect.width, rect.height)).center();
         aX = point.x;
         aY = point.y;
       }
     }
 
+    let scrollOffset = Util.getScrollOffset(content);
     let windowUtils = Util.getWindowUtils(content);
-    windowUtils.sendMouseEvent(aName, aX, aY, 0, 1, 0, true);
+    windowUtils.sendMouseEvent(aName, aX - scrollOffset.x, aY - scrollOffset.y, 0, 1, 0, true);
   },
 
   startLoading: function startLoading() {
     this._loading = true;
     this._coalescer.start();
   },
 
   stopLoading: function stopLoading() {
@@ -820,9 +817,9 @@ var FormSubmitObserver = {
     if (!aIID.equals(Ci.nsIFormSubmitObserver) &&
         !aIID.equals(Ci.nsISupportsWeakReference) &&
         !aIID.equals(Ci.nsISupports))
       throw Components.results.NS_ERROR_NO_INTERFACE;
     return this;
   }
 };
 
-FormSubmitObserver.init();
\ No newline at end of file
+FormSubmitObserver.init();