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
Родитель d58906d861
Коммит 540dbc7814
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -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