OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @implements {WebInspector.ContextFlavorListener} | 8 * @implements {WebInspector.ContextFlavorListener} |
9 */ | 9 */ |
10 WebInspector.JavaScriptBreakpointsSidebarPane = function() | 10 WebInspector.JavaScriptBreakpointsSidebarPane = function() |
(...skipping 14 matching lines...) Expand all Loading... |
25 for (var i = 0; i < breakpointLocations.length; ++i) | 25 for (var i = 0; i < breakpointLocations.length; ++i) |
26 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio
ns[i].uiLocation); | 26 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio
ns[i].uiLocation); |
27 | 27 |
28 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointAdded, this._breakpointAdded, this); | 28 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointAdded, this._breakpointAdded, this); |
29 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointRemoved, this._breakpointRemoved, this); | 29 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointRemoved, this._breakpointRemoved, this); |
30 | 30 |
31 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM
enu.bind(this), true); | 31 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM
enu.bind(this), true); |
32 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 32 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); |
33 this._breakpointsActiveStateChanged(); | 33 this._breakpointsActiveStateChanged(); |
34 this._update(); | 34 this._update(); |
35 } | 35 }; |
36 | 36 |
37 WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { | 37 WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { |
38 _emptyElementContextMenu: function(event) | 38 _emptyElementContextMenu: function(event) |
39 { | 39 { |
40 var contextMenu = new WebInspector.ContextMenu(event); | 40 var contextMenu = new WebInspector.ContextMenu(event); |
41 this._appendBreakpointActiveItem(contextMenu); | 41 this._appendBreakpointActiveItem(contextMenu); |
42 contextMenu.show(); | 42 contextMenu.show(); |
43 }, | 43 }, |
44 | 44 |
45 /** | 45 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 checkboxLabel.addEventListener("click", this._breakpointCheckboxClicked.
bind(this, breakpoint), false); | 81 checkboxLabel.addEventListener("click", this._breakpointCheckboxClicked.
bind(this, breakpoint), false); |
82 | 82 |
83 var snippetElement = element.createChild("div", "source-text monospace")
; | 83 var snippetElement = element.createChild("div", "source-text monospace")
; |
84 | 84 |
85 /** | 85 /** |
86 * @param {?string} content | 86 * @param {?string} content |
87 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} | 87 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} |
88 */ | 88 */ |
89 function didRequestContent(content) | 89 function didRequestContent(content) |
90 { | 90 { |
91 var lineNumber = uiLocation.lineNumber | 91 var lineNumber = uiLocation.lineNumber; |
92 var columnNumber = uiLocation.columnNumber; | 92 var columnNumber = uiLocation.columnNumber; |
93 var text = new WebInspector.Text(content || ""); | 93 var text = new WebInspector.Text(content || ""); |
94 if (lineNumber < text.lineCount()) { | 94 if (lineNumber < text.lineCount()) { |
95 var lineText = text.lineAt(lineNumber); | 95 var lineText = text.lineAt(lineNumber); |
96 var maxSnippetLength = 200; | 96 var maxSnippetLength = 200; |
97 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; | 97 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; |
98 snippetElement.textContent = lineText.substr(snippetStartIndex).
trimEnd(maxSnippetLength); | 98 snippetElement.textContent = lineText.substr(snippetStartIndex).
trimEnd(maxSnippetLength); |
99 } | 99 } |
100 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode, lineNu
mber, columnNumber); | 100 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode, lineNu
mber, columnNumber); |
101 } | 101 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 { | 267 { |
268 this._listElement.removeChildren(); | 268 this._listElement.removeChildren(); |
269 if (this._listElement.parentElement) { | 269 if (this._listElement.parentElement) { |
270 this.element.removeChild(this._listElement); | 270 this.element.removeChild(this._listElement); |
271 this.element.appendChild(this.emptyElement); | 271 this.element.appendChild(this.emptyElement); |
272 } | 272 } |
273 this._items.clear(); | 273 this._items.clear(); |
274 }, | 274 }, |
275 | 275 |
276 __proto__: WebInspector.VBox.prototype | 276 __proto__: WebInspector.VBox.prototype |
277 } | 277 }; |
OLD | NEW |