| 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 | |
| 5 /** | 4 /** |
| 6 * @constructor | |
| 7 * @extends {WebInspector.VBox} | |
| 8 * @implements {WebInspector.ContextFlavorListener} | 5 * @implements {WebInspector.ContextFlavorListener} |
| 6 * @unrestricted |
| 9 */ | 7 */ |
| 10 WebInspector.JavaScriptBreakpointsSidebarPane = function() | 8 WebInspector.JavaScriptBreakpointsSidebarPane = class extends WebInspector.VBox
{ |
| 11 { | 9 constructor() { |
| 12 WebInspector.VBox.call(this); | 10 super(); |
| 13 this.registerRequiredCSS("components/breakpointsList.css"); | 11 this.registerRequiredCSS('components/breakpointsList.css'); |
| 14 | 12 |
| 15 this._breakpointManager = WebInspector.breakpointManager; | 13 this._breakpointManager = WebInspector.breakpointManager; |
| 16 | 14 |
| 17 this._listElement = createElementWithClass("ol", "breakpoint-list"); | 15 this._listElement = createElementWithClass('ol', 'breakpoint-list'); |
| 18 | 16 |
| 19 this.emptyElement = this.element.createChild("div", "gray-info-message"); | 17 this.emptyElement = this.element.createChild('div', 'gray-info-message'); |
| 20 this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); | 18 this.emptyElement.textContent = WebInspector.UIString('No Breakpoints'); |
| 21 | 19 |
| 22 this._items = new Map(); | 20 this._items = new Map(); |
| 23 | 21 |
| 24 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); | 22 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); |
| 25 for (var i = 0; i < breakpointLocations.length; ++i) | 23 for (var i = 0; i < breakpointLocations.length; ++i) |
| 26 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio
ns[i].uiLocation); | 24 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocations
[i].uiLocation); |
| 27 | 25 |
| 28 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointAdded, this._breakpointAdded, this); | 26 this._breakpointManager.addEventListener( |
| 29 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointRemoved, this._breakpointRemoved, this); | 27 WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointA
dded, this); |
| 30 | 28 this._breakpointManager.addEventListener( |
| 31 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM
enu.bind(this), true); | 29 WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpoin
tRemoved, this); |
| 32 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even
ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 30 |
| 31 this.emptyElement.addEventListener('contextmenu', this._emptyElementContextM
enu.bind(this), true); |
| 32 this._breakpointManager.addEventListener( |
| 33 WebInspector.BreakpointManager.Events.BreakpointsActiveStateChanged, thi
s._breakpointsActiveStateChanged, this); |
| 33 this._breakpointsActiveStateChanged(); | 34 this._breakpointsActiveStateChanged(); |
| 34 this._update(); | 35 this._update(); |
| 36 } |
| 37 |
| 38 _emptyElementContextMenu(event) { |
| 39 var contextMenu = new WebInspector.ContextMenu(event); |
| 40 this._appendBreakpointActiveItem(contextMenu); |
| 41 contextMenu.show(); |
| 42 } |
| 43 |
| 44 /** |
| 45 * @param {!WebInspector.ContextMenu} contextMenu |
| 46 */ |
| 47 _appendBreakpointActiveItem(contextMenu) { |
| 48 var breakpointActive = this._breakpointManager.breakpointsActive(); |
| 49 var breakpointActiveTitle = breakpointActive ? WebInspector.UIString.capital
ize('Deactivate ^breakpoints') : |
| 50 WebInspector.UIString.capital
ize('Activate ^breakpoints'); |
| 51 contextMenu.appendItem( |
| 52 breakpointActiveTitle, |
| 53 this._breakpointManager.setBreakpointsActive.bind(this._breakpointManage
r, !breakpointActive)); |
| 54 } |
| 55 |
| 56 /** |
| 57 * @param {!WebInspector.Event} event |
| 58 */ |
| 59 _breakpointAdded(event) { |
| 60 this._breakpointRemoved(event); |
| 61 |
| 62 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (
event.data.breakpoint); |
| 63 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiLocat
ion); |
| 64 this._addBreakpoint(breakpoint, uiLocation); |
| 65 } |
| 66 |
| 67 /** |
| 68 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
| 69 * @param {!WebInspector.UILocation} uiLocation |
| 70 */ |
| 71 _addBreakpoint(breakpoint, uiLocation) { |
| 72 var element = createElementWithClass('li', 'cursor-pointer'); |
| 73 element.addEventListener('contextmenu', this._breakpointContextMenu.bind(thi
s, breakpoint), true); |
| 74 element.addEventListener('click', this._breakpointClicked.bind(this, uiLocat
ion), false); |
| 75 |
| 76 var checkboxLabel = createCheckboxLabel(uiLocation.linkText(), breakpoint.en
abled()); |
| 77 element.appendChild(checkboxLabel); |
| 78 checkboxLabel.addEventListener('click', this._breakpointCheckboxClicked.bind
(this, breakpoint), false); |
| 79 |
| 80 var snippetElement = element.createChild('div', 'source-text monospace'); |
| 81 |
| 82 /** |
| 83 * @param {?string} content |
| 84 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} |
| 85 */ |
| 86 function didRequestContent(content) { |
| 87 var lineNumber = uiLocation.lineNumber; |
| 88 var columnNumber = uiLocation.columnNumber; |
| 89 var text = new WebInspector.Text(content || ''); |
| 90 if (lineNumber < text.lineCount()) { |
| 91 var lineText = text.lineAt(lineNumber); |
| 92 var maxSnippetLength = 200; |
| 93 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; |
| 94 snippetElement.textContent = lineText.substr(snippetStartIndex).trimEnd(
maxSnippetLength); |
| 95 } |
| 96 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode, lineNumber,
columnNumber); |
| 97 } |
| 98 |
| 99 uiLocation.uiSourceCode.requestContent().then(didRequestContent.bind(this)); |
| 100 |
| 101 element._data = uiLocation; |
| 102 var currentElement = this._listElement.firstChild; |
| 103 while (currentElement) { |
| 104 if (currentElement._data && this._compareBreakpoints(currentElement._data,
element._data) > 0) |
| 105 break; |
| 106 currentElement = currentElement.nextSibling; |
| 107 } |
| 108 this._addListElement(element, currentElement); |
| 109 |
| 110 var breakpointItem = {element: element, checkbox: checkboxLabel.checkboxElem
ent}; |
| 111 this._items.set(breakpoint, breakpointItem); |
| 112 } |
| 113 |
| 114 /** |
| 115 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 116 * @param {number} lineNumber |
| 117 * @param {number} columnNumber |
| 118 */ |
| 119 didReceiveBreakpointLineForTest(uiSourceCode, lineNumber, columnNumber) { |
| 120 } |
| 121 |
| 122 /** |
| 123 * @param {!WebInspector.Event} event |
| 124 */ |
| 125 _breakpointRemoved(event) { |
| 126 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (
event.data.breakpoint); |
| 127 var breakpointItem = this._items.get(breakpoint); |
| 128 if (!breakpointItem) |
| 129 return; |
| 130 this._items.remove(breakpoint); |
| 131 this._removeListElement(breakpointItem.element); |
| 132 } |
| 133 |
| 134 /** |
| 135 * @override |
| 136 * @param {?Object} object |
| 137 */ |
| 138 flavorChanged(object) { |
| 139 this._update(); |
| 140 } |
| 141 |
| 142 _update() { |
| 143 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDetails
); |
| 144 var uiLocation = details && details.callFrames.length ? |
| 145 WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(details.ca
llFrames[0].location()) : |
| 146 null; |
| 147 var breakpoint = uiLocation ? |
| 148 this._breakpointManager.findBreakpointOnLine(uiLocation.uiSourceCode, ui
Location.lineNumber) : |
| 149 null; |
| 150 var breakpointItem = this._items.get(breakpoint); |
| 151 if (!breakpointItem) { |
| 152 if (this._highlightedBreakpointItem) { |
| 153 this._highlightedBreakpointItem.element.classList.remove('breakpoint-hit
'); |
| 154 delete this._highlightedBreakpointItem; |
| 155 } |
| 156 return; |
| 157 } |
| 158 |
| 159 breakpointItem.element.classList.add('breakpoint-hit'); |
| 160 this._highlightedBreakpointItem = breakpointItem; |
| 161 WebInspector.viewManager.showView('sources.jsBreakpoints'); |
| 162 } |
| 163 |
| 164 _breakpointsActiveStateChanged() { |
| 165 this._listElement.classList.toggle('breakpoints-list-deactivated', !this._br
eakpointManager.breakpointsActive()); |
| 166 } |
| 167 |
| 168 /** |
| 169 * @param {!WebInspector.UILocation} uiLocation |
| 170 */ |
| 171 _breakpointClicked(uiLocation) { |
| 172 WebInspector.Revealer.reveal(uiLocation); |
| 173 } |
| 174 |
| 175 /** |
| 176 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
| 177 * @param {!Event} event |
| 178 */ |
| 179 _breakpointCheckboxClicked(breakpoint, event) { |
| 180 // Breakpoint element has it's own click handler. |
| 181 event.consume(); |
| 182 breakpoint.setEnabled(event.target.checkboxElement.checked); |
| 183 } |
| 184 |
| 185 /** |
| 186 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
| 187 * @param {!Event} event |
| 188 */ |
| 189 _breakpointContextMenu(breakpoint, event) { |
| 190 var breakpoints = this._items.valuesArray(); |
| 191 var contextMenu = new WebInspector.ContextMenu(event); |
| 192 contextMenu.appendItem(WebInspector.UIString.capitalize('Remove ^breakpoint'
), breakpoint.remove.bind(breakpoint)); |
| 193 if (breakpoints.length > 1) { |
| 194 var removeAllTitle = WebInspector.UIString.capitalize('Remove ^all ^breakp
oints'); |
| 195 contextMenu.appendItem( |
| 196 removeAllTitle, this._breakpointManager.removeAllBreakpoints.bind(this
._breakpointManager)); |
| 197 } |
| 198 |
| 199 contextMenu.appendSeparator(); |
| 200 this._appendBreakpointActiveItem(contextMenu); |
| 201 |
| 202 function enabledBreakpointCount(breakpoints) { |
| 203 var count = 0; |
| 204 for (var i = 0; i < breakpoints.length; ++i) { |
| 205 if (breakpoints[i].checkbox.checked) |
| 206 count++; |
| 207 } |
| 208 return count; |
| 209 } |
| 210 if (breakpoints.length > 1) { |
| 211 var enableBreakpointCount = enabledBreakpointCount(breakpoints); |
| 212 var enableTitle = WebInspector.UIString.capitalize('Enable ^all ^breakpoin
ts'); |
| 213 var disableTitle = WebInspector.UIString.capitalize('Disable ^all ^breakpo
ints'); |
| 214 |
| 215 contextMenu.appendSeparator(); |
| 216 |
| 217 contextMenu.appendItem( |
| 218 enableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._b
reakpointManager, true), |
| 219 !(enableBreakpointCount !== breakpoints.length)); |
| 220 contextMenu.appendItem( |
| 221 disableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._
breakpointManager, false), |
| 222 !(enableBreakpointCount > 1)); |
| 223 } |
| 224 |
| 225 contextMenu.show(); |
| 226 } |
| 227 |
| 228 _addListElement(element, beforeElement) { |
| 229 if (beforeElement) |
| 230 this._listElement.insertBefore(element, beforeElement); |
| 231 else { |
| 232 if (!this._listElement.firstChild) { |
| 233 this.element.removeChild(this.emptyElement); |
| 234 this.element.appendChild(this._listElement); |
| 235 } |
| 236 this._listElement.appendChild(element); |
| 237 } |
| 238 } |
| 239 |
| 240 _removeListElement(element) { |
| 241 this._listElement.removeChild(element); |
| 242 if (!this._listElement.firstChild) { |
| 243 this.element.removeChild(this._listElement); |
| 244 this.element.appendChild(this.emptyElement); |
| 245 } |
| 246 } |
| 247 |
| 248 _compare(x, y) { |
| 249 if (x !== y) |
| 250 return x < y ? -1 : 1; |
| 251 return 0; |
| 252 } |
| 253 |
| 254 _compareBreakpoints(b1, b2) { |
| 255 return this._compare(b1.uiSourceCode.url(), b2.uiSourceCode.url()) || this._
compare(b1.lineNumber, b2.lineNumber); |
| 256 } |
| 257 |
| 258 reset() { |
| 259 this._listElement.removeChildren(); |
| 260 if (this._listElement.parentElement) { |
| 261 this.element.removeChild(this._listElement); |
| 262 this.element.appendChild(this.emptyElement); |
| 263 } |
| 264 this._items.clear(); |
| 265 } |
| 35 }; | 266 }; |
| 36 | |
| 37 WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { | |
| 38 _emptyElementContextMenu: function(event) | |
| 39 { | |
| 40 var contextMenu = new WebInspector.ContextMenu(event); | |
| 41 this._appendBreakpointActiveItem(contextMenu); | |
| 42 contextMenu.show(); | |
| 43 }, | |
| 44 | |
| 45 /** | |
| 46 * @param {!WebInspector.ContextMenu} contextMenu | |
| 47 */ | |
| 48 _appendBreakpointActiveItem: function(contextMenu) | |
| 49 { | |
| 50 var breakpointActive = this._breakpointManager.breakpointsActive(); | |
| 51 var breakpointActiveTitle = breakpointActive ? | |
| 52 WebInspector.UIString.capitalize("Deactivate ^breakpoints") : | |
| 53 WebInspector.UIString.capitalize("Activate ^breakpoints"); | |
| 54 contextMenu.appendItem(breakpointActiveTitle, this._breakpointManager.se
tBreakpointsActive.bind(this._breakpointManager, !breakpointActive)); | |
| 55 }, | |
| 56 | |
| 57 /** | |
| 58 * @param {!WebInspector.Event} event | |
| 59 */ | |
| 60 _breakpointAdded: function(event) | |
| 61 { | |
| 62 this._breakpointRemoved(event); | |
| 63 | |
| 64 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint}
*/ (event.data.breakpoint); | |
| 65 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiL
ocation); | |
| 66 this._addBreakpoint(breakpoint, uiLocation); | |
| 67 }, | |
| 68 | |
| 69 /** | |
| 70 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | |
| 71 * @param {!WebInspector.UILocation} uiLocation | |
| 72 */ | |
| 73 _addBreakpoint: function(breakpoint, uiLocation) | |
| 74 { | |
| 75 var element = createElementWithClass("li", "cursor-pointer"); | |
| 76 element.addEventListener("contextmenu", this._breakpointContextMenu.bind
(this, breakpoint), true); | |
| 77 element.addEventListener("click", this._breakpointClicked.bind(this, uiL
ocation), false); | |
| 78 | |
| 79 var checkboxLabel = createCheckboxLabel(uiLocation.linkText(), breakpoin
t.enabled()); | |
| 80 element.appendChild(checkboxLabel); | |
| 81 checkboxLabel.addEventListener("click", this._breakpointCheckboxClicked.
bind(this, breakpoint), false); | |
| 82 | |
| 83 var snippetElement = element.createChild("div", "source-text monospace")
; | |
| 84 | |
| 85 /** | |
| 86 * @param {?string} content | |
| 87 * @this {WebInspector.JavaScriptBreakpointsSidebarPane} | |
| 88 */ | |
| 89 function didRequestContent(content) | |
| 90 { | |
| 91 var lineNumber = uiLocation.lineNumber; | |
| 92 var columnNumber = uiLocation.columnNumber; | |
| 93 var text = new WebInspector.Text(content || ""); | |
| 94 if (lineNumber < text.lineCount()) { | |
| 95 var lineText = text.lineAt(lineNumber); | |
| 96 var maxSnippetLength = 200; | |
| 97 var snippetStartIndex = columnNumber > 100 ? columnNumber : 0; | |
| 98 snippetElement.textContent = lineText.substr(snippetStartIndex).
trimEnd(maxSnippetLength); | |
| 99 } | |
| 100 this.didReceiveBreakpointLineForTest(uiLocation.uiSourceCode, lineNu
mber, columnNumber); | |
| 101 } | |
| 102 | |
| 103 uiLocation.uiSourceCode.requestContent().then(didRequestContent.bind(thi
s)); | |
| 104 | |
| 105 element._data = uiLocation; | |
| 106 var currentElement = this._listElement.firstChild; | |
| 107 while (currentElement) { | |
| 108 if (currentElement._data && this._compareBreakpoints(currentElement.
_data, element._data) > 0) | |
| 109 break; | |
| 110 currentElement = currentElement.nextSibling; | |
| 111 } | |
| 112 this._addListElement(element, currentElement); | |
| 113 | |
| 114 var breakpointItem = { element: element, checkbox: checkboxLabel.checkbo
xElement }; | |
| 115 this._items.set(breakpoint, breakpointItem); | |
| 116 }, | |
| 117 | |
| 118 /** | |
| 119 * @param {!WebInspector.UISourceCode} uiSourceCode | |
| 120 * @param {number} lineNumber | |
| 121 * @param {number} columnNumber | |
| 122 */ | |
| 123 didReceiveBreakpointLineForTest: function(uiSourceCode, lineNumber, columnNu
mber) | |
| 124 { | |
| 125 }, | |
| 126 | |
| 127 /** | |
| 128 * @param {!WebInspector.Event} event | |
| 129 */ | |
| 130 _breakpointRemoved: function(event) | |
| 131 { | |
| 132 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint}
*/ (event.data.breakpoint); | |
| 133 var breakpointItem = this._items.get(breakpoint); | |
| 134 if (!breakpointItem) | |
| 135 return; | |
| 136 this._items.remove(breakpoint); | |
| 137 this._removeListElement(breakpointItem.element); | |
| 138 }, | |
| 139 | |
| 140 /** | |
| 141 * @override | |
| 142 * @param {?Object} object | |
| 143 */ | |
| 144 flavorChanged: function(object) | |
| 145 { | |
| 146 this._update(); | |
| 147 }, | |
| 148 | |
| 149 _update: function() | |
| 150 { | |
| 151 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDet
ails); | |
| 152 var uiLocation = details && details.callFrames.length ? WebInspector.deb
uggerWorkspaceBinding.rawLocationToUILocation(details.callFrames[0].location())
: null; | |
| 153 var breakpoint = uiLocation ? this._breakpointManager.findBreakpointOnLi
ne(uiLocation.uiSourceCode, uiLocation.lineNumber) : null; | |
| 154 var breakpointItem = this._items.get(breakpoint); | |
| 155 if (!breakpointItem) { | |
| 156 if (this._highlightedBreakpointItem) { | |
| 157 this._highlightedBreakpointItem.element.classList.remove("breakp
oint-hit"); | |
| 158 delete this._highlightedBreakpointItem; | |
| 159 } | |
| 160 return; | |
| 161 } | |
| 162 | |
| 163 breakpointItem.element.classList.add("breakpoint-hit"); | |
| 164 this._highlightedBreakpointItem = breakpointItem; | |
| 165 WebInspector.viewManager.showView("sources.jsBreakpoints"); | |
| 166 }, | |
| 167 | |
| 168 _breakpointsActiveStateChanged: function() | |
| 169 { | |
| 170 this._listElement.classList.toggle("breakpoints-list-deactivated", !this
._breakpointManager.breakpointsActive()); | |
| 171 }, | |
| 172 | |
| 173 /** | |
| 174 * @param {!WebInspector.UILocation} uiLocation | |
| 175 */ | |
| 176 _breakpointClicked: function(uiLocation) | |
| 177 { | |
| 178 WebInspector.Revealer.reveal(uiLocation); | |
| 179 }, | |
| 180 | |
| 181 /** | |
| 182 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | |
| 183 * @param {!Event} event | |
| 184 */ | |
| 185 _breakpointCheckboxClicked: function(breakpoint, event) | |
| 186 { | |
| 187 // Breakpoint element has it's own click handler. | |
| 188 event.consume(); | |
| 189 breakpoint.setEnabled(event.target.checkboxElement.checked); | |
| 190 }, | |
| 191 | |
| 192 /** | |
| 193 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | |
| 194 * @param {!Event} event | |
| 195 */ | |
| 196 _breakpointContextMenu: function(breakpoint, event) | |
| 197 { | |
| 198 var breakpoints = this._items.valuesArray(); | |
| 199 var contextMenu = new WebInspector.ContextMenu(event); | |
| 200 contextMenu.appendItem(WebInspector.UIString.capitalize("Remove ^breakpo
int"), breakpoint.remove.bind(breakpoint)); | |
| 201 if (breakpoints.length > 1) { | |
| 202 var removeAllTitle = WebInspector.UIString.capitalize("Remove ^all ^
breakpoints"); | |
| 203 contextMenu.appendItem(removeAllTitle, this._breakpointManager.remov
eAllBreakpoints.bind(this._breakpointManager)); | |
| 204 } | |
| 205 | |
| 206 contextMenu.appendSeparator(); | |
| 207 this._appendBreakpointActiveItem(contextMenu); | |
| 208 | |
| 209 function enabledBreakpointCount(breakpoints) | |
| 210 { | |
| 211 var count = 0; | |
| 212 for (var i = 0; i < breakpoints.length; ++i) { | |
| 213 if (breakpoints[i].checkbox.checked) | |
| 214 count++; | |
| 215 } | |
| 216 return count; | |
| 217 } | |
| 218 if (breakpoints.length > 1) { | |
| 219 var enableBreakpointCount = enabledBreakpointCount(breakpoints); | |
| 220 var enableTitle = WebInspector.UIString.capitalize("Enable ^all ^bre
akpoints"); | |
| 221 var disableTitle = WebInspector.UIString.capitalize("Disable ^all ^b
reakpoints"); | |
| 222 | |
| 223 contextMenu.appendSeparator(); | |
| 224 | |
| 225 contextMenu.appendItem(enableTitle, this._breakpointManager.toggleAl
lBreakpoints.bind(this._breakpointManager, true), !(enableBreakpointCount !== br
eakpoints.length)); | |
| 226 contextMenu.appendItem(disableTitle, this._breakpointManager.toggleA
llBreakpoints.bind(this._breakpointManager, false), !(enableBreakpointCount > 1)
); | |
| 227 } | |
| 228 | |
| 229 contextMenu.show(); | |
| 230 }, | |
| 231 | |
| 232 _addListElement: function(element, beforeElement) | |
| 233 { | |
| 234 if (beforeElement) | |
| 235 this._listElement.insertBefore(element, beforeElement); | |
| 236 else { | |
| 237 if (!this._listElement.firstChild) { | |
| 238 this.element.removeChild(this.emptyElement); | |
| 239 this.element.appendChild(this._listElement); | |
| 240 } | |
| 241 this._listElement.appendChild(element); | |
| 242 } | |
| 243 }, | |
| 244 | |
| 245 _removeListElement: function(element) | |
| 246 { | |
| 247 this._listElement.removeChild(element); | |
| 248 if (!this._listElement.firstChild) { | |
| 249 this.element.removeChild(this._listElement); | |
| 250 this.element.appendChild(this.emptyElement); | |
| 251 } | |
| 252 }, | |
| 253 | |
| 254 _compare: function(x, y) | |
| 255 { | |
| 256 if (x !== y) | |
| 257 return x < y ? -1 : 1; | |
| 258 return 0; | |
| 259 }, | |
| 260 | |
| 261 _compareBreakpoints: function(b1, b2) | |
| 262 { | |
| 263 return this._compare(b1.uiSourceCode.url(), b2.uiSourceCode.url()) || th
is._compare(b1.lineNumber, b2.lineNumber); | |
| 264 }, | |
| 265 | |
| 266 reset: function() | |
| 267 { | |
| 268 this._listElement.removeChildren(); | |
| 269 if (this._listElement.parentElement) { | |
| 270 this.element.removeChild(this._listElement); | |
| 271 this.element.appendChild(this.emptyElement); | |
| 272 } | |
| 273 this._items.clear(); | |
| 274 }, | |
| 275 | |
| 276 __proto__: WebInspector.VBox.prototype | |
| 277 }; | |
| OLD | NEW |