OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 this._shortcuts = {}; | 57 this._shortcuts = {}; |
58 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), fal
se); | 58 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), fal
se); |
59 | 59 |
60 this._sourcePosition = new WebInspector.ToolbarText(); | 60 this._sourcePosition = new WebInspector.ToolbarText(); |
61 | 61 |
62 /** | 62 /** |
63 * @type {?WebInspector.SearchableView} | 63 * @type {?WebInspector.SearchableView} |
64 */ | 64 */ |
65 this._searchableView = null; | 65 this._searchableView = null; |
66 } | 66 }; |
67 | 67 |
68 WebInspector.SourceFrame.prototype = { | 68 WebInspector.SourceFrame.prototype = { |
69 /** | 69 /** |
70 * @param {number} key | 70 * @param {number} key |
71 * @param {function():boolean} handler | 71 * @param {function():boolean} handler |
72 */ | 72 */ |
73 addShortcut: function(key, handler) | 73 addShortcut: function(key, handler) |
74 { | 74 { |
75 this._shortcuts[key] = handler; | 75 this._shortcuts[key] = handler; |
76 }, | 76 }, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 * @param {boolean=} jumpBackwards | 338 * @param {boolean=} jumpBackwards |
339 */ | 339 */ |
340 performSearch: function(searchConfig, shouldJump, jumpBackwards) | 340 performSearch: function(searchConfig, shouldJump, jumpBackwards) |
341 { | 341 { |
342 if (this._searchableView) | 342 if (this._searchableView) |
343 this._searchableView.updateSearchMatchesCount(0); | 343 this._searchableView.updateSearchMatchesCount(0); |
344 | 344 |
345 this._resetSearch(); | 345 this._resetSearch(); |
346 this._searchConfig = searchConfig; | 346 this._searchConfig = searchConfig; |
347 if (this.loaded) | 347 if (this.loaded) |
348 this._doFindSearchMatches(searchConfig, shouldJump, !!jumpBackwards) | 348 this._doFindSearchMatches(searchConfig, shouldJump, !!jumpBackwards)
; |
349 else | 349 else |
350 this._delayedFindSearchMatches = this._doFindSearchMatches.bind(this
, searchConfig, shouldJump, !!jumpBackwards); | 350 this._delayedFindSearchMatches = this._doFindSearchMatches.bind(this
, searchConfig, shouldJump, !!jumpBackwards); |
351 | 351 |
352 this._ensureContentLoaded(); | 352 this._ensureContentLoaded(); |
353 }, | 353 }, |
354 | 354 |
355 _resetCurrentSearchResultIndex: function() | 355 _resetCurrentSearchResultIndex: function() |
356 { | 356 { |
357 if (!this._searchResults.length) | 357 if (!this._searchResults.length) |
358 return; | 358 return; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 _handleKeyDown: function(e) | 597 _handleKeyDown: function(e) |
598 { | 598 { |
599 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e); | 599 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e); |
600 var handler = this._shortcuts[shortcutKey]; | 600 var handler = this._shortcuts[shortcutKey]; |
601 if (handler && handler()) | 601 if (handler && handler()) |
602 e.consume(true); | 602 e.consume(true); |
603 }, | 603 }, |
604 | 604 |
605 __proto__: WebInspector.SimpleView.prototype | 605 __proto__: WebInspector.SimpleView.prototype |
606 } | 606 }; |
OLD | NEW |