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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 1830003002: [DevTools] SourceFrame implements Search interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TabbedEditorContainerDelegate} 7 * @implements {WebInspector.TabbedEditorContainerDelegate}
8 * @implements {WebInspector.Searchable} 8 * @implements {WebInspector.Searchable}
9 * @implements {WebInspector.Replaceable} 9 * @implements {WebInspector.Replaceable}
10 * @extends {WebInspector.VBox} 10 * @extends {WebInspector.VBox}
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 /** 309 /**
310 * @param {!WebInspector.UISourceCode} uiSourceCode 310 * @param {!WebInspector.UISourceCode} uiSourceCode
311 * @return {!WebInspector.Widget} 311 * @return {!WebInspector.Widget}
312 */ 312 */
313 _showFile: function(uiSourceCode) 313 _showFile: function(uiSourceCode)
314 { 314 {
315 var sourceView = this._getOrCreateSourceView(uiSourceCode); 315 var sourceView = this._getOrCreateSourceView(uiSourceCode);
316 if (this._currentUISourceCode === uiSourceCode) 316 if (this._currentUISourceCode === uiSourceCode)
317 return sourceView; 317 return sourceView;
318 318
319 var currentFrame = this.currentSourceFrame();
320 if (currentFrame)
321 currentFrame.setSearchableView(null);
322
319 this._currentUISourceCode = uiSourceCode; 323 this._currentUISourceCode = uiSourceCode;
320 this._editorContainer.showFile(uiSourceCode); 324 this._editorContainer.showFile(uiSourceCode);
321 this._updateScriptViewToolbarItems(); 325 this._updateScriptViewToolbarItems();
326
327 currentFrame = this.currentSourceFrame();
328 if (currentFrame)
329 currentFrame.setSearchableView(this._searchableView);
330
322 return sourceView; 331 return sourceView;
323 }, 332 },
324 333
325 /** 334 /**
326 * @param {!WebInspector.UISourceCode} uiSourceCode 335 * @param {!WebInspector.UISourceCode} uiSourceCode
327 * @return {!WebInspector.Widget} 336 * @return {!WebInspector.Widget}
328 */ 337 */
329 _createSourceView: function(uiSourceCode) 338 _createSourceView: function(uiSourceCode)
330 { 339 {
331 var sourceFrame; 340 var sourceFrame;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 }, 499 },
491 500
492 /** 501 /**
493 * @override 502 * @override
494 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 503 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig
495 * @param {boolean} shouldJump 504 * @param {boolean} shouldJump
496 * @param {boolean=} jumpBackwards 505 * @param {boolean=} jumpBackwards
497 */ 506 */
498 performSearch: function(searchConfig, shouldJump, jumpBackwards) 507 performSearch: function(searchConfig, shouldJump, jumpBackwards)
499 { 508 {
500 this._searchableView.updateSearchMatchesCount(0);
501
502 var sourceFrame = this.currentSourceFrame(); 509 var sourceFrame = this.currentSourceFrame();
503 if (!sourceFrame) 510 if (!sourceFrame)
504 return; 511 return;
505 512
506 this._searchView = sourceFrame; 513 this._searchView = sourceFrame;
allada 2016/03/23 23:04:33 These are still in place to ensure if current sour
507 this._searchConfig = searchConfig; 514 this._searchConfig = searchConfig;
508 515
509 /** 516 this._searchView.performSearch(this._searchConfig, shouldJump, jumpBackw ards);
510 * @param {!WebInspector.Widget} view
511 * @param {number} searchMatches
512 * @this {WebInspector.SourcesView}
513 */
514 function finishedCallback(view, searchMatches)
515 {
516 if (!searchMatches)
517 return;
518
519 this._searchableView.updateSearchMatchesCount(searchMatches);
520 }
521
522 /**
523 * @param {number} currentMatchIndex
524 * @this {WebInspector.SourcesView}
525 */
526 function currentMatchChanged(currentMatchIndex)
527 {
528 this._searchableView.updateCurrentMatchIndex(currentMatchIndex);
529 }
530
531 /**
532 * @this {WebInspector.SourcesView}
533 */
534 function searchResultsChanged()
535 {
536 this.performSearch(this._searchConfig, false, false);
537 }
538
539 this._searchView.performSearch(this._searchConfig, shouldJump, !!jumpBac kwards, finishedCallback.bind(this), currentMatchChanged.bind(this), searchResul tsChanged.bind(this));
540 }, 517 },
541 518
542 /** 519 /**
543 * @override 520 * @override
544 */ 521 */
545 jumpToNextSearchResult: function() 522 jumpToNextSearchResult: function()
546 { 523 {
547 if (!this._searchView) 524 if (!this._searchView)
548 return; 525 return;
549 526
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 var currentUISourceCode = sourcesView.currentUISourceCode(); 779 var currentUISourceCode = sourcesView.currentUISourceCode();
803 if (!currentUISourceCode) 780 if (!currentUISourceCode)
804 return false; 781 return false;
805 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate ._nextFile(currentUISourceCode); 782 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate ._nextFile(currentUISourceCode);
806 if (!nextUISourceCode) 783 if (!nextUISourceCode)
807 return false; 784 return false;
808 sourcesView.showSourceLocation(nextUISourceCode); 785 sourcesView.showSourceLocation(nextUISourceCode);
809 return true; 786 return true;
810 } 787 }
811 } 788 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698