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

Unified Diff: chrome_linux64/resources/inspector/CodeMirrorTextEditor.js

Issue 14690006: Update reference builds to r197396. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 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
Index: chrome_linux64/resources/inspector/CodeMirrorTextEditor.js
===================================================================
--- chrome_linux64/resources/inspector/CodeMirrorTextEditor.js (revision 197568)
+++ chrome_linux64/resources/inspector/CodeMirrorTextEditor.js (working copy)
@@ -7021,7 +7021,7 @@
smartIndent: false,
styleSelectedText: true,
electricChars: false,
- autoCloseBrackets: WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled()
+ autoCloseBrackets: true
});
var extraKeys = {};
@@ -7064,16 +7064,32 @@
}
WebInspector.CodeMirrorTextEditor.prototype = {
+
+ undo: function()
+ {
+ this._codeMirror.undo();
+ },
+
+ redo: function()
+ {
+ this._codeMirror.redo();
+ },
+
_setupSelectionColor: function()
{
if (WebInspector.CodeMirrorTextEditor._selectionStyleInjected)
return;
+ WebInspector.CodeMirrorTextEditor._selectionStyleInjected = true;
+ var backgroundColor = WebInspector.getSelectionBackgroundColor();
+ var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selected { background-color: " + backgroundColor + ";}" : "";
+ var foregroundColor = WebInspector.getSelectionForegroundColor();
+ var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selectedtext { color: " + foregroundColor + "!important;}" : "";
+ if (!foregroundColorRule && !backgroundColorRule)
+ return;
+
var style = document.createElement("style");
- var backgroundColor = ".CodeMirror .CodeMirror-selected { background-color: " + WebInspector.getSelectionBackgroundColor() + ";}";
- var foregroundColor = ".CodeMirror .CodeMirror-selectedtext { color: " + WebInspector.getSelectionForegroundColor() + "!important;}";
- style.textContent = backgroundColor + foregroundColor;
+ style.textContent = backgroundColorRule + foregroundColorRule;
document.head.appendChild(style);
- WebInspector.CodeMirrorTextEditor._selectionStyleInjected = true;
},
/**
@@ -7114,6 +7130,17 @@
return this._toRange(coords, coords);
},
+ _convertTokenType: function(tokenType)
+ {
+ if (tokenType.startsWith("variable") || tokenType.startsWith("property") || tokenType === "def")
+ return "javascript-ident";
+ if (tokenType === "string-2")
+ return "javascript-regexp";
+ if (tokenType === "number" || tokenType === "comment" || tokenType === "string")
+ return "javascript-" + tokenType;
+ return null;
+ },
+
/**
* @param {number} lineNumber
* @param {number} column
@@ -7126,15 +7153,14 @@
var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, column || 1));
if (!token || !token.type)
return null;
- var convertedType = null;
- if (token.type.startsWith("variable") || token.type.startsWith("property") || token.type === "def") {
- return {
- startColumn: token.start,
- endColumn: token.end - 1,
- type: "javascript-ident"
- };
- }
- return null;
+ var convertedType = this._convertTokenType(token.type);
+ if (!convertedType)
+ return null;
+ return {
+ startColumn: token.start,
+ endColumn: token.end - 1,
+ type: convertedType
+ };
},
/**
@@ -7225,7 +7251,7 @@
*/
defaultFocusedElement: function()
{
- return this.element.firstChild;
+ return this.element;
},
focus: function()
« no previous file with comments | « chrome_linux64/resources/inspector/AuditsPanel.js ('k') | chrome_linux64/resources/inspector/ElementsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698