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

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

Issue 2651843003: DevTools: update console timestamp style (Closed)
Patch Set: nochange 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true); 137 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true);
138 138
139 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete'); 139 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete');
140 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this); 140 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this);
141 141
142 var historyData = this._consoleHistorySetting.get(); 142 var historyData = this._consoleHistorySetting.get();
143 this._prompt.history().setHistoryData(historyData); 143 this._prompt.history().setHistoryData(historyData);
144 this._consoleHistoryAutocompleteChanged(); 144 this._consoleHistoryAutocompleteChanged();
145 145
146 this._updateFilterStatus(); 146 this._updateFilterStatus();
147 Common.moduleSetting('consoleTimestampsEnabled').addChangeListener(this._con soleTimestampsSettingChanged, this); 147 Common.moduleSetting('consoleTimestampFormat').addChangeListener(this._conso leTimestampsSettingChanged, this);
148 148
149 this._registerWithMessageSink(); 149 this._registerWithMessageSink();
150 SDK.targetManager.observeTargets(this); 150 SDK.targetManager.observeTargets(this);
151 151
152 this._initConsoleMessages(); 152 this._initConsoleMessages();
153 153
154 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this); 154 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this);
155 155
156 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false); 156 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false);
157 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false); 157 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 level = SDK.ConsoleMessage.MessageLevel.Warning; 314 level = SDK.ConsoleMessage.MessageLevel.Warning;
315 break; 315 break;
316 } 316 }
317 317
318 var consoleMessage = new SDK.ConsoleMessage( 318 var consoleMessage = new SDK.ConsoleMessage(
319 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef ined, undefined, undefined, undefined, 319 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef ined, undefined, undefined, undefined,
320 undefined, undefined, undefined, message.timestamp); 320 undefined, undefined, undefined, message.timestamp);
321 this._addConsoleMessage(consoleMessage); 321 this._addConsoleMessage(consoleMessage);
322 } 322 }
323 323
324 /** 324 _consoleTimestampsSettingChanged() {
325 * @param {!Common.Event} event
326 */
327 _consoleTimestampsSettingChanged(event) {
328 var enabled = /** @type {boolean} */ (event.data);
329 this._updateMessageList(); 325 this._updateMessageList();
330 this._consoleMessages.forEach(function(viewMessage) { 326 this._consoleMessages.forEach(viewMessage => viewMessage.updateTimestamp());
331 viewMessage.updateTimestamp(enabled);
332 });
333 } 327 }
334 328
335 _executionContextChanged() { 329 _executionContextChanged() {
336 this._prompt.clearAutocomplete(); 330 this._prompt.clearAutocomplete();
337 if (!this._showAllMessagesCheckbox.checked()) 331 if (!this._showAllMessagesCheckbox.checked())
338 this._updateMessageList(); 332 this._updateMessageList();
339 } 333 }
340 334
341 /** 335 /**
342 * @override 336 * @override
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 progressIndicator.setWorked(messageIndex); 671 progressIndicator.setWorked(messageIndex);
678 } 672 }
679 } 673 }
680 674
681 /** 675 /**
682 * @param {!Console.ConsoleViewMessage} lastMessage 676 * @param {!Console.ConsoleViewMessage} lastMessage
683 * @param {?Console.ConsoleViewMessage=} viewMessage 677 * @param {?Console.ConsoleViewMessage=} viewMessage
684 * @return {boolean} 678 * @return {boolean}
685 */ 679 */
686 _tryToCollapseMessages(lastMessage, viewMessage) { 680 _tryToCollapseMessages(lastMessage, viewMessage) {
687 if (!Common.moduleSetting('consoleTimestampsEnabled').get() && viewMessage & & 681 var timestampFormat = Common.moduleSetting('consoleTimestampFormat').get();
688 !lastMessage.consoleMessage().isGroupMessage() && 682 var timestampsShown = timestampFormat !== Console.ConsoleViewMessage.Timesta mpFormat.None;
683 if (!timestampsShown && viewMessage && !lastMessage.consoleMessage().isGroup Message() &&
689 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) { 684 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) {
690 viewMessage.incrementRepeatCount(); 685 viewMessage.incrementRepeatCount();
691 return true; 686 return true;
692 } 687 }
693 688
694 return false; 689 return false;
695 } 690 }
696 691
697 _updateMessageList() { 692 _updateMessageList() {
698 this._topGroup = Console.ConsoleGroup.createTopGroup(); 693 this._topGroup = Console.ConsoleGroup.createTopGroup();
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 this._formattedCommand = createElementWithClass('span', 'source-code'); 1194 this._formattedCommand = createElementWithClass('span', 'source-code');
1200 this._formattedCommand.textContent = this.text.replaceControlCharacters(); 1195 this._formattedCommand.textContent = this.text.replaceControlCharacters();
1201 this._contentElement.appendChild(this._formattedCommand); 1196 this._contentElement.appendChild(this._formattedCommand);
1202 1197
1203 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max LengthToIgnoreHighlighter) { 1198 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max LengthToIgnoreHighlighter) {
1204 var javascriptSyntaxHighlighter = new UI.SyntaxHighlighter('text/javascr ipt', true); 1199 var javascriptSyntaxHighlighter = new UI.SyntaxHighlighter('text/javascr ipt', true);
1205 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand). then(this._updateSearch.bind(this)); 1200 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand). then(this._updateSearch.bind(this));
1206 } else { 1201 } else {
1207 this._updateSearch(); 1202 this._updateSearch();
1208 } 1203 }
1204
1205 this.updateTimestamp();
1209 } 1206 }
1210 return this._contentElement; 1207 return this._contentElement;
1211 } 1208 }
1212 1209
1213 _updateSearch() { 1210 _updateSearch() {
1214 this.setSearchRegex(this.searchRegex()); 1211 this.setSearchRegex(this.searchRegex());
1215 } 1212 }
1216 }; 1213 };
1217 1214
1218 /** 1215 /**
(...skipping 22 matching lines...) Expand all
1241 */ 1238 */
1242 contentElement() { 1239 contentElement() {
1243 var element = super.contentElement(); 1240 var element = super.contentElement();
1244 if (!element.classList.contains('console-user-command-result')) { 1241 if (!element.classList.contains('console-user-command-result')) {
1245 element.classList.add('console-user-command-result'); 1242 element.classList.add('console-user-command-result');
1246 if (this.consoleMessage().level === SDK.ConsoleMessage.MessageLevel.Info) { 1243 if (this.consoleMessage().level === SDK.ConsoleMessage.MessageLevel.Info) {
1247 var icon = UI.Icon.create('smallicon-command-result', 'command-result-ic on'); 1244 var icon = UI.Icon.create('smallicon-command-result', 'command-result-ic on');
1248 element.insertBefore(icon, element.firstChild); 1245 element.insertBefore(icon, element.firstChild);
1249 } 1246 }
1250 } 1247 }
1251 this.updateTimestamp(false);
1252 return element; 1248 return element;
1253 } 1249 }
1254 }; 1250 };
1255 1251
1256 /** 1252 /**
1257 * @unrestricted 1253 * @unrestricted
1258 */ 1254 */
1259 Console.ConsoleGroup = class { 1255 Console.ConsoleGroup = class {
1260 /** 1256 /**
1261 * @param {?Console.ConsoleGroup} parentGroup 1257 * @param {?Console.ConsoleGroup} parentGroup
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 return true; 1318 return true;
1323 } 1319 }
1324 return false; 1320 return false;
1325 } 1321 }
1326 }; 1322 };
1327 1323
1328 /** 1324 /**
1329 * @typedef {{messageIndex: number, matchIndex: number}} 1325 * @typedef {{messageIndex: number, matchIndex: number}}
1330 */ 1326 */
1331 Console.ConsoleView.RegexMatchRange; 1327 Console.ConsoleView.RegexMatchRange;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698