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

Unified Diff: third_party/WebKit/LayoutTests/svg/text/selection-dragging-outside-1.html

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, 11 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/selection-dragging-outside-1.html
diff --git a/third_party/WebKit/LayoutTests/svg/text/selection-dragging-outside-1.html b/third_party/WebKit/LayoutTests/svg/text/selection-dragging-outside-1.html
new file mode 100644
index 0000000000000000000000000000000000000000..ed0f77c0a5e74976b51d5e3d3c361ab66ebf33b6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/text/selection-dragging-outside-1.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" style="border: 1px solid black;">
+ <g>
+ <text x="130" y="30" font-family="Arial" font-size="10" fill="black">Happy, Web</text>
+ <text x="130" y="50" font-family="Arial" font-size="10" fill="black">Happy, SVG</text>
+ <text x="130" y="70" font-family="Arial" font-size="10" fill="black">Happy, ;)link</text>
+ </g>
+ <text id="line" x="130" y="150" font-family="Arial" font-size="10" fill="black">Hello World. Hello, SVG.</text>
+</svg>
+<script src="../../resources/js-test.js"></script>
+<script src="resources/SelectionTestCase.js"></script>
+<script type="text/javascript">
+var range;
+function runTest() {
+ selectText('line', 0, 10);
+ verify("0", "11");
+
+ selectText('line', 6, 10);
+ verify("6", "11");
+
+ selectText('line', 12, 23);
+ verify("12", "24");
+
+ selectText('line', 0, 23);
+ verify("0", "24");
+}
+function verify(start, end) {
fs 2016/01/25 13:00:56 Rather than copying these helpers to all test, put
+ range = window.getSelection().getRangeAt(0);
+ shouldBe("range.startOffset", start);
+ shouldBe("range.endOffset", end);
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(0,0);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+}
+
+function selectText(id, start, end) {
+ var element = document.getElementById(id);
+ var startPos = element.getStartPositionOfChar(start);
+ startPos.y += (element.getBBox().height * 1.5);
+ var endPos = element.getEndPositionOfChar(end);
+ endPos.y += (element.getBBox().height * 1.5);
+ var absStartPos = toAbsoluteCoordinates(startPos, element);
+ var absEndPos = toAbsoluteCoordinates(endPos, element);
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(absEndPos.x, absStartPos.y);
+ eventSender.mouseUp();
+ }
+}
+runTest();
+</script>

Powered by Google App Engine
This is Rietveld 408576698