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

Unified Diff: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js

Issue 2342643002: DevTools: Don't refresh CodeMirror if it is hidden (Closed)
Patch Set: indexOf Created 4 years, 3 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 | « third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js ('k') | 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/text_editor/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
index 4f27a0a3805a1d69bb03aaf5dbc67c65481c5507..9e19a71505c21572d6a073043c1f315abc3b7df5 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -160,6 +160,9 @@ WebInspector.CodeMirrorTextEditor = function(options)
this.element.addEventListener("keydown", this._handleKeyDown.bind(this), true);
this.element.addEventListener("keydown", this._handlePostKeyDown.bind(this), false);
this.element.tabIndex = 0;
+
+ this._needsRefresh = true;
+
if (options.mimeType)
this.setMimeType(options.mimeType);
}
@@ -527,10 +530,21 @@ WebInspector.CodeMirrorTextEditor.prototype = {
*/
wasShown: function()
{
- if (this._wasOnceShown)
+ if (this._needsRefresh)
+ this.refresh();
+ },
+
+ /**
+ * @protected
+ */
+ refresh: function()
+ {
+ if (this.isShowing()) {
+ this._codeMirror.refresh();
+ this._needsRefresh = false;
return;
- this._wasOnceShown = true;
- this._codeMirror.refresh();
+ }
+ this._needsRefresh = true;
},
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698