Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / resources / event-sender-util.js
bloba3375762fe2de8c6fe5c991ceac7769cd794c5dd
1 //----------------------------------------------------------------------
2 // JavaScript Library to utilize eventSender conveniently
4 function mouseMoveToElem(element, pos) {
5 var x = element.offsetLeft;
6 var y = element.offsetTop + element.offsetHeight / 2;
8 if (pos == 'left')
9 x += element.offsetWidth / 4;
10 else if (pos == 'right')
11 x += element.offsetWidth * 3 / 4;
12 else
13 x += element.offsetWidth / 2;
15 eventSender.mouseMoveTo(x, y);
18 function dragFromTo(elementFrom, elementTo) {
19 mouseMoveToElem(elementFrom, 'left');
20 eventSender.mouseDown();
21 mouseMoveToElem(elementTo, 'right');
22 eventSender.mouseUp();