OLD | NEW |
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this._blockIndentController = new WebInspector.CodeMirrorTextEditor.BlockInd
entController(this._codeMirror); | 150 this._blockIndentController = new WebInspector.CodeMirrorTextEditor.BlockInd
entController(this._codeMirror); |
151 this._fixWordMovement = new WebInspector.CodeMirrorTextEditor.FixWordMovemen
t(this._codeMirror); | 151 this._fixWordMovement = new WebInspector.CodeMirrorTextEditor.FixWordMovemen
t(this._codeMirror); |
152 this._selectNextOccurrenceController = new WebInspector.CodeMirrorTextEditor
.SelectNextOccurrenceController(this, this._codeMirror); | 152 this._selectNextOccurrenceController = new WebInspector.CodeMirrorTextEditor
.SelectNextOccurrenceController(this, this._codeMirror); |
153 | 153 |
154 this._codeMirror.on("changes", this._changes.bind(this)); | 154 this._codeMirror.on("changes", this._changes.bind(this)); |
155 this._codeMirror.on("gutterClick", this._gutterClick.bind(this)); | 155 this._codeMirror.on("gutterClick", this._gutterClick.bind(this)); |
156 this._codeMirror.on("cursorActivity", this._cursorActivity.bind(this)); | 156 this._codeMirror.on("cursorActivity", this._cursorActivity.bind(this)); |
157 this._codeMirror.on("beforeSelectionChange", this._beforeSelectionChange.bin
d(this)); | 157 this._codeMirror.on("beforeSelectionChange", this._beforeSelectionChange.bin
d(this)); |
158 this._codeMirror.on("scroll", this._scroll.bind(this)); | 158 this._codeMirror.on("scroll", this._scroll.bind(this)); |
159 this._codeMirror.on("focus", this._focus.bind(this)); | 159 this._codeMirror.on("focus", this._focus.bind(this)); |
| 160 this._codeMirror.on("blur", this._blur.bind(this)); |
160 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); | 161 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); |
161 /** | 162 /** |
162 * @this {WebInspector.CodeMirrorTextEditor} | 163 * @this {WebInspector.CodeMirrorTextEditor} |
163 */ | 164 */ |
164 function updateAnticipateJumpFlag(value) | 165 function updateAnticipateJumpFlag(value) |
165 { | 166 { |
166 this._isHandlingMouseDownEvent = value; | 167 this._isHandlingMouseDownEvent = value; |
167 } | 168 } |
168 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, true), true); | 169 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, true), true); |
169 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, false), false); | 170 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, false), false); |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 clearTimeout(this._scrollTimer); | 1024 clearTimeout(this._scrollTimer); |
1024 var topmostLineNumber = this._codeMirror.lineAtHeight(this._codeMirror.g
etScrollInfo().top, "local"); | 1025 var topmostLineNumber = this._codeMirror.lineAtHeight(this._codeMirror.g
etScrollInfo().top, "local"); |
1025 this._scrollTimer = setTimeout(this._delegate.scrollChanged.bind(this._d
elegate, topmostLineNumber), 100); | 1026 this._scrollTimer = setTimeout(this._delegate.scrollChanged.bind(this._d
elegate, topmostLineNumber), 100); |
1026 }, | 1027 }, |
1027 | 1028 |
1028 _focus: function() | 1029 _focus: function() |
1029 { | 1030 { |
1030 this._delegate.editorFocused(); | 1031 this._delegate.editorFocused(); |
1031 }, | 1032 }, |
1032 | 1033 |
| 1034 _blur: function() |
| 1035 { |
| 1036 this._delegate.editorBlurred(); |
| 1037 }, |
| 1038 |
1033 /** | 1039 /** |
1034 * @param {number} lineNumber | 1040 * @param {number} lineNumber |
1035 */ | 1041 */ |
1036 scrollToLine: function(lineNumber) | 1042 scrollToLine: function(lineNumber) |
1037 { | 1043 { |
1038 var pos = new CodeMirror.Pos(lineNumber, 0); | 1044 var pos = new CodeMirror.Pos(lineNumber, 0); |
1039 var coords = this._codeMirror.charCoords(pos, "local"); | 1045 var coords = this._codeMirror.charCoords(pos, "local"); |
1040 this._codeMirror.scrollTo(0, coords.top); | 1046 this._codeMirror.scrollTo(0, coords.top); |
1041 }, | 1047 }, |
1042 | 1048 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2132 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2127 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2133 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2128 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2134 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2129 if (!foregroundColorRule && !backgroundColorRule) | 2135 if (!foregroundColorRule && !backgroundColorRule) |
2130 return; | 2136 return; |
2131 | 2137 |
2132 var style = document.createElement("style"); | 2138 var style = document.createElement("style"); |
2133 style.textContent = backgroundColorRule + foregroundColorRule; | 2139 style.textContent = backgroundColorRule + foregroundColorRule; |
2134 document.head.appendChild(style); | 2140 document.head.appendChild(style); |
2135 })(); | 2141 })(); |
OLD | NEW |