Bug 663829 Checkboxes are difficult to check on Gmail r=wesj

This commit is contained in:
Benjamin Stover 2011-06-23 18:51:02 -07:00
parent b1a593b895
commit ac9d44818e

View File

@ -621,20 +621,25 @@ let Content = {
_sendMouseEvent: function _sendMouseEvent(aName, aElement, aX, aY, aButton) {
// the element can be out of the aX/aY point because of the touch radius
// if outside, we gracefully move the touch point to the center of the element
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))) {
// We might be able to deal with fractional pixels, but mouse events won't.
// Deflate the bounds in by 1 pixel to deal with any fractional scroll offset issues.
let inBounds =
(aX > rect.left + 1 && aX < (rect.left + rect.width - 1)) &&
(aY > rect.top + 1 && aY < (rect.top + rect.height - 1));
if (inBounds) {
isTouchClick = false;
break;
}
}
if (isTouchClick) {
let rect = new Rect(rects[0]);
let rect = new Rect(rects[0].left, rects[0].top, rects[0].width, rects[0].height);
if (rect.isEmpty())
return;