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

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

Issue 8368025: Merge 97959 - Web Inspector: Enable support for advanced search in script's static content provider. (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 unified diff | Download patch
OLDNEW
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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 */ 353 */
354 createAnchor: function(file, lineNumber) { }, 354 createAnchor: function(file, lineNumber) { },
355 355
356 /** 356 /**
357 * @param {Object} file 357 * @param {Object} file
358 * @return {string} 358 * @return {string}
359 */ 359 */
360 fileName: function(file) { }, 360 fileName: function(file) { },
361 361
362 /** 362 /**
363 * @return {RegExp}
364 */
365 _createSearchRegex: function()
366 {
367 var regexFlags = this._searchConfig.ignoreCase ? "gi" : "g";
368 var regexObject;
369 try {
370 regexObject = new RegExp(this._searchConfig.query, regexFlags);
371 } catch (e) {
372 // Silent catch.
373 }
374
375 if (!regexObject)
376 regexObject = createSearchRegex(this._searchConfig.query, regexFlags );
377
378 return regexObject;
379 },
380
381 /**
382 * @param {Object} searchResult 363 * @param {Object} searchResult
383 */ 364 */
384 addSearchResult: function(searchResult) 365 addSearchResult: function(searchResult)
385 { 366 {
386 this._searchResults.push(searchResult); 367 this._searchResults.push(searchResult);
387 var file = searchResult.file; 368 var file = searchResult.file;
388 var fileName = this.fileName(file); 369 var fileName = this.fileName(file);
389 var searchMatches = searchResult.searchMatches; 370 var searchMatches = searchResult.searchMatches;
390 371
391 // Expand first file with matches only. 372 // Expand first file with matches only.
392 var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.l ength, this._searchResults.length === 1); 373 var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.l ength, this._searchResults.length === 1);
393 374
394 var regexObject = this._createSearchRegex(); 375 var regexObject = createSearchRegex(this._searchConfig.query, !this._sea rchConfig.ignoreCase, this._searchConfig.isRegex);
395 for (var i = 0; i < searchMatches.length; i++) { 376 for (var i = 0; i < searchMatches.length; i++) {
396 var lineNumber = searchMatches[i].lineNumber; 377 var lineNumber = searchMatches[i].lineNumber;
397 378
398 var anchor = this.createAnchor(file, lineNumber); 379 var anchor = this.createAnchor(file, lineNumber);
399 380
400 var numberString = numberToStringWithSpacesPadding(lineNumber + 1, 4 ); 381 var numberString = numberToStringWithSpacesPadding(lineNumber + 1, 4 );
401 var lineNumberSpan = document.createElement("span"); 382 var lineNumberSpan = document.createElement("span");
402 lineNumberSpan.addStyleClass("webkit-line-number"); 383 lineNumberSpan.addStyleClass("webkit-line-number");
403 lineNumberSpan.addStyleClass("search-match-line-number"); 384 lineNumberSpan.addStyleClass("search-match-line-number");
404 lineNumberSpan.textContent = numberString; 385 lineNumberSpan.textContent = numberString;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 455
475 /** 456 /**
476 * @constructor 457 * @constructor
477 * @param {Object} file 458 * @param {Object} file
478 * @param {Array.<Object>} searchMatches 459 * @param {Array.<Object>} searchMatches
479 */ 460 */
480 WebInspector.FileBasedSearchResultsPane.SearchResult = function(file, searchMatc hes) { 461 WebInspector.FileBasedSearchResultsPane.SearchResult = function(file, searchMatc hes) {
481 this.file = file; 462 this.file = file;
482 this.searchMatches = searchMatches; 463 this.searchMatches = searchMatches;
483 } 464 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698