Add method to synthesize mouse events at the center of elements. (Bug 595652) r=Mossop a2.0=blocking2.0:betaN

This commit is contained in:
L. David Baron 2010-10-11 11:03:12 -07:00
parent 12dfd62e83
commit ea2a79ff50

View File

@ -230,6 +230,14 @@ function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
}
}
// Call synthesizeMouse with coordinates at the center of aTarget.
function synthesizeMouseAtCenter(aTarget, aEvent, aWindow)
{
var rect = aTarget.getBoundingClientRect();
synthesizeMouse(aTarget, rect.width / 2, rect.height / 2, aEvent,
aWindow);
}
/**
* Synthesize a mouse scroll event on a target. The actual client point is determined
* by taking the aTarget's client box and offseting it by aOffsetX and