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

Side by Side Diff: LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html

Issue 1072403007: Fixup a bug about SVG text selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Draft 19 Created 5 years, 7 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
« no previous file with comments | « no previous file | LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Test for selection with collapsed whitespace</title>
3 <body>
4 This test checks that characters can be selected correctly with collapsed whites pace.
5 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin k" width="300" height="300">
6 <text id="text1" x="20" y="20"> happy debugging !!</text>
7 <text id="text2" x="20" y="40"> <tspan id="tspan1" style="font-weight: bol d;">happy</tspan> debugging !!</text>
8 <text id="text3" x="20" y="80"> <tspan id="tspan2" style="font-size: 25px; ">happy</tspan> debugging !!</text>
9 <text id="text4" x="20" y="230" fill="black" transform="scale(0.5)" font-size= "40"> happy debugging !!</text>
10 </svg>
11 <script src="../../resources/js-test.js"></script>
12 <script src="resources/SelectionTestCase.js"></script>
13 <script type="text/javascript">
14 var range;
15 function runTest() {
16
17 if (!window.testRunner)
18 return;
19
20 selectText('text1', 0, 3);
21 verify("5", "9");
22
23 selectText('text1', 0, 8);
24 verify("5", "24");
25
26 selectText('text1', 4, 9);
27 verify("9", "25");
28
29 selectText('text2', 0, 3);
30 verify("0", "4");
31
32 selectText('text2', 0, 8);
33 verify("0", "14");
34
35 selectText('text2', 3, 9);
36 verify("3", "15");
37
38 selectText('text3', 0, 3);
39 verify("0", "4");
40
41 selectText('text3', 0, 10);
42 verify("0", "15");
43
44 selectText('text3', 2, 14);
45 verify("2", "19");
46
47 selectText('text4', 0, 3);
48 verify("5", "9");
49
50 selectText('text4', 0, 8);
51 verify("5", "24");
52
53 selectText('text4', 6, 11);
54 verify("21", "27")
55 }
56
57 function verify(start, end) {
58 range = window.getSelection().getRangeAt(0);
59 shouldBe("range.startOffset", start);
60 shouldBe("range.endOffset", end);
61 if (window.eventSender) {
62 eventSender.mouseMoveTo(0,0);
63 eventSender.mouseDown();
64 eventSender.mouseUp();
65 }
66 }
67
68 function selectText(id, start, end) {
69 var element = document.getElementById(id);
70 var startPos = element.getStartPositionOfChar(start);
71 var endPos = element.getEndPositionOfChar(end);
72 var absStartPos = toAbsoluteCoordinates(startPos, element);
73 var absEndPos = toAbsoluteCoordinates(endPos, element);
74 if (window.eventSender) {
75 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
76 eventSender.mouseDown();
77 eventSender.mouseMoveTo(absEndPos.x, absEndPos.y);
78 eventSender.mouseUp();
79 }
80 }
81
82 runTest();
83 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698