Chromium Code Reviews| Index: Source/devtools/front_end/FilterBar.js |
| diff --git a/Source/devtools/front_end/FilterBar.js b/Source/devtools/front_end/FilterBar.js |
| index 368d98a8a36dd20baf7bffb14535ee1ff956114a..293e8e79ff64cfeb1ae1a4b001d184453e93cb56 100644 |
| --- a/Source/devtools/front_end/FilterBar.js |
| +++ b/Source/devtools/front_end/FilterBar.js |
| @@ -159,9 +159,12 @@ WebInspector.FilterUI.prototype = { |
| * @constructor |
| * @implements {WebInspector.FilterUI} |
| * @extends {WebInspector.Object} |
| + * @param {boolean=} supportRegex |
| */ |
| -WebInspector.TextFilterUI = function() |
| +WebInspector.TextFilterUI = function(supportRegex) |
| { |
| + this._supportRegex = !!supportRegex; |
| + |
| this._filterElement = document.createElement("div"); |
| this._filterElement.className = "filter-text-filter"; |
| @@ -171,6 +174,17 @@ WebInspector.TextFilterUI = function() |
| this._filterInputElement.addEventListener("mousedown", this._onFilterFieldManualFocus.bind(this), false); // when the search field is manually selected |
| this._filterInputElement.addEventListener("input", this._onInput.bind(this), false); |
| this._filterInputElement.addEventListener("change", this._onInput.bind(this), false); |
| + |
| + if (this._supportRegex) { |
| + this._regexCheckBox = this._filterElement.createChild("input"); |
| + this._regexCheckBox.type = "checkbox"; |
| + this._regexCheckBox.id = "text-filter-regex"; |
| + this._regexCheckBox.addEventListener("change", this._onInput.bind(this), false); |
| + |
| + this._regexLabel = this._filterElement.createChild("label"); |
| + this._regexLabel.htmlFor = "text-filter-regex"; |
| + this._regexLabel.textContent = WebInspector.UIString("Regex"); |
| + } |
| } |
| WebInspector.TextFilterUI.prototype = { |
| @@ -215,7 +229,19 @@ WebInspector.TextFilterUI.prototype = { |
| if (this._regex !== undefined) |
| return this._regex; |
| var filterQuery = this.value(); |
| - this._regex = filterQuery ? createPlainTextSearchRegex(filterQuery, "i") : null; |
| + |
| + this._regex = null |
|
eustas
2013/11/15 05:13:32
semicolon missing
Dmitry Zvorygin
2013/11/15 10:39:12
Done.
|
| + if (filterQuery) { |
| + if (this._supportRegex && this._regexCheckBox.checked) { |
| + try { |
| + this._regex = new RegExp(filterQuery, "i"); |
| + } catch (e) { |
| + // Silent catch |
|
eustas
2013/11/15 05:13:32
You must highlight field / show that regexp is not
Dmitry Zvorygin
2013/11/15 10:39:12
Done.
|
| + } |
| + } else { |
| + this._regex = createPlainTextSearchRegex(filterQuery, "i"); |
| + } |
| + } |
| return this._regex; |
| }, |