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

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

Issue 2623143002: DevTools: insert console message decorations in order
Patch Set: a Created 3 years, 10 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete'); 140 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete');
141 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this); 141 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this);
142 142
143 var historyData = this._consoleHistorySetting.get(); 143 var historyData = this._consoleHistorySetting.get();
144 this._prompt.history().setHistoryData(historyData); 144 this._prompt.history().setHistoryData(historyData);
145 this._consoleHistoryAutocompleteChanged(); 145 this._consoleHistoryAutocompleteChanged();
146 146
147 this._updateFilterStatus(); 147 this._updateFilterStatus();
148 Common.moduleSetting('consoleTimestampFormat').addChangeListener(this._conso leTimestampsSettingChanged, this); 148 Common.moduleSetting('consoleTimestampFormat').addChangeListener(this._conso leTimestampsSettingChanged, this);
149 Common.moduleSetting('consoleContextLabelsEnabled')
150 .addChangeListener(this._consoleContextLabelsSettingChanged, this);
151 var contextLabelsEnabled = Common.moduleSetting('consoleContextLabelsEnabled ').get();
152 if (contextLabelsEnabled)
153 this._messagesElement.classList.add('show-context-icons');
149 154
150 this._registerWithMessageSink(); 155 this._registerWithMessageSink();
151 SDK.targetManager.observeTargets(this); 156 SDK.targetManager.observeTargets(this);
152 157
153 this._initConsoleMessages(); 158 this._initConsoleMessages();
154 159
155 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this); 160 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this);
156 161
157 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false); 162 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false);
158 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false); 163 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef ined, undefined, undefined, undefined, 325 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef ined, undefined, undefined, undefined,
321 undefined, undefined, undefined, message.timestamp); 326 undefined, undefined, undefined, message.timestamp);
322 this._addConsoleMessage(consoleMessage); 327 this._addConsoleMessage(consoleMessage);
323 } 328 }
324 329
325 _consoleTimestampsSettingChanged() { 330 _consoleTimestampsSettingChanged() {
326 this._updateMessageList(); 331 this._updateMessageList();
327 this._consoleMessages.forEach(viewMessage => viewMessage.updateTimestamp()); 332 this._consoleMessages.forEach(viewMessage => viewMessage.updateTimestamp());
328 } 333 }
329 334
335 /**
336 * @param {!Common.Event} event
337 */
338 _consoleContextLabelsSettingChanged(event) {
339 this._updateMessageList();
340 var contextLabelsEnabled = Common.moduleSetting('consoleContextLabelsEnabled ').get();
341 this._messagesElement.classList.toggle('show-context-icons', contextLabelsEn abled);
342 this._consoleMessages.forEach(viewMessage => viewMessage.updateContextLabel( ));
343 }
344
330 _executionContextChanged() { 345 _executionContextChanged() {
331 this._prompt.clearAutocomplete(); 346 this._prompt.clearAutocomplete();
332 if (!this._showAllMessagesCheckbox.checked()) 347 if (!this._showAllMessagesCheckbox.checked())
333 this._updateMessageList(); 348 this._updateMessageList();
334 } 349 }
335 350
336 /** 351 /**
337 * @override 352 * @override
338 */ 353 */
339 willHide() { 354 willHide() {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 this._formattedCommand.textContent = this.text.replaceControlCharacters(); 1225 this._formattedCommand.textContent = this.text.replaceControlCharacters();
1211 this._contentElement.appendChild(this._formattedCommand); 1226 this._contentElement.appendChild(this._formattedCommand);
1212 1227
1213 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max LengthToIgnoreHighlighter) { 1228 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max LengthToIgnoreHighlighter) {
1214 var javascriptSyntaxHighlighter = new UI.SyntaxHighlighter('text/javascr ipt', true); 1229 var javascriptSyntaxHighlighter = new UI.SyntaxHighlighter('text/javascr ipt', true);
1215 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand). then(this._updateSearch.bind(this)); 1230 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand). then(this._updateSearch.bind(this));
1216 } else { 1231 } else {
1217 this._updateSearch(); 1232 this._updateSearch();
1218 } 1233 }
1219 1234
1235 this.updateContextLabel();
1220 this.updateTimestamp(); 1236 this.updateTimestamp();
1221 } 1237 }
1222 return this._contentElement; 1238 return this._contentElement;
1223 } 1239 }
1224 1240
1225 _updateSearch() { 1241 _updateSearch() {
1226 this.setSearchRegex(this.searchRegex()); 1242 this.setSearchRegex(this.searchRegex());
1227 } 1243 }
1228 }; 1244 };
1229 1245
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 return true; 1349 return true;
1334 } 1350 }
1335 return false; 1351 return false;
1336 } 1352 }
1337 }; 1353 };
1338 1354
1339 /** 1355 /**
1340 * @typedef {{messageIndex: number, matchIndex: number}} 1356 * @typedef {{messageIndex: number, matchIndex: number}}
1341 */ 1357 */
1342 Console.ConsoleView.RegexMatchRange; 1358 Console.ConsoleView.RegexMatchRange;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698