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

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 2702913002: DevTools: update repeat count only when element is requested
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
index 13e3af830b030d1189e5dee9cbe1d2d0fb148c50..7ec7effb7347488b35b4f7759666b009ca3aa61d 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -122,9 +122,6 @@ Console.ConsoleViewMessage = class {
iconType = 'smallicon-command-result';
this._decorationWrapper.appendChild(UI.Icon.create(iconType, 'message-level-icon'));
- // Timestamps may affect repeat counter.
- this._updateRepeatCountElement();
pfeldman 2017/02/21 19:21:12 I'd rather do it the other way around and create i
luoe 2017/02/23 01:09:34 I tried placing message.updateMessageElement() ins
-
/**
* @param {number} timestamp
* @param {boolean} full
@@ -955,11 +952,17 @@ Console.ConsoleViewMessage = class {
* @return {!Element}
*/
toMessageElement() {
- if (this._element)
- return this._element;
+ if (!this._element) {
+ this._element = createElement('div');
+ this.updateMessageElement();
+ }
+
+ // Update repeat count.
+ var show = this._repeatCount > 1;
+ this._repeatCountElement.textContent = show ? this._repeatCount : '';
+ this._repeatCountElement.classList.toggle('hidden', !show);
+ this._element.classList.toggle('repeated-message', show);
- this._element = createElement('div');
- this.updateMessageElement();
return this._element;
}
@@ -1029,22 +1032,10 @@ Console.ConsoleViewMessage = class {
resetIncrementRepeatCount() {
this._repeatCount = 1;
- this._updateRepeatCountElement();
}
incrementRepeatCount() {
this._repeatCount++;
- this._updateRepeatCountElement();
- }
-
- _updateRepeatCountElement() {
- if (!this._repeatCountElement)
- return;
- var show = this._repeatCount > 1;
- this._repeatCountElement.textContent = show ? this._repeatCount : '';
- this._repeatCountElement.classList.toggle('hidden', !show);
- if (this._element)
- this._element.classList.toggle('repeated-message', show);
}
get text() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698