OLD | NEW |
1 <svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:
xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" vi
ewBox="0 0 160 120"> | 1 <svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:
xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" vi
ewBox="0 0 160 120"> |
2 <text id="line1" x="14" y="10" font-family="Arial" font-size="10" fill="blac
k">foo bar baz</text> | 2 <text id="line1" x="14" y="10" font-family="Arial" font-size="10" fill="blac
k">foo bar baz</text> |
3 <text id="line2" x="14" y="20" font-family="Arial" font-size="10" fill="blac
k">next line</text> | 3 <text id="line2" x="14" y="20" font-family="Arial" font-size="10" fill="blac
k">next line</text> |
4 <script> | 4 <script> |
5 var line1 = document.getElementById("line1"); | 5 var line1 = document.getElementById("line1"); |
6 var center = document.rootElement.createSVGPoint(); | 6 var center = document.rootElement.createSVGPoint(); |
7 var matrix = document.rootElement.getTransformToElement(line1); | 7 var matrix = line1.getScreenCTM(); |
8 var bbox = line1.getBBox(); | 8 var bbox = line1.getBBox(); |
9 | 9 |
10 center.x = bbox.x + bbox.width/2; | 10 center.x = bbox.x + bbox.width/2; |
11 center.y = bbox.y + bbox.height/2; | 11 center.y = bbox.y + bbox.height/2; |
12 center = center.matrixTransform(matrix); | 12 center = center.matrixTransform(matrix); |
13 | 13 |
14 if (eventSender) { | 14 if (eventSender) { |
15 eventSender.mouseMoveTo(center.x, center.y); | 15 eventSender.mouseMoveTo(center.x, center.y); |
16 eventSender.mouseDown(); | 16 eventSender.mouseDown(); |
17 eventSender.mouseUp(); | 17 eventSender.mouseUp(); |
18 eventSender.mouseDown(); | 18 eventSender.mouseDown(); |
19 eventSender.mouseUp(); | 19 eventSender.mouseUp(); |
20 } | 20 } |
21 | 21 |
22 if (window.testRunner) | 22 if (window.testRunner) |
23 window.testRunner.dumpSelectionRect(); | 23 window.testRunner.dumpSelectionRect(); |
24 </script> | 24 </script> |
25 </svg> | 25 </svg> |
OLD | NEW |