Chromium Code Reviews| 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 */ |
| 11 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show SourceLineDelegate) | 11 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show SourceLineDelegate) |
| 12 { | 12 { |
| 13 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); | 13 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); |
| 14 this.registerRequiredCSS("components/breakpointsList.css"); | 14 this.registerRequiredCSS("components/breakpointsList.css"); |
| 15 | 15 |
| 16 this._breakpointManager = breakpointManager; | 16 this._breakpointManager = breakpointManager; |
| 17 this._showSourceLineDelegate = showSourceLineDelegate; | 17 this._showSourceLineDelegate = showSourceLineDelegate; |
| 18 | 18 |
| 19 this.listElement = createElementWithClass("ol", "breakpoint-list"); | 19 this.listElement = createElementWithClass("ol", "breakpoint-list"); |
| 20 | 20 |
| 21 this.emptyElement = this.bodyElement.createChild("div", "info"); | 21 this.emptyElement = this.element.createChild("div", "info"); |
| 22 this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); | 22 this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); |
| 23 | 23 |
| 24 this._items = new Map(); | 24 this._items = new Map(); |
| 25 | 25 |
| 26 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); | 26 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); |
| 27 for (var i = 0; i < breakpointLocations.length; ++i) | 27 for (var i = 0; i < breakpointLocations.length; ++i) |
| 28 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio ns[i].uiLocation); | 28 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio ns[i].uiLocation); |
| 29 | 29 |
| 30 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointAdded, this._breakpointAdded, this); | 30 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointAdded, this._breakpointAdded, this); |
| 31 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointRemoved, this._breakpointRemoved, this); | 31 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointRemoved, this._breakpointRemoved, this); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 /** | 68 /** |
| 69 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | 69 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
| 70 * @param {!WebInspector.UILocation} uiLocation | 70 * @param {!WebInspector.UILocation} uiLocation |
| 71 */ | 71 */ |
| 72 _addBreakpoint: function(breakpoint, uiLocation) | 72 _addBreakpoint: function(breakpoint, uiLocation) |
| 73 { | 73 { |
| 74 var element = createElementWithClass("li", "cursor-pointer"); | 74 var element = createElementWithClass("li", "cursor-pointer"); |
| 75 element.addEventListener("contextmenu", this._breakpointContextMenu.bind (this, breakpoint), true); | 75 element.addEventListener("contextmenu", this._breakpointContextMenu.bind (this, breakpoint), true); |
| 76 element.addEventListener("click", this._breakpointClicked.bind(this, uiL ocation), false); | 76 element.addEventListener("click", this._breakpointClicked.bind(this, uiL ocation), false); |
| 77 | 77 |
| 78 var checkbox = element.createChild("input", "checkbox-elem"); | 78 var checkbox = createCheckboxLabel("", breakpoint.enabled()); |
| 79 checkbox.type = "checkbox"; | 79 element.appendChild(checkbox); |
| 80 checkbox.checked = breakpoint.enabled(); | |
| 81 checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind( this, breakpoint), false); | 80 checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind( this, breakpoint), false); |
| 82 | 81 |
| 83 element.createTextChild(uiLocation.linkText()); | 82 element.createTextChild(uiLocation.linkText()); |
|
dgozman
2015/06/09 13:27:02
Make this checkbox title instead of "".
pfeldman
2015/06/09 13:40:59
Done.
| |
| 84 | 83 |
| 85 var snippetElement = element.createChild("div", "source-text monospace") ; | 84 var snippetElement = element.createChild("div", "source-text monospace") ; |
| 86 | 85 |
| 87 /** | 86 /** |
| 88 * @param {?string} content | 87 * @param {?string} content |
| 89 */ | 88 */ |
| 90 function didRequestContent(content) | 89 function didRequestContent(content) |
| 91 { | 90 { |
| 92 var lineNumber = uiLocation.lineNumber | 91 var lineNumber = uiLocation.lineNumber |
| 93 var columnNumber = uiLocation.columnNumber; | 92 var columnNumber = uiLocation.columnNumber; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 | 204 |
| 206 contextMenu.show(); | 205 contextMenu.show(); |
| 207 }, | 206 }, |
| 208 | 207 |
| 209 _addListElement: function(element, beforeElement) | 208 _addListElement: function(element, beforeElement) |
| 210 { | 209 { |
| 211 if (beforeElement) | 210 if (beforeElement) |
| 212 this.listElement.insertBefore(element, beforeElement); | 211 this.listElement.insertBefore(element, beforeElement); |
| 213 else { | 212 else { |
| 214 if (!this.listElement.firstChild) { | 213 if (!this.listElement.firstChild) { |
| 215 this.bodyElement.removeChild(this.emptyElement); | 214 this.element.removeChild(this.emptyElement); |
| 216 this.bodyElement.appendChild(this.listElement); | 215 this.element.appendChild(this.listElement); |
| 217 } | 216 } |
| 218 this.listElement.appendChild(element); | 217 this.listElement.appendChild(element); |
| 219 } | 218 } |
| 220 }, | 219 }, |
| 221 | 220 |
| 222 _removeListElement: function(element) | 221 _removeListElement: function(element) |
| 223 { | 222 { |
| 224 this.listElement.removeChild(element); | 223 this.listElement.removeChild(element); |
| 225 if (!this.listElement.firstChild) { | 224 if (!this.listElement.firstChild) { |
| 226 this.bodyElement.removeChild(this.listElement); | 225 this.element.removeChild(this.listElement); |
| 227 this.bodyElement.appendChild(this.emptyElement); | 226 this.element.appendChild(this.emptyElement); |
| 228 } | 227 } |
| 229 }, | 228 }, |
| 230 | 229 |
| 231 _compare: function(x, y) | 230 _compare: function(x, y) |
| 232 { | 231 { |
| 233 if (x !== y) | 232 if (x !== y) |
| 234 return x < y ? -1 : 1; | 233 return x < y ? -1 : 1; |
| 235 return 0; | 234 return 0; |
| 236 }, | 235 }, |
| 237 | 236 |
| 238 _compareBreakpoints: function(b1, b2) | 237 _compareBreakpoints: function(b1, b2) |
| 239 { | 238 { |
| 240 return this._compare(b1.uiSourceCode.originURL(), b2.uiSourceCode.origin URL()) || this._compare(b1.lineNumber, b2.lineNumber); | 239 return this._compare(b1.uiSourceCode.originURL(), b2.uiSourceCode.origin URL()) || this._compare(b1.lineNumber, b2.lineNumber); |
| 241 }, | 240 }, |
| 242 | 241 |
| 243 reset: function() | 242 reset: function() |
| 244 { | 243 { |
| 245 this.listElement.removeChildren(); | 244 this.listElement.removeChildren(); |
| 246 if (this.listElement.parentElement) { | 245 if (this.listElement.parentElement) { |
| 247 this.bodyElement.removeChild(this.listElement); | 246 this.element.removeChild(this.listElement); |
| 248 this.bodyElement.appendChild(this.emptyElement); | 247 this.element.appendChild(this.emptyElement); |
| 249 } | 248 } |
| 250 this._items.clear(); | 249 this._items.clear(); |
| 251 }, | 250 }, |
| 252 | 251 |
| 253 __proto__: WebInspector.SidebarPane.prototype | 252 __proto__: WebInspector.SidebarPane.prototype |
| 254 } | 253 } |
| OLD | NEW |