Index: third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js |
diff --git a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js |
index fd9be1ebd4f2447a97e66a8f65fcbfa2d7f7ab99..8248eaf34bf2efd8438fbeb701a2bbfa7072f84a 100644 |
--- a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js |
+++ b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js |
@@ -145,13 +145,23 @@ function selectTextFromCharToPoint(selectionInfo, mouse, expected) { |
selection = window.getSelection(); |
startElementId = selection.anchorNode.parentElement.id; |
endElementId = selection.focusNode.parentElement.id; |
- shouldBeEqualToString("startElementId", expected.startElementId); |
- shouldBe("selection.anchorOffset", expected.start); |
- shouldBeEqualToString("endElementId", expected.endElementId); |
- shouldBe("selection.focusOffset", expected.end); |
+ // TODO(shanmuga.m): It'd be preferable to have the assertions in the actual test-files. |
+ assert_equals(startElementId, expected.startElementId); |
+ assert_equals(selection.anchorOffset, expected.start); |
+ assert_equals(endElementId, expected.endElementId); |
+ assert_equals(selection.focusOffset, expected.end); |
if (window.eventSender) { |
eventSender.mouseMoveTo(0,0); |
eventSender.mouseDown(); |
eventSender.mouseUp(); |
} |
} |
+ |
+function getEndPosition(id, offset, gap) { |
+ var element = document.getElementById(id); |
+ var endPos = element.getEndPositionOfChar(offset); |
+ endPos.x += gap.x; |
+ endPos.y += gap.y; |
+ var absEndPos = toAbsoluteCoordinates(endPos, element); |
+ return absEndPos; |
+} |