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

Side by Side Diff: LayoutTests/editing/selection/resources/extend-selection.js

Issue 14930006: Ctrl+Shift+Right in Windows should select the spacing after the word (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added expectations for chromium-mac for delete-cell-contents-win.html Created 7 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
OLDNEW
1 function log(message) 1 function log(message)
2 { 2 {
3 document.getElementById("console").appendChild(document.createTextNode(messa ge)); 3 document.getElementById("console").appendChild(document.createTextNode(messa ge));
4 } 4 }
5 5
6 function getSerializedSelection() 6 function getSerializedSelection()
7 { 7 {
8 return { 8 return {
9 node: getSelection().extentNode, 9 node: getSelection().extentNode,
10 begin: getSelection().baseOffset, 10 begin: getSelection().baseOffset,
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 for (var index = 0; index < leftIterations; ++index) { 31 for (var index = 0; index < leftIterations; ++index) {
32 positions.push(getSerializedSelection()); 32 positions.push(getSerializedSelection());
33 getSelection().modify("extend", direction, granularity); 33 getSelection().modify("extend", direction, granularity);
34 } 34 }
35 35
36 return positions; 36 return positions;
37 } 37 }
38 38
39 function extendSelectionWithinBlockWin(direction, granularity)
40 {
41 if (granularity === "character")
42 return extendSelectionWithinBlock(direction, granularity);
43
44 var positions = [];
45
46 if (direction === "right") {
47 positions.push(getSerializedSelection());
48 getSelection().modify("extend", "right", granularity);
49
50 for (var index = 0; index < 3; ++index) {
51 positions.push(getSerializedSelection());
52 getSelection().modify("extend", "left", granularity);
53 }
54
55 positions.push(getSerializedSelection());
56 getSelection().modify("extend", "right", granularity);
57
58 positions.push(getSerializedSelection());
59 } else {
60 for (var index = 0; index < 2; ++index) {
61 positions.push(getSerializedSelection());
62 getSelection().modify("extend", "left", granularity);
63 }
64 for (var index = 0; index < 3; ++index) {
65 positions.push(getSerializedSelection());
66 getSelection().modify("extend", "right", granularity);
67 }
68 }
69 return positions;
70 }
71
39 function extendSelectionToEnd(direction, granularity) 72 function extendSelectionToEnd(direction, granularity)
40 { 73 {
41 var positions = []; 74 var positions = [];
42 do { 75 do {
43 var position = getSerializedSelection(); 76 var position = getSerializedSelection();
44 positions.push(position); 77 positions.push(position);
45 getSelection().modify("extend", direction, granularity); 78 getSelection().modify("extend", direction, granularity);
46 } while (position.node !== getSerializedSelection().node || position.end !== getSerializedSelection().end); 79 } while (position.node !== getSerializedSelection().node || position.end !== getSerializedSelection().end);
47 return positions; 80 return positions;
48 } 81 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 function extendAndLogSelection(functionToExtendSelection, direction, granularity ) 134 function extendAndLogSelection(functionToExtendSelection, direction, granularity )
102 { 135 {
103 var positions = functionToExtendSelection(direction, granularity); 136 var positions = functionToExtendSelection(direction, granularity);
104 logPositions(positions); 137 logPositions(positions);
105 log("\n"); 138 log("\n");
106 return positions; 139 return positions;
107 } 140 }
108 141
109 function extendAndLogSelectionWithinBlock(direction, granularity, platform) 142 function extendAndLogSelectionWithinBlock(direction, granularity, platform)
110 { 143 {
111 return extendAndLogSelection({'mac': extendSelectionWithinBlock}[platform], direction, granularity); 144 return extendAndLogSelection({'mac': extendSelectionWithinBlock, 'win': exte ndSelectionWithinBlockWin}[platform], direction, granularity);
112 } 145 }
113 146
114 function extendAndLogSelectionToEnd(direction, granularity) 147 function extendAndLogSelectionToEnd(direction, granularity)
115 { 148 {
116 return extendAndLogSelection(extendSelectionToEnd, direction, granularity); 149 return extendAndLogSelection(extendSelectionToEnd, direction, granularity);
117 } 150 }
118 151
119 function runSelectionTestsWithGranularity(testNodes, granularity) 152 function runSelectionTestsWithGranularity(testNodes, granularity)
120 { 153 {
121 for (var i = 0; i < testNodes.length; ++i) { 154 for (var i = 0; i < testNodes.length; ++i) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 312
280 if (window.testRunner) { 313 if (window.testRunner) {
281 var originalOnload = window.onload; 314 var originalOnload = window.onload;
282 window.onload = function() { 315 window.onload = function() {
283 if (originalOnload) 316 if (originalOnload)
284 originalOnload(); 317 originalOnload();
285 testRunner.dumpAsText(); 318 testRunner.dumpAsText();
286 document.body.removeChild(getTestNodeContainer()); 319 document.body.removeChild(getTestNodeContainer());
287 }; 320 };
288 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698