Chromium Code Reviews| Index: Source/devtools/front_end/JavaScriptSourceFrame.js |
| diff --git a/Source/devtools/front_end/JavaScriptSourceFrame.js b/Source/devtools/front_end/JavaScriptSourceFrame.js |
| index acf795c6018920bbed7bdeb9ad13eb238a0af8eb..33514ca1d562f4b2543e270d664f7efcc133f947 100644 |
| --- a/Source/devtools/front_end/JavaScriptSourceFrame.js |
| +++ b/Source/devtools/front_end/JavaScriptSourceFrame.js |
| @@ -51,10 +51,6 @@ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, uiSourceCode) |
| this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick, this._handleGutterClick.bind(this), this); |
| - this.textEditor.element.addEventListener("mousedown", this._onMouseDownAndClick.bind(this, true), true); |
| - this.textEditor.element.addEventListener("click", this._onMouseDownAndClick.bind(this, false), true); |
| - |
| - |
| this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); |
| this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this); |
| @@ -411,11 +407,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { |
| event.consume(); |
| return; |
| } |
| - if (this._stepIntoMarkup && WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { |
| - this._stepIntoMarkup.stoptIteratingSelection(); |
| - event.consume(); |
| - return; |
| - } |
| } |
| }, |
| @@ -480,58 +471,18 @@ WebInspector.JavaScriptSourceFrame.prototype = { |
| { |
| this._executionLineNumber = lineNumber; |
| this._executionCallFrame = callFrame; |
| - if (this.loaded) { |
| + if (this.loaded) |
| this.textEditor.setExecutionLine(lineNumber); |
| - |
| - if (WebInspector.experimentsSettings.stepIntoSelection.isEnabled()) |
| - callFrame.getStepIntoLocations(locationsCallback.bind(this)); |
| - } |
| - |
| - /** |
| - * @param {!Array.<!DebuggerAgent.Location>} locations |
| - * @this {WebInspector.JavaScriptSourceFrame} |
| - */ |
| - function locationsCallback(locations) |
| - { |
| - if (this._executionCallFrame !== callFrame || this._stepIntoMarkup) |
| - return; |
| - this._stepIntoMarkup = WebInspector.JavaScriptSourceFrame.StepIntoMarkup.create(this, locations); |
| - if (this._stepIntoMarkup) |
| - this._stepIntoMarkup.show(); |
| - } |
| }, |
| clearExecutionLine: function() |
| { |
| - if (this._stepIntoMarkup) { |
| - this._stepIntoMarkup.dispose(); |
| - delete this._stepIntoMarkup; |
| - } |
| - |
| if (this.loaded && typeof this._executionLineNumber === "number") |
| this.textEditor.clearExecutionLine(); |
| delete this._executionLineNumber; |
| delete this._executionCallFrame; |
| }, |
| - _onMouseDownAndClick: function(isMouseDown, event) |
| - { |
| - var markup = this._stepIntoMarkup; |
| - if (!markup) |
| - return; |
| - var index = markup.findItemByCoordinates(event.x, event.y); |
| - if (typeof index === "undefined") |
| - return; |
| - |
| - if (isMouseDown) { |
| - // Do not let text editor to spoil 'click' event that is coming for us. |
| - event.consume(); |
| - } else { |
| - var rawLocation = markup.getRawPosition(index); |
| - this._scriptsPanel.doStepIntoSelection(rawLocation); |
| - } |
| - }, |
| - |
| /** |
| * @return {boolean} |
| */ |
| @@ -708,14 +659,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { |
| this._scriptsPanel.continueToLocation(rawLocation); |
| }, |
| - /** |
| - * @return {!WebInspector.JavaScriptSourceFrame.StepIntoMarkup|undefined} |
| - */ |
| - stepIntoMarkup: function() |
| - { |
| - return this._stepIntoMarkup; |
| - }, |
| - |
| dispose: function() |
| { |
| this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); |
| @@ -731,199 +674,3 @@ WebInspector.JavaScriptSourceFrame.prototype = { |
| __proto__: WebInspector.UISourceCodeFrame.prototype |
| } |
| - |
| -/** |
| - * @constructor |
| - * @param {!Array.<!DebuggerAgent.Location>} rawPositions |
| - * @param {!Array.<!WebInspector.TextRange>} editorRanges |
| - * @param {number} firstToExecute |
| - * @param {!WebInspector.JavaScriptSourceFrame} sourceFrame |
| - */ |
| -WebInspector.JavaScriptSourceFrame.StepIntoMarkup = function(rawPositions, editorRanges, firstToExecute, sourceFrame) |
| -{ |
| - this._positions = rawPositions; |
| - this._editorRanges = editorRanges; |
| - this._highlightDescriptors = new Array(rawPositions.length); |
| - this._currentHighlight = undefined; |
| - this._firstToExecute = firstToExecute; |
| - this._currentSelection = undefined; |
| - this._sourceFrame = sourceFrame; |
| -}; |
| - |
| -WebInspector.JavaScriptSourceFrame.StepIntoMarkup.prototype = { |
| - show: function() |
| - { |
| - var highlight = this._getVisibleHighlight(); |
| - for (var i = 0; i < this._positions.length; ++i) |
| - this._highlightItem(i, i === highlight); |
| - this._shownVisibleHighlight = highlight; |
| - }, |
| - |
| - startIteratingSelection: function() |
| - { |
| - this._currentSelection = this._positions.length |
| - this._redrawHighlight(); |
| - }, |
| - |
| - stopIteratingSelection: function() |
| - { |
| - this._currentSelection = undefined; |
| - this._redrawHighlight(); |
| - }, |
| - |
| - /** |
| - * @param {boolean} backward |
| - */ |
| - iterateSelection: function(backward) |
| - { |
| - if (typeof this._currentSelection === "undefined") |
| - return; |
| - var nextSelection = backward ? this._currentSelection - 1 : this._currentSelection + 1; |
| - var modulo = this._positions.length + 1; |
| - nextSelection = (nextSelection + modulo) % modulo; |
| - this._currentSelection = nextSelection; |
| - this._redrawHighlight(); |
| - }, |
| - |
| - _redrawHighlight: function() |
| - { |
| - var visibleHighlight = this._getVisibleHighlight(); |
| - if (this._shownVisibleHighlight === visibleHighlight) |
| - return; |
| - this._hideItemHighlight(this._shownVisibleHighlight); |
| - this._hideItemHighlight(visibleHighlight); |
| - this._highlightItem(this._shownVisibleHighlight, false); |
| - this._highlightItem(visibleHighlight, true); |
| - this._shownVisibleHighlight = visibleHighlight; |
| - }, |
| - |
| - /** |
| - * @return {number} |
| - */ |
| - _getVisibleHighlight: function() |
| - { |
| - return typeof this._currentSelection === "undefined" ? this._firstToExecute : this._currentSelection; |
| - }, |
| - |
| - /** |
| - * @param {number} position |
| - * @param {boolean} selected |
| - */ |
| - _highlightItem: function(position, selected) |
| - { |
| - if (position === this._positions.length) |
| - return; |
| - var styleName = selected ? "source-frame-stepin-mark-highlighted" : "source-frame-stepin-mark"; |
|
aandrey
2014/03/17 19:05:20
also clean up CSS files
|
| - var textEditor = this._sourceFrame.textEditor; |
| - var highlightDescriptor = textEditor.highlightRange(this._editorRanges[position], styleName); |
| - this._highlightDescriptors[position] = highlightDescriptor; |
| - }, |
| - |
| - /** |
| - * @param {number} position |
| - */ |
| - _hideItemHighlight: function(position) |
| - { |
| - if (position === this._positions.length) |
| - return; |
| - var highlightDescriptor = this._highlightDescriptors[position]; |
| - console.assert(highlightDescriptor); |
| - var textEditor = this._sourceFrame.textEditor; |
| - textEditor.removeHighlight(highlightDescriptor); |
| - this._highlightDescriptors[position] = undefined; |
| - }, |
| - |
| - dispose: function() |
| - { |
| - for (var i = 0; i < this._positions.length; ++i) |
| - this._hideItemHighlight(i); |
| - }, |
| - |
| - /** |
| - * @param {number} x |
| - * @param {number} y |
| - * @return {number|undefined} |
| - */ |
| - findItemByCoordinates: function(x, y) |
| - { |
| - var textPosition = this._sourceFrame.textEditor.coordinatesToCursorPosition(x, y); |
| - if (!textPosition) |
| - return; |
| - |
| - var ranges = this._editorRanges; |
| - |
| - for (var i = 0; i < ranges.length; ++i) { |
| - var nextRange = ranges[i]; |
| - if (nextRange.startLine == textPosition.startLine && nextRange.startColumn <= textPosition.startColumn && nextRange.endColumn >= textPosition.startColumn) |
| - return i; |
| - } |
| - }, |
| - |
| - /** |
| - * @return {number|undefined} |
| - */ |
| - getSelectedItemIndex: function() |
| - { |
| - if (this._currentSelection === this._positions.length) |
| - return undefined; |
| - return this._currentSelection; |
| - }, |
| - |
| - /** |
| - * @return {!WebInspector.DebuggerModel.Location} |
| - */ |
| - getRawPosition: function(position) |
| - { |
| - return /** @type {!WebInspector.DebuggerModel.Location} */ (this._positions[position]); |
| - } |
| - |
| -}; |
| - |
| -/** |
| - * @param {!WebInspector.JavaScriptSourceFrame} sourceFrame |
| - * @param {!Array.<!DebuggerAgent.Location>} stepIntoRawLocations |
| - * @return {?WebInspector.JavaScriptSourceFrame.StepIntoMarkup} |
| - */ |
| -WebInspector.JavaScriptSourceFrame.StepIntoMarkup.create = function(sourceFrame, stepIntoRawLocations) |
| -{ |
| - if (!stepIntoRawLocations.length) |
| - return null; |
| - |
| - var firstToExecute = stepIntoRawLocations[0]; |
| - stepIntoRawLocations.sort(WebInspector.JavaScriptSourceFrame.StepIntoMarkup._Comparator); |
| - var firstToExecuteIndex = stepIntoRawLocations.indexOf(firstToExecute); |
| - |
| - var textEditor = sourceFrame.textEditor; |
| - var uiRanges = []; |
| - for (var i = 0; i < stepIntoRawLocations.length; ++i) { |
| - var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(/** @type {!WebInspector.DebuggerModel.Location} */ (stepIntoRawLocations[i])); |
| - |
| - var token = textEditor.tokenAtTextPosition(uiLocation.lineNumber, uiLocation.columnNumber); |
| - var startColumn; |
| - var endColumn; |
| - if (token) { |
| - startColumn = token.startColumn; |
| - endColumn = token.endColumn; |
| - } else { |
| - startColumn = uiLocation.columnNumber; |
| - endColumn = uiLocation.columnNumber; |
| - } |
| - var range = new WebInspector.TextRange(uiLocation.lineNumber, startColumn, uiLocation.lineNumber, endColumn); |
| - uiRanges.push(range); |
| - } |
| - |
| - return new WebInspector.JavaScriptSourceFrame.StepIntoMarkup(stepIntoRawLocations, uiRanges, firstToExecuteIndex, sourceFrame); |
| -}; |
| - |
| -/** |
| - * @param {!DebuggerAgent.Location} locationA |
| - * @param {!DebuggerAgent.Location} locationB |
| - * @return {number} |
| - */ |
| -WebInspector.JavaScriptSourceFrame.StepIntoMarkup._Comparator = function(locationA, locationB) |
| -{ |
| - if (locationA.lineNumber === locationB.lineNumber) |
| - return locationA.columnNumber - locationB.columnNumber; |
| - else |
| - return locationA.lineNumber - locationB.lineNumber; |
| -}; |