Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 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 21 matching lines...) Expand all Loading... | |
| 32 * @extends {WebInspector.VBox} | 32 * @extends {WebInspector.VBox} |
| 33 * @implements {WebInspector.Searchable} | 33 * @implements {WebInspector.Searchable} |
| 34 * @implements {WebInspector.TargetManager.Observer} | 34 * @implements {WebInspector.TargetManager.Observer} |
| 35 * @implements {WebInspector.ViewportControl.Provider} | 35 * @implements {WebInspector.ViewportControl.Provider} |
| 36 */ | 36 */ |
| 37 WebInspector.ConsoleView = function() | 37 WebInspector.ConsoleView = function() |
| 38 { | 38 { |
| 39 WebInspector.VBox.call(this); | 39 WebInspector.VBox.call(this); |
| 40 this.registerRequiredCSS("filter.css"); | 40 this.registerRequiredCSS("filter.css"); |
| 41 | 41 |
| 42 this._searchableView = new WebInspector.SearchableView(this); | 42 this._searchableView = new WebInspector.SearchableView(this, true); |
|
robwu
2014/10/06 08:30:21
Why did you use true as the default setting? Plain
| |
| 43 this._searchableView.setMinimalSearchQuerySize(0); | 43 this._searchableView.setMinimalSearchQuerySize(0); |
| 44 this._searchableView.show(this.element); | 44 this._searchableView.show(this.element); |
| 45 | 45 |
| 46 this._contentsElement = this._searchableView.element; | 46 this._contentsElement = this._searchableView.element; |
| 47 this._contentsElement.classList.add("console-view"); | 47 this._contentsElement.classList.add("console-view"); |
| 48 this._visibleViewMessages = []; | 48 this._visibleViewMessages = []; |
| 49 this._urlToMessageCount = {}; | 49 this._urlToMessageCount = {}; |
| 50 this._hiddenByFilterCount = 0; | 50 this._hiddenByFilterCount = 0; |
| 51 | 51 |
| 52 this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIS tring("Clear console log."), "clear-status-bar-item"); | 52 this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIS tring("Clear console log."), "clear-status-bar-item"); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 | 906 |
| 907 /** | 907 /** |
| 908 * @param {string} query | 908 * @param {string} query |
| 909 * @param {boolean} shouldJump | 909 * @param {boolean} shouldJump |
| 910 * @param {boolean=} jumpBackwards | 910 * @param {boolean=} jumpBackwards |
| 911 */ | 911 */ |
| 912 performSearch: function(query, shouldJump, jumpBackwards) | 912 performSearch: function(query, shouldJump, jumpBackwards) |
| 913 { | 913 { |
| 914 this.searchCanceled(); | 914 this.searchCanceled(); |
| 915 this._searchableView.updateSearchMatchesCount(0); | 915 this._searchableView.updateSearchMatchesCount(0); |
| 916 this._searchRegex = createPlainTextSearchRegex(query, "gi"); | 916 if (!this._searchableView.enableRegex) { |
| 917 this._searchRegex = createPlainTextSearchRegex(query, "gi"); | |
| 918 } | |
| 919 else { | |
|
robwu
2014/10/06 08:30:21
} else { must be on a single line.
aknudsen
2014/10/07 19:39:57
Done.
| |
| 920 this._searchRegex = new RegExp(query, "gi"); | |
|
robwu
2014/10/06 08:30:22
Use a separate function or method to construct the
aknudsen
2014/10/07 19:39:57
Acknowledged.
aknudsen
2014/10/07 20:50:12
Done.
| |
| 921 } | |
| 917 | 922 |
| 918 /** @type {!Array.<number>} */ | 923 /** @type {!Array.<number>} */ |
| 919 this._searchResults = []; | 924 this._searchResults = []; |
| 920 for (var i = 0; i < this._visibleViewMessages.length; i++) { | 925 for (var i = 0; i < this._visibleViewMessages.length; i++) { |
| 921 if (this._visibleViewMessages[i].matchesRegex(this._searchRegex)) | 926 if (this._visibleViewMessages[i].matchesRegex(this._searchRegex)) |
| 922 this._searchResults.push(i); | 927 this._searchResults.push(i); |
| 923 } | 928 } |
| 924 this._searchableView.updateSearchMatchesCount(this._searchResults.length ); | 929 this._searchableView.updateSearchMatchesCount(this._searchResults.length ); |
| 925 this._currentSearchResultIndex = -1; | 930 this._currentSearchResultIndex = -1; |
| 926 if (shouldJump && this._searchResults.length) | 931 if (shouldJump && this._searchResults.length) |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1259 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1264 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
| 1260 /** | 1265 /** |
| 1261 * @return {boolean} | 1266 * @return {boolean} |
| 1262 */ | 1267 */ |
| 1263 handleAction: function() | 1268 handleAction: function() |
| 1264 { | 1269 { |
| 1265 WebInspector.console.show(); | 1270 WebInspector.console.show(); |
| 1266 return true; | 1271 return true; |
| 1267 } | 1272 } |
| 1268 } | 1273 } |
| OLD | NEW |