Index: LayoutTests/fast/regions/resources/helper.js |
diff --git a/LayoutTests/fast/regions/resources/helper.js b/LayoutTests/fast/regions/resources/helper.js |
index 4c290a8536da33ec0d7fd15f7a855934971bfbbc..6cf7d3f6af3ad0268f60138b0723e3deb42d8857 100644 |
--- a/LayoutTests/fast/regions/resources/helper.js |
+++ b/LayoutTests/fast/regions/resources/helper.js |
@@ -202,3 +202,41 @@ function compareArrays(current, expected) { |
} |
testPassed("Array [" + expected.toString() + "] is equal to [" + current.toString() + "]"); |
} |
+ |
+function selectContentByRange(fromX, fromY, toX, toY) { |
+ if (!window.testRunner) |
+ return; |
+ |
+ eventSender.mouseMoveTo(fromX, fromY); |
+ eventSender.mouseDown(); |
+ |
+ eventSender.mouseMoveTo(toX, toY); |
+ eventSender.mouseUp(); |
+} |
+ |
+function selectContentByIds(fromId, toId) { |
+ var fromRect = document.getElementById(fromId).getBoundingClientRect(); |
+ var toRect = document.getElementById(toId).getBoundingClientRect(); |
+ |
+ var fromRectVerticalCenter = fromRect.top + fromRect.height / 2; |
+ var toRectVerticalCenter = toRect.top + toRect.height / 2; |
+ |
+ selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, toRectVerticalCenter); |
+} |
+ |
+function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) { |
+ var from = document.getElementById(fromId); |
+ var to = document.getElementById(toId); |
+ |
+ var selection = window.getSelection(); |
+ selection.setBaseAndExtent(from, fromOffset, to, toOffset); |
+} |
+ |
+function mouseClick(positionX, positionY) { |
+ if (!window.testRunner) |
+ return; |
+ |
+ eventSender.mouseMoveTo(positionX, positionY); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+} |