OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 case "Shift": | 271 case "Shift": |
272 case "Control": | 272 case "Control": |
273 invokeDefault = false; | 273 invokeDefault = false; |
274 break; | 274 break; |
275 } | 275 } |
276 | 276 |
277 if (!handled && invokeDefault) | 277 if (!handled && invokeDefault) |
278 handled = this.defaultKeyHandler(event); | 278 handled = this.defaultKeyHandler(event); |
279 | 279 |
280 if (handled) | 280 if (handled) |
281 event.consume(); | 281 event.consume(true); |
282 | 282 |
283 return handled; | 283 return handled; |
284 }, | 284 }, |
285 | 285 |
286 acceptAutoComplete: function() | 286 acceptAutoComplete: function() |
287 { | 287 { |
288 var result = false; | 288 var result = false; |
289 if (this.isSuggestBoxVisible()) | 289 if (this.isSuggestBoxVisible()) |
290 result = this._suggestBox.acceptSuggestion(); | 290 result = this._suggestBox.acceptSuggestion(); |
291 if (!result) | 291 if (!result) |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 isPrevious = true; | 873 isPrevious = true; |
874 } | 874 } |
875 break; | 875 break; |
876 case "U+004E": // Ctrl+N = Next | 876 case "U+004E": // Ctrl+N = Next |
877 if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !even
t.altKey && !event.shiftKey) | 877 if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !even
t.altKey && !event.shiftKey) |
878 newText = this._next(); | 878 newText = this._next(); |
879 break; | 879 break; |
880 } | 880 } |
881 | 881 |
882 if (newText !== undefined) { | 882 if (newText !== undefined) { |
883 event.consume(); | 883 event.consume(true); |
884 this.text = newText; | 884 this.text = newText; |
885 | 885 |
886 if (isPrevious) { | 886 if (isPrevious) { |
887 var firstNewlineIndex = this.text.indexOf("\n"); | 887 var firstNewlineIndex = this.text.indexOf("\n"); |
888 if (firstNewlineIndex === -1) | 888 if (firstNewlineIndex === -1) |
889 this.moveCaretToEndOfPrompt(); | 889 this.moveCaretToEndOfPrompt(); |
890 else { | 890 else { |
891 var selection = window.getSelection(); | 891 var selection = window.getSelection(); |
892 var selectionRange = document.createRange(); | 892 var selectionRange = document.createRange(); |
893 | 893 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 if (this._suggestTimeout) { | 1126 if (this._suggestTimeout) { |
1127 clearTimeout(this._suggestTimeout); | 1127 clearTimeout(this._suggestTimeout); |
1128 delete this._suggestTimeout; | 1128 delete this._suggestTimeout; |
1129 } | 1129 } |
1130 this._completionsReady(anchorBox, completions, canShowForSingleItem); | 1130 this._completionsReady(anchorBox, completions, canShowForSingleItem); |
1131 }, | 1131 }, |
1132 | 1132 |
1133 _onItemMouseDown: function(text, event) | 1133 _onItemMouseDown: function(text, event) |
1134 { | 1134 { |
1135 this.acceptSuggestion(text); | 1135 this.acceptSuggestion(text); |
1136 event.consume(); | 1136 event.consume(true); |
1137 }, | 1137 }, |
1138 | 1138 |
1139 _createItemElement: function(prefix, text) | 1139 _createItemElement: function(prefix, text) |
1140 { | 1140 { |
1141 var element = document.createElement("div"); | 1141 var element = document.createElement("div"); |
1142 element.className = "suggest-box-content-item source-code"; | 1142 element.className = "suggest-box-content-item source-code"; |
1143 element.tabIndex = -1; | 1143 element.tabIndex = -1; |
1144 if (prefix && prefix.length && !text.indexOf(prefix)) { | 1144 if (prefix && prefix.length && !text.indexOf(prefix)) { |
1145 var prefixElement = element.createChild("span", "prefix"); | 1145 var prefixElement = element.createChild("span", "prefix"); |
1146 prefixElement.textContent = prefix; | 1146 prefixElement.textContent = prefix; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 // Report the event as non-handled if there is no selected item, | 1254 // Report the event as non-handled if there is no selected item, |
1255 // to commit the input or handle it otherwise. | 1255 // to commit the input or handle it otherwise. |
1256 return hasSelectedItem; | 1256 return hasSelectedItem; |
1257 }, | 1257 }, |
1258 | 1258 |
1259 tabKeyPressed: function(event) | 1259 tabKeyPressed: function(event) |
1260 { | 1260 { |
1261 return this.enterKeyPressed(event); | 1261 return this.enterKeyPressed(event); |
1262 } | 1262 } |
1263 } | 1263 } |
OLD | NEW |