| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 this._blockIndentController = new WebInspector.CodeMirrorTextEditor.BlockInd
entController(this._codeMirror); | 152 this._blockIndentController = new WebInspector.CodeMirrorTextEditor.BlockInd
entController(this._codeMirror); |
| 153 this._fixWordMovement = new WebInspector.CodeMirrorTextEditor.FixWordMovemen
t(this._codeMirror); | 153 this._fixWordMovement = new WebInspector.CodeMirrorTextEditor.FixWordMovemen
t(this._codeMirror); |
| 154 this._selectNextOccurrenceController = new WebInspector.CodeMirrorTextEditor
.SelectNextOccurrenceController(this, this._codeMirror); | 154 this._selectNextOccurrenceController = new WebInspector.CodeMirrorTextEditor
.SelectNextOccurrenceController(this, this._codeMirror); |
| 155 | 155 |
| 156 this._codeMirror.on("changes", this._changes.bind(this)); | 156 this._codeMirror.on("changes", this._changes.bind(this)); |
| 157 this._codeMirror.on("gutterClick", this._gutterClick.bind(this)); | 157 this._codeMirror.on("gutterClick", this._gutterClick.bind(this)); |
| 158 this._codeMirror.on("cursorActivity", this._cursorActivity.bind(this)); | 158 this._codeMirror.on("cursorActivity", this._cursorActivity.bind(this)); |
| 159 this._codeMirror.on("beforeSelectionChange", this._beforeSelectionChange.bin
d(this)); | 159 this._codeMirror.on("beforeSelectionChange", this._beforeSelectionChange.bin
d(this)); |
| 160 this._codeMirror.on("scroll", this._scroll.bind(this)); | 160 this._codeMirror.on("scroll", this._scroll.bind(this)); |
| 161 this._codeMirror.on("focus", this._focus.bind(this)); | 161 this._codeMirror.on("focus", this._focus.bind(this)); |
| 162 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); | 162 this._codeMirror.on("contextmenu", this._contextMenu.bind(this)); |
| 163 /** | 163 /** |
| 164 * @this {WebInspector.CodeMirrorTextEditor} | 164 * @this {WebInspector.CodeMirrorTextEditor} |
| 165 */ | 165 */ |
| 166 function updateAnticipateJumpFlag(value) | 166 function updateAnticipateJumpFlag(value) |
| 167 { | 167 { |
| 168 this._isHandlingMouseDownEvent = value; | 168 this._isHandlingMouseDownEvent = value; |
| 169 } | 169 } |
| 170 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, true), true); | 170 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, true), true); |
| 171 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, false), false); | 171 this.element.addEventListener("mousedown", updateAnticipateJumpFlag.bind(thi
s, false), false); |
| 172 | 172 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 var bottomLineToReveal = Math.min(lineNumber + (linesPerScreen / 2)
- 1, this.linesCount - 1) | 0; | 717 var bottomLineToReveal = Math.min(lineNumber + (linesPerScreen / 2)
- 1, this.linesCount - 1) | 0; |
| 718 this._codeMirror.scrollIntoView(new CodeMirror.Pos(bottomLineToRevea
l, 0)); | 718 this._codeMirror.scrollIntoView(new CodeMirror.Pos(bottomLineToRevea
l, 0)); |
| 719 } | 719 } |
| 720 }, | 720 }, |
| 721 | 721 |
| 722 _gutterClick: function(instance, lineNumber, gutter, event) | 722 _gutterClick: function(instance, lineNumber, gutter, event) |
| 723 { | 723 { |
| 724 this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick
, { lineNumber: lineNumber, event: event }); | 724 this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick
, { lineNumber: lineNumber, event: event }); |
| 725 }, | 725 }, |
| 726 | 726 |
| 727 _contextMenu: function(event) | 727 _contextMenu: function(codeMirror, event) |
| 728 { | 728 { |
| 729 var contextMenu = new WebInspector.ContextMenu(event); | 729 var contextMenu = new WebInspector.ContextMenu(event); |
| 730 var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutte
r-elt"); | 730 var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutte
r-elt"); |
| 731 if (target) | 731 if (target) |
| 732 this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(t
arget.textContent, 10) - 1); | 732 this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(t
arget.textContent, 10) - 1); |
| 733 else | 733 else |
| 734 this._delegate.populateTextAreaContextMenu(contextMenu, 0); | 734 this._delegate.populateTextAreaContextMenu(contextMenu, 0); |
| 735 contextMenu.show(); | 735 contextMenu.show(); |
| 736 }, | 736 }, |
| 737 | 737 |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2128 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
| 2129 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2129 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
| 2130 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2130 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
| 2131 if (!foregroundColorRule && !backgroundColorRule) | 2131 if (!foregroundColorRule && !backgroundColorRule) |
| 2132 return; | 2132 return; |
| 2133 | 2133 |
| 2134 var style = document.createElement("style"); | 2134 var style = document.createElement("style"); |
| 2135 style.textContent = backgroundColorRule + foregroundColorRule; | 2135 style.textContent = backgroundColorRule + foregroundColorRule; |
| 2136 document.head.appendChild(style); | 2136 document.head.appendChild(style); |
| 2137 })(); | 2137 })(); |
| OLD | NEW |