Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: Source/WebCore/inspector/front-end/AdvancedSearchController.js

Issue 8371003: Merge 97851 - Web Inspector: Enable caseSensitive search / Regex support in advanced search. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/inspector/InspectorPageAgent.cpp ('k') | Source/WebCore/inspector/front-end/ConsolePanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/front-end/AdvancedSearchController.js
===================================================================
--- Source/WebCore/inspector/front-end/AdvancedSearchController.js (revision 98111)
+++ Source/WebCore/inspector/front-end/AdvancedSearchController.js (working copy)
@@ -151,9 +151,25 @@
this._search = this._searchPanelElement.createChild("input");
this._search.setAttribute("type", "search");
+ this._search.addStyleClass("search-config-search");
this._search.setAttribute("results", "0");
this._search.setAttribute("size", 20);
+ this._ignoreCaseLabel = this._searchPanelElement.createChild("label");
+ this._ignoreCaseLabel.addStyleClass("search-config-label");
+ this._ignoreCaseCheckbox = this._ignoreCaseLabel.createChild("input");
+ this._ignoreCaseCheckbox.setAttribute("type", "checkbox");
+ this._ignoreCaseCheckbox.addStyleClass("search-config-checkbox");
+ this._ignoreCaseLabel.appendChild(document.createTextNode(WebInspector.UIString("Ignore case")));
+
+
+ this._regexLabel = this._searchPanelElement.createChild("label");
+ this._regexLabel.addStyleClass("search-config-label");
+ this._regexCheckbox = this._regexLabel.createChild("input");
+ this._regexCheckbox.setAttribute("type", "checkbox");
+ this._regexCheckbox.addStyleClass("search-config-checkbox");
+ this._regexLabel.appendChild(document.createTextNode(WebInspector.UIString("Regular expression")));
+
this._load();
}
@@ -168,6 +184,8 @@
{
var searchConfig = {};
searchConfig.query = this._search.value;
+ searchConfig.ignoreCase = this._ignoreCaseCheckbox.checked;
+ searchConfig.isRegex = this._regexCheckbox.checked;
return searchConfig;
},
@@ -236,6 +254,8 @@
{
var searchConfig = WebInspector.settings.advancedSearchConfig.get();
this._search.value = searchConfig.query;
+ this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase;
+ this._regexCheckbox.checked = searchConfig.isRegex;
},
_onAction: function()
@@ -340,6 +360,25 @@
fileName: function(file) { },
/**
+ * @return {RegExp}
+ */
+ _createSearchRegex: function()
+ {
+ var regexFlags = this._searchConfig.ignoreCase ? "gi" : "g";
+ var regexObject;
+ try {
+ regexObject = new RegExp(this._searchConfig.query, regexFlags);
+ } catch (e) {
+ // Silent catch.
+ }
+
+ if (!regexObject)
+ regexObject = createSearchRegex(this._searchConfig.query, regexFlags);
+
+ return regexObject;
+ },
+
+ /**
* @param {Object} searchResult
*/
addSearchResult: function(searchResult)
@@ -352,7 +391,7 @@
// Expand first file with matches only.
var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.length, this._searchResults.length === 1);
- var regexObject = createSearchRegex(this._searchConfig.query, "g");
+ var regexObject = this._createSearchRegex();
for (var i = 0; i < searchMatches.length; i++) {
var lineNumber = searchMatches[i].lineNumber;
@@ -432,3 +471,13 @@
}
WebInspector.FileBasedSearchResultsPane.prototype.__proto__ = WebInspector.SearchResultsPane.prototype;
+
+/**
+ * @constructor
+ * @param {Object} file
+ * @param {Array.<Object>} searchMatches
+ */
+WebInspector.FileBasedSearchResultsPane.SearchResult = function(file, searchMatches) {
+ this.file = file;
+ this.searchMatches = searchMatches;
+}
« no previous file with comments | « Source/WebCore/inspector/InspectorPageAgent.cpp ('k') | Source/WebCore/inspector/front-end/ConsolePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698