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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 1899893003: [Devtools] JSONView implements Searchable interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspec torView.currentPanel().name === "console") 824 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspec torView.currentPanel().name === "console")
825 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Ac tion.CommandEvaluatedInConsolePanel); 825 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Ac tion.CommandEvaluatedInConsolePanel);
826 } 826 }
827 }, 827 },
828 828
829 /** 829 /**
830 * @param {!WebInspector.Event} event 830 * @param {!WebInspector.Event} event
831 */ 831 */
832 _commandEvaluated: function(event) 832 _commandEvaluated: function(event)
833 { 833 {
834 var data = /** {{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); 834 var data = /** @type {{result: ?WebInspector.RemoteObject, wasThrown: bo olean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.da ta);
835 this._prompt.pushHistoryItem(data.text); 835 this._prompt.pushHistoryItem(data.text);
836 this._consoleHistorySetting.set(this._prompt.historyData().slice(-WebIns pector.ConsoleView.persistedHistorySize)); 836 this._consoleHistorySetting.set(this._prompt.historyData().slice(-WebIns pector.ConsoleView.persistedHistorySize));
837 this._printResult(data.result, data.wasThrown, data.commandMessage, data .exceptionDetails); 837 this._printResult(data.result, data.wasThrown, data.commandMessage, data .exceptionDetails);
838 }, 838 },
839 839
840 /** 840 /**
841 * @override 841 * @override
842 * @return {!Array.<!Element>} 842 * @return {!Array.<!Element>}
843 */ 843 */
844 elementsToRestoreScrollPositionsFor: function() 844 elementsToRestoreScrollPositionsFor: function()
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 }, 988 },
989 989
990 /** 990 /**
991 * @param {number} index 991 * @param {number} index
992 */ 992 */
993 _jumpToMatch: function(index) 993 _jumpToMatch: function(index)
994 { 994 {
995 if (!this._regexMatchRanges.length) 995 if (!this._regexMatchRanges.length)
996 return; 996 return;
997 997
998 var currentSearchResultClassName = "current-search-result";
999
1000 var matchRange; 998 var matchRange;
1001 if (this._currentMatchRangeIndex >= 0) { 999 if (this._currentMatchRangeIndex >= 0) {
1002 matchRange = this._regexMatchRanges[this._currentMatchRangeIndex]; 1000 matchRange = this._regexMatchRanges[this._currentMatchRangeIndex];
1003 var message = this._visibleViewMessages[matchRange.messageIndex]; 1001 var message = this._visibleViewMessages[matchRange.messageIndex];
1004 message.searchHighlightNode(matchRange.matchIndex).classList.remove( currentSearchResultClassName); 1002 message.searchHighlightNode(matchRange.matchIndex).classList.remove( WebInspector.highlightedCurrentSearchResultClassName);
1005 } 1003 }
1006 1004
1007 index = mod(index, this._regexMatchRanges.length); 1005 index = mod(index, this._regexMatchRanges.length);
1008 this._currentMatchRangeIndex = index; 1006 this._currentMatchRangeIndex = index;
1009 this._searchableView.updateCurrentMatchIndex(index); 1007 this._searchableView.updateCurrentMatchIndex(index);
1010 matchRange = this._regexMatchRanges[index]; 1008 matchRange = this._regexMatchRanges[index];
1011 var message = this._visibleViewMessages[matchRange.messageIndex]; 1009 var message = this._visibleViewMessages[matchRange.messageIndex];
1012 var highlightNode = message.searchHighlightNode(matchRange.matchIndex); 1010 var highlightNode = message.searchHighlightNode(matchRange.matchIndex);
1013 highlightNode.classList.add(currentSearchResultClassName); 1011 highlightNode.classList.add(WebInspector.highlightedCurrentSearchResultC lassName);
1014 this._viewport.scrollItemIntoView(matchRange.messageIndex); 1012 this._viewport.scrollItemIntoView(matchRange.messageIndex);
1015 highlightNode.scrollIntoViewIfNeeded(); 1013 highlightNode.scrollIntoViewIfNeeded();
1016 }, 1014 },
1017 1015
1018 __proto__: WebInspector.VBox.prototype 1016 __proto__: WebInspector.VBox.prototype
1019 } 1017 }
1020 1018
1021 /** 1019 /**
1022 * @constructor 1020 * @constructor
1023 * @extends {WebInspector.Object} 1021 * @extends {WebInspector.Object}
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 return true; 1329 return true;
1332 } 1330 }
1333 return false; 1331 return false;
1334 } 1332 }
1335 } 1333 }
1336 1334
1337 /** 1335 /**
1338 * @typedef {{messageIndex: number, matchIndex: number}} 1336 * @typedef {{messageIndex: number, matchIndex: number}}
1339 */ 1337 */
1340 WebInspector.ConsoleView.RegexMatchRange; 1338 WebInspector.ConsoleView.RegexMatchRange;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698