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

Unified Diff: third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js

Issue 2820253002: DevTools: avoid slowdown from unnecessary DOM, style mutations on CodeMirrorTextEditor (Closed)
Patch Set: ac Created 3 years, 8 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/source_frame/UISourceCodeFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js b/third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js
index 6e013ce940864d0072e5d656289fc7d6db19f0cd..750c37b514d6114a93c2b169a64a257e21b3a0a6 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js
@@ -568,7 +568,8 @@ SourceFrame.UISourceCodeFrame.RowMessageBucket = class {
this._decoration._messageBucket = this;
this._wave = this._decoration.createChild('div', 'text-editor-line-decoration-wave');
this._icon = this._wave.createChild('label', 'text-editor-line-decoration-icon', 'dt-icon-label');
- this._hasDecoration = false;
+ /** @type {?number} */
+ this._decorationStartColumn = null;
this._messagesDescriptionElement = createElementWithClass('div', 'text-editor-messages-description-container');
/** @type {!Array.<!SourceFrame.UISourceCodeFrame.RowMessage>} */
@@ -586,10 +587,13 @@ SourceFrame.UISourceCodeFrame.RowMessageBucket = class {
var lineText = this.textEditor.line(lineNumber);
columnNumber = Math.min(columnNumber, lineText.length);
var lineIndent = TextUtils.TextUtils.lineIndent(lineText).length;
- if (this._hasDecoration)
+ var startColumn = Math.max(columnNumber - 1, lineIndent);
+ if (this._decorationStartColumn === startColumn)
+ return;
+ if (this._decorationStartColumn !== null)
this.textEditor.removeDecoration(this._decoration, lineNumber);
- this._hasDecoration = true;
- this.textEditor.addDecoration(this._decoration, lineNumber, Math.max(columnNumber - 1, lineIndent));
+ this.textEditor.addDecoration(this._decoration, lineNumber, startColumn);
+ this._decorationStartColumn = startColumn;
}
/**
@@ -611,9 +615,10 @@ SourceFrame.UISourceCodeFrame.RowMessageBucket = class {
var lineNumber = position.lineNumber;
if (this._level)
this.textEditor.toggleLineClass(lineNumber, SourceFrame.UISourceCodeFrame._lineClassPerLevel[this._level], false);
- if (this._hasDecoration)
+ if (this._decorationStartColumn !== null) {
this.textEditor.removeDecoration(this._decoration, lineNumber);
- this._hasDecoration = false;
+ this._decorationStartColumn = null;
+ }
}
/**
@@ -676,6 +681,8 @@ SourceFrame.UISourceCodeFrame.RowMessageBucket = class {
}
this._updateWavePosition(lineNumber, columnNumber);
+ if (this._level === maxMessage.level())
+ return;
if (this._level) {
this.textEditor.toggleLineClass(lineNumber, SourceFrame.UISourceCodeFrame._lineClassPerLevel[this._level], false);
this._icon.type = '';
« 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