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

Unified Diff: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js

Issue 667163002: DevTools: Do not toggle line styles unless necessary in script editor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Source/devtools/front_end/sources/JavaScriptSourceFrame.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
diff --git a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index b34e9ef98abc27f547ad7880d2b4285640b0c1cb..da3c3f7f290d9044aed0db9bb10bb538a45d0aae 100644
--- a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -1070,6 +1070,8 @@ WebInspector.CodeMirrorTextEditor.prototype = {
*/
toggleLineClass: function(lineNumber, className, toggled)
{
+ if (this.hasLineClass(lineNumber, className) === toggled)
+ return;
var lineHandle = this._codeMirror.getLineHandle(lineNumber);
if (!lineHandle)
return;
@@ -1081,6 +1083,19 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {number} lineNumber
+ * @param {string} className
+ * @return {boolean}
+ */
+ hasLineClass: function(lineNumber, className)
+ {
+ var lineInfo = this._codeMirror.lineInfo(lineNumber);
+ var wrapClass = lineInfo.wrapClass || "";
+ var classNames = wrapClass.split(" ");
+ return classNames.indexOf(className) !== -1
+ },
+
+ /**
+ * @param {number} lineNumber
* @param {!Element} element
*/
addDecoration: function(lineNumber, element)
« no previous file with comments | « no previous file | Source/devtools/front_end/sources/JavaScriptSourceFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698