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

Side by Side 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 unified diff | Download patch
OLDNEW
1 if (!window.eventSender || !window.testRunner) { 1 if (!window.eventSender || !window.testRunner) {
2 alert('This test needs to be run in DRT, to get results!'); 2 alert('This test needs to be run in DRT, to get results!');
3 } 3 }
4 4
5 var svgRoot = 0; 5 var svgRoot = 0;
6 6
7 // Map 'point' into absolute coordinates, usable for eventSender 7 // Map 'point' into absolute coordinates, usable for eventSender
8 function transformPoint(point, matrix) { 8 function transformPoint(point, matrix) {
9 return point.matrixTransform(matrix); 9 return point.matrixTransform(matrix);
10 } 10 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text"); 123 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text");
124 textElement.setAttribute("x", "0"); 124 textElement.setAttribute("x", "0");
125 textElement.setAttribute("y", "35"); 125 textElement.setAttribute("y", "35");
126 textElement.setAttribute("fill", "red"); 126 textElement.setAttribute("fill", "red");
127 textElement.setAttribute("transform", "scale(0.5)"); 127 textElement.setAttribute("transform", "scale(0.5)");
128 textElement.setAttribute("font-size", "8"); 128 textElement.setAttribute("font-size", "8");
129 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'"; 129 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'";
130 document.getElementById("container").appendChild(textElement); 130 document.getElementById("container").appendChild(textElement);
131 } 131 }
132 } 132 }
133
134 function selectTextFromCharToPoint(selectionInfo, mouse, expectedRange) {
135 var element = document.getElementById(selectionInfo.id);
136 var startPos = element.getStartPositionOfChar(selectionInfo.offset);
137 var absStartPos = toAbsoluteCoordinates(startPos, element);
138 if (window.eventSender) {
139 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
140 eventSender.mouseDown();
141 eventSender.mouseMoveTo(mouse.x, mouse.y);
142 eventSender.mouseUp();
143 }
144
145 range = window.getSelection().getRangeAt(0);
146 shouldBe("range.startOffset", expectedRange.start);
fs 2016/02/12 17:05:42 You should check for an expected element here too.
hyunjunekim2 2016/02/15 13:34:20 Done.
147 shouldBe("range.endOffset", expectedRange.end);
148 if (window.eventSender) {
149 eventSender.mouseMoveTo(0,0);
150 eventSender.mouseDown();
151 eventSender.mouseUp();
152 }
153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698