diff -r b0f738eaff02 chrome/content/browser.js --- a/chrome/content/browser.js Fri Apr 30 16:53:25 2010 -0400 +++ b/chrome/content/browser.js Mon May 03 14:39:23 2010 +0200 @@ -1266,17 +1266,18 @@ var Browser = { }, /** * @param x,y Browser coordinates * @return Element at position, null if no active browser or no element found */ elementFromPoint: function elementFromPoint(x, y) { let browser = this._browserView.getBrowser(); - if (!browser) return null; + if (!browser) + return null; // browser's elementFromPoint expect browser-relative client coordinates. // subtract browser's scroll values to adjust let cwu = BrowserView.Util.getBrowserDOMWindowUtils(browser); let scrollX = {}, scrollY = {}; cwu.getScrollXY(false, scrollX, scrollY); x = x - scrollX.value; y = y - scrollY.value; @@ -1770,19 +1771,20 @@ ContentCustomClicker.prototype = { let browser = this._browserView.getBrowser(); if (browser) { let [x, y] = Browser.transformClientToBrowser(cX, cY); let cwu = BrowserView.Util.getBrowserDOMWindowUtils(browser); let scrollX = {}, scrollY = {}; cwu.getScrollXY(false, scrollX, scrollY); // the element can be out of the cX/cY point because of the touch radius + // ignore the redirection if the element is a HTMLHtmlElement (bug 562981) let rect = Browser.getBoundingContentRect(element); - if (!rect.isEmpty() && ((x < rect.left || (x > rect.left + rect.width)) || - (y < rect.top || (y > rect.top + rect.height)))) { + if (!rect.isEmpty() && !(element instanceof HTMLHtmlElement) && + ((x < rect.left || (x > rect.left + rect.width)) || (y < rect.top || (y > rect.top + rect.height)))) { let point = rect.center(); x = point.x; y = point.y; } x = x - scrollX.value; y = y - scrollY.value; @@ -1938,17 +1940,17 @@ const ElementTouchHelper = { /* Retrieve the closest element to a point by looking at borders position */ getClosest: function getClosest(aWindowUtils, aX, aY) { let target = aWindowUtils.elementFromPoint(aX, aY, true, /* ignore root scroll frame*/ false); /* don't flush layout */ // return early if the click is just over a clickable element - if (!aWindowUtils.nodesFromRect || this._isElementClickable(target)) + if (this._isElementClickable(target)) return target; let nodes = aWindowUtils.nodesFromRect(aX, aY, this.radius.bottom, this.radius.right, this.radius.top, this.radius.left, true, false); let threshold = Number.POSITIVE_INFINITY; diff -r b0f738eaff02 chrome/tests/browser_click_content.html --- a/chrome/tests/browser_click_content.html Fri Apr 30 16:53:25 2010 -0400 +++ b/chrome/tests/browser_click_content.html Mon May 03 14:39:23 2010 +0200 @@ -1,6 +1,6 @@ - + Browser Click Page 01