OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple 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 are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * 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 }, | 271 }, |
272 | 272 |
273 _handleKeyDown: function(e) | 273 _handleKeyDown: function(e) |
274 { | 274 { |
275 if (this.readOnly) | 275 if (this.readOnly) |
276 return; | 276 return; |
277 | 277 |
278 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e); | 278 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e); |
279 var handler = this._shortcuts[shortcutKey]; | 279 var handler = this._shortcuts[shortcutKey]; |
280 if (handler && handler()) | 280 if (handler && handler()) |
281 e.consume(); | 281 e.consume(true); |
282 }, | 282 }, |
283 | 283 |
284 _contextMenu: function(event) | 284 _contextMenu: function(event) |
285 { | 285 { |
286 var contextMenu = new WebInspector.ContextMenu(); | 286 var contextMenu = new WebInspector.ContextMenu(); |
287 var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-numb
er"); | 287 var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-numb
er"); |
288 if (target) | 288 if (target) |
289 this._delegate.populateLineGutterContextMenu(contextMenu, target.lin
eNumber); | 289 this._delegate.populateLineGutterContextMenu(contextMenu, target.lin
eNumber); |
290 else { | 290 else { |
291 target = this._mainPanel._enclosingLineRowOrSelf(event.target); | 291 target = this._mainPanel._enclosingLineRowOrSelf(event.target); |
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 lines.push(this._textModel.line(i)); | 2250 lines.push(this._textModel.line(i)); |
2251 | 2251 |
2252 this.element.removeChildren(); | 2252 this.element.removeChildren(); |
2253 this.element.textContent = lines.join("\n"); | 2253 this.element.textContent = lines.join("\n"); |
2254 | 2254 |
2255 // The last empty line will get swallowed otherwise. | 2255 // The last empty line will get swallowed otherwise. |
2256 if (!lines[lines.length - 1]) | 2256 if (!lines[lines.length - 1]) |
2257 this.element.appendChild(document.createElement("br")); | 2257 this.element.appendChild(document.createElement("br")); |
2258 } | 2258 } |
2259 } | 2259 } |
OLD | NEW |