Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <style> | 2 <style> |
| 3 text { | 3 text { |
| 4 font: 10px Arial; | 4 font: 10px Arial; |
| 5 } | 5 } |
| 6 </style> | 6 </style> |
| 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin k" width="400" height="400" style="border: 1px solid black;"> | 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin k" width="400" height="400" style="border: 1px solid black;"> |
| 8 <g> | 8 <g> |
| 9 <text id="firsttext" x="130" y="30">Happy, Web</text> | 9 <text id="firsttext" x="130" y="30">Happy, Web</text> |
| 10 <text id="middletext" x="130" y="50">Happy, SVG</text> | 10 <text id="middletext" x="130" y="50">Happy, SVG</text> |
| 11 <text id="endtext" x="130" y="70">Happy, ;)link</text> | 11 <text id="endtext" x="130" y="70">Happy, ;)link</text> |
| 12 </g> | 12 </g> |
| 13 <text id="line" x="130" y="150">Hello World. Hello, SVG.</text> | 13 <text id="line" x="130" y="150">Hello World. Hello, SVG.</text> |
| 14 </svg> | 14 </svg> |
| 15 <script src="../../resources/js-test.js"></script> | 15 <script src="../../resources/testharness.js"></script> |
| 16 <script src="../../resources/testharnessreport.js"></script> | |
| 16 <script src="resources/SelectionTestCase.js"></script> | 17 <script src="resources/SelectionTestCase.js"></script> |
| 17 <script type="text/javascript"> | 18 <script type="text/javascript"> |
| 18 function getEndPosition(id, offset, gap) { | 19 test(function() { |
| 19 var element = document.getElementById(id); | 20 selectTextFromCharToPoint({ id: 'line', offset: 0 }, { x: 400, y: 400 }, { sta rtElementId: 'line', start: 0, endElementId: "line", end: 24 }); |
| 20 var endPos = element.getEndPositionOfChar(offset); | 21 selectTextFromCharToPoint({ id: 'line', offset: 7 }, { x: 400, y: 400 }, { sta rtElementId: "line", start: 7, endElementId: "line", end: 24 }); |
| 21 endPos.x += gap.x; | |
| 22 endPos.y += gap.y; | |
| 23 var absEndPos = toAbsoluteCoordinates(endPos, element); | |
| 24 return absEndPos; | |
| 25 } | |
| 26 | 22 |
| 27 selectTextFromCharToPoint({ id: 'line', offset: 0 }, { x: 400, y: 400 }, { start ElementId: 'line', start: "0", endElementId: "line", end: "24" }); | 23 var absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 0}); |
| 28 selectTextFromCharToPoint({ id: 'line', offset: 7 }, { x: 400, y: 400 }, { start ElementId: "line", start: "7", endElementId: "line", end: "24" }); | 24 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "firsttext", end: 4}); |
| 29 | 25 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 10}); |
| 30 var absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 0}); | 26 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "middletext", end: 4}); |
| 31 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "firsttext", end: "4"}); | 27 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 20}); |
| 32 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 10}); | 28 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "middletext", end: 4}); |
| 33 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); | 29 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 30}); |
| 34 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 20}); | 30 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
| 35 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); | 31 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 40}); |
| 36 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 30}); | 32 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
| 37 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | 33 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 50}); |
| 38 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 40}); | 34 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startEl ementId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
| 39 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | 35 }); |
|
fs
2016/08/22 14:10:05
This test needs either a <title> or an explicit na
Shanmuga Pandi
2016/08/23 07:11:38
Done.
| |
| 40 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 50}); | |
| 41 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | |
| 42 | |
| 43 </script> | 36 </script> |
| OLD | NEW |