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

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

Issue 18503004: Have SVGTextContentElement inherit SVGGraphicsElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Really remove SVGLocatable IDL interface Created 7 years, 5 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 | LayoutTests/svg/text/selection-doubleclick.svg » ('j') | 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 11 matching lines...) Expand all
22 22
23 var newRect = svgRoot.createSVGRect(); 23 var newRect = svgRoot.createSVGRect();
24 newRect.x = topLeft.x; 24 newRect.x = topLeft.x;
25 newRect.y = topLeft.y; 25 newRect.y = topLeft.y;
26 newRect.width = bottomRight.x - topLeft.x; 26 newRect.width = bottomRight.x - topLeft.x;
27 newRect.height = bottomRight.y - topLeft.y; 27 newRect.height = bottomRight.y - topLeft.y;
28 return newRect; 28 return newRect;
29 } 29 }
30 30
31 function toAbsoluteCoordinates(point, element) { 31 function toAbsoluteCoordinates(point, element) {
32 return transformPoint(point, document.rootElement.getTransformToElement(elem ent)); 32 // getScreenCTM() returns the transformation matrix from current user units (i.e., after application of the ‘transform’ property)
33 // to the parent user agent's notice of a "pixel".
34 return transformPoint(point, element.getScreenCTM());
33 } 35 }
34 36
35 // Select a range of characters in text element 'id', from the start position of the 'start' character to the end position of the 'end' character 37 // Select a range of characters in text element 'id', from the start position of the 'start' character to the end position of the 'end' character
36 function selectRange(id, start, end, expectedText) { 38 function selectRange(id, start, end, expectedText) {
37 var element = document.getElementById(id); 39 var element = document.getElementById(id);
38 var startExtent = element.getExtentOfChar(start); 40 var startExtent = element.getExtentOfChar(start);
39 var endExtent = element.getExtentOfChar(end); 41 var endExtent = element.getExtentOfChar(end);
40 42
41 var startPos = element.getStartPositionOfChar(start); 43 var startPos = element.getStartPositionOfChar(start);
42 var endPos = element.getEndPositionOfChar(end); 44 var endPos = element.getEndPositionOfChar(end);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text"); 117 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "svg:text");
116 textElement.setAttribute("x", "0"); 118 textElement.setAttribute("x", "0");
117 textElement.setAttribute("y", "35"); 119 textElement.setAttribute("y", "35");
118 textElement.setAttribute("fill", "red"); 120 textElement.setAttribute("fill", "red");
119 textElement.setAttribute("transform", "scale(0.5)"); 121 textElement.setAttribute("transform", "scale(0.5)");
120 textElement.setAttribute("font-size", "8"); 122 textElement.setAttribute("font-size", "8");
121 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'"; 123 textElement.textContent = "Expected '" + expectedText + "' to be selecte d, got: '" + actualText + "'";
122 document.getElementById("container").appendChild(textElement); 124 document.getElementById("container").appendChild(textElement);
123 } 125 }
124 } 126 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/text/selection-doubleclick.svg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698