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

Side by Side Diff: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js

Issue 334393004: DevTools: Always construct CodeMirror explicitly, via "new" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 */ 37 */
38 WebInspector.CodeMirrorTextEditor = function(url, delegate) 38 WebInspector.CodeMirrorTextEditor = function(url, delegate)
39 { 39 {
40 WebInspector.VBox.call(this); 40 WebInspector.VBox.call(this);
41 this._delegate = delegate; 41 this._delegate = delegate;
42 this._url = url; 42 this._url = url;
43 43
44 this.registerRequiredCSS("cm/codemirror.css"); 44 this.registerRequiredCSS("cm/codemirror.css");
45 this.registerRequiredCSS("cm/cmdevtools.css"); 45 this.registerRequiredCSS("cm/cmdevtools.css");
46 46
47 this._codeMirror = window.CodeMirror(this.element, { 47 this._codeMirror = new window.CodeMirror(this.element, {
48 lineNumbers: true, 48 lineNumbers: true,
49 gutters: ["CodeMirror-linenumbers"], 49 gutters: ["CodeMirror-linenumbers"],
50 matchBrackets: true, 50 matchBrackets: true,
51 smartIndent: false, 51 smartIndent: false,
52 styleSelectedText: true, 52 styleSelectedText: true,
53 electricChars: false, 53 electricChars: false,
54 }); 54 });
55 this._codeMirror._codeMirrorTextEditor = this; 55 this._codeMirror._codeMirrorTextEditor = this;
56 56
57 CodeMirror.keyMap["devtools-common"] = { 57 CodeMirror.keyMap["devtools-common"] = {
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : ""; 2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : "";
2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); 2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor();
2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : ""; 2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : "";
2130 if (!foregroundColorRule && !backgroundColorRule) 2130 if (!foregroundColorRule && !backgroundColorRule)
2131 return; 2131 return;
2132 2132
2133 var style = document.createElement("style"); 2133 var style = document.createElement("style");
2134 style.textContent = backgroundColorRule + foregroundColorRule; 2134 style.textContent = backgroundColorRule + foregroundColorRule;
2135 document.head.appendChild(style); 2135 document.head.appendChild(style);
2136 })(); 2136 })();
OLDNEW
« no previous file with comments | « Source/devtools/front_end/externs.js ('k') | Source/devtools/front_end/source_frame/CodeMirrorUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698