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

Side by Side Diff: LayoutTests/svg/text/resources/SelectionTestCase.js

Issue 1108033002: Fix "mouse" position selection in svg/text/resources/SelectionTestCase.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 if (window.eventSender) { 64 if (window.eventSender) {
65 // Trigger 'partial glyph selection' code, by adjusting the end x positi on by half glyph width 65 // Trigger 'partial glyph selection' code, by adjusting the end x positi on by half glyph width
66 var xOld = endPos.x; 66 var xOld = endPos.x;
67 endPos.x -= endExtent.width / 2 - 1; 67 endPos.x -= endExtent.width / 2 - 1;
68 68
69 var absStartPos = toAbsoluteCoordinates(startPos, element); 69 var absStartPos = toAbsoluteCoordinates(startPos, element);
70 var absEndPos = toAbsoluteCoordinates(endPos, element); 70 var absEndPos = toAbsoluteCoordinates(endPos, element);
71 71
72 // Round the points "inwards" to avoid being affected by the truncation
73 // taking place in eventSender.mouseMoveTo(...).
74 absStartPos.x = Math.ceil(absStartPos.x);
hyunjunekim2 2015/04/28 02:22:07 Could you change like this? absStartPos.x = Math.c
pdr. 2015/04/28 03:08:39 Why?
75 absEndPos.x = Math.floor(absEndPos.x);
76
72 // Move to selection origin and hold down mouse 77 // Move to selection origin and hold down mouse
73 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y); 78 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
74 eventSender.mouseDown(); 79 eventSender.mouseDown();
75 80
76 // Move again to start selection 81 // Move again to start selection
77 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y); 82 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
78 83
79 // Move to end location and release mouse 84 // Move to end location and release mouse
80 eventSender.mouseMoveTo(absEndPos.x, absEndPos.y); 85 eventSender.mouseMoveTo(absEndPos.x, absEndPos.y);
81 eventSender.mouseUp(); 86 eventSender.mouseUp();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text"); 122 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text");
118 textElement.setAttribute("x", "0"); 123 textElement.setAttribute("x", "0");
119 textElement.setAttribute("y", "35"); 124 textElement.setAttribute("y", "35");
120 textElement.setAttribute("fill", "red"); 125 textElement.setAttribute("fill", "red");
121 textElement.setAttribute("transform", "scale(0.5)"); 126 textElement.setAttribute("transform", "scale(0.5)");
122 textElement.setAttribute("font-size", "8"); 127 textElement.setAttribute("font-size", "8");
123 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'"; 128 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'";
124 document.getElementById("container").appendChild(textElement); 129 document.getElementById("container").appendChild(textElement);
125 } 130 }
126 } 131 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698