Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js

Issue 1541083002: Fix invalid selection produced when dragging mouse outside the SVG text element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5869ecdbdb6fbf664c636587b96855855fe658a7..fd9be1ebd4f2447a97e66a8f65fcbfa2d7f7ab99 100644
--- a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
+++ b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
@@ -130,3 +130,28 @@ function selectRange(id, start, end, expectedText) {
document.getElementById("container").appendChild(textElement);
}
}
+
+function selectTextFromCharToPoint(selectionInfo, mouse, expected) {
+ var element = document.getElementById(selectionInfo.id);
+ var startPos = element.getStartPositionOfChar(selectionInfo.offset);
+ var absStartPos = toAbsoluteCoordinates(startPos, element);
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(mouse.x, mouse.y);
+ eventSender.mouseUp();
+ }
+
+ 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);
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(0,0);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698