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.SidebarPane} | 7 * @extends {WebInspector.SidebarPane} |
8 * @param {!WebInspector.BreakpointManager} breakpointManager | 8 * @param {!WebInspector.BreakpointManager} breakpointManager |
9 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho
wSourceLineDelegate | 9 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho
wSourceLineDelegate |
10 */ | 10 */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 var snippetElement = element.createChild("div", "source-text monospace")
; | 82 var snippetElement = element.createChild("div", "source-text monospace")
; |
83 | 83 |
84 /** | 84 /** |
85 * @param {?string} content | 85 * @param {?string} content |
86 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} | 86 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} |
87 */ | 87 */ |
88 function didRequestContent(content) | 88 function didRequestContent(content) |
89 { | 89 { |
90 var lineNumber = uiLocation.lineNumber | 90 var lineNumber = uiLocation.lineNumber |
91 var columnNumber = uiLocation.columnNumber; | 91 var columnNumber = uiLocation.columnNumber; |
92 var contentString = new String(content); | 92 var text = new WebInspector.Text(content || ""); |
93 if (lineNumber < contentString.lineCount()) { | 93 if (lineNumber < text.lineCount()) { |
94 var lineText = contentString.lineAt(lineNumber); | 94 var lineText = text.lineAt(lineNumber); |
95 var maxSnippetLength = 200; | 95 var maxSnippetLength = 200; |
96 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; | 96 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; |
97 snippetElement.textContent = lineText.substr(snippetStartIndex).
trimEnd(maxSnippetLength); | 97 snippetElement.textContent = lineText.substr(snippetStartIndex).
trimEnd(maxSnippetLength); |
98 } | 98 } |
99 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode); | 99 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode); |
100 } | 100 } |
101 | 101 |
102 uiLocation.uiSourceCode.requestContent().then(didRequestContent.bind(thi
s)); | 102 uiLocation.uiSourceCode.requestContent().then(didRequestContent.bind(thi
s)); |
103 | 103 |
104 element._data = uiLocation; | 104 element._data = uiLocation; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 this.listElement.removeChildren(); | 251 this.listElement.removeChildren(); |
252 if (this.listElement.parentElement) { | 252 if (this.listElement.parentElement) { |
253 this.element.removeChild(this.listElement); | 253 this.element.removeChild(this.listElement); |
254 this.element.appendChild(this.emptyElement); | 254 this.element.appendChild(this.emptyElement); |
255 } | 255 } |
256 this._items.clear(); | 256 this._items.clear(); |
257 }, | 257 }, |
258 | 258 |
259 __proto__: WebInspector.SidebarPane.prototype | 259 __proto__: WebInspector.SidebarPane.prototype |
260 } | 260 } |
OLD | NEW |