Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 this._contextMenuLabels = {}; | 53 this._contextMenuLabels = {}; |
| 54 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto r.UIString.capitalize("Subtree ^modifications"); | 54 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto r.UIString.capitalize("Subtree ^modifications"); |
| 55 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec tor.UIString.capitalize("Attributes ^modifications"); | 55 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec tor.UIString.capitalize("Attributes ^modifications"); |
| 56 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI String.capitalize("Node ^removal"); | 56 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI String.capitalize("Node ^removal"); |
| 57 | 57 |
| 58 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.InspectedURLChanged, this._inspectedURLChanged, this); | 58 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.InspectedURLChanged, this._inspectedURLChanged, this); |
| 59 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); | 59 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 WebInspector.DOMBreakpointsSidebarPane.Events = { | 62 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint"; |
|
dgozman
2015/08/07 23:35:05
When I see constant, I assume that only this const
pfeldman
2015/08/10 21:25:16
I'd rather leave it as is. It has multiple usages.
| |
| 63 BreakpointsChanged: "BreakpointsChanged" | |
| 64 } | |
| 65 | |
| 66 WebInspector.DOMBreakpointsSidebarPane.BreakpointPropertyName = "BreakpointPrope rtyName"; | |
| 67 | 63 |
| 68 WebInspector.DOMBreakpointsSidebarPane.prototype = { | 64 WebInspector.DOMBreakpointsSidebarPane.prototype = { |
| 69 _inspectedURLChanged: function(event) | 65 _inspectedURLChanged: function(event) |
| 70 { | 66 { |
| 71 this._breakpointElements = {}; | 67 this._breakpointElements = {}; |
| 72 this.reset(); | 68 this.reset(); |
| 73 var url = /** @type {string} */ (event.data); | 69 var url = /** @type {string} */ (event.data); |
| 74 this._inspectedURL = url.removeURLFragment(); | 70 this._inspectedURL = url.removeURLFragment(); |
| 75 }, | 71 }, |
| 76 | 72 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 _setBreakpoint: function(node, type, enabled) | 228 _setBreakpoint: function(node, type, enabled) |
| 233 { | 229 { |
| 234 var breakpointId = this._createBreakpointId(node.id, type); | 230 var breakpointId = this._createBreakpointId(node.id, type); |
| 235 var breakpointElement = this._breakpointElements[breakpointId]; | 231 var breakpointElement = this._breakpointElements[breakpointId]; |
| 236 if (!breakpointElement) { | 232 if (!breakpointElement) { |
| 237 breakpointElement = this._createBreakpointElement(node, type, enable d); | 233 breakpointElement = this._createBreakpointElement(node, type, enable d); |
| 238 this._breakpointElements[breakpointId] = breakpointElement; | 234 this._breakpointElements[breakpointId] = breakpointElement; |
| 239 } else { | 235 } else { |
| 240 breakpointElement._checkboxElement.checked = enabled; | 236 breakpointElement._checkboxElement.checked = enabled; |
| 241 } | 237 } |
| 242 node.setUserProperty(WebInspector.DOMBreakpointsSidebarPane.BreakpointPr opertyName, true); | 238 node.setMarker(WebInspector.DOMBreakpointsSidebarPane.Marker, true); |
| 243 this.dispatchEventToListeners(WebInspector.DOMBreakpointsSidebarPane.Eve nts.BreakpointsChanged, {node: node}); | |
| 244 }, | 239 }, |
| 245 | 240 |
| 246 /** | 241 /** |
| 247 * @param {!WebInspector.DOMNode} node | 242 * @param {!WebInspector.DOMNode} node |
| 248 * @param {!DOMDebuggerAgent.DOMBreakpointType} type | 243 * @param {!DOMDebuggerAgent.DOMBreakpointType} type |
| 249 * @param {boolean} enabled | 244 * @param {boolean} enabled |
| 250 */ | 245 */ |
| 251 _createBreakpointElement: function(node, type, enabled) | 246 _createBreakpointElement: function(node, type, enabled) |
| 252 { | 247 { |
| 253 var element = createElement("li"); | 248 var element = createElement("li"); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 { | 294 { |
| 300 var breakpointId = this._createBreakpointId(node.id, type); | 295 var breakpointId = this._createBreakpointId(node.id, type); |
| 301 var element = this._breakpointElements[breakpointId]; | 296 var element = this._breakpointElements[breakpointId]; |
| 302 if (!element) | 297 if (!element) |
| 303 return; | 298 return; |
| 304 | 299 |
| 305 this.removeListElement(element); | 300 this.removeListElement(element); |
| 306 delete this._breakpointElements[breakpointId]; | 301 delete this._breakpointElements[breakpointId]; |
| 307 if (element._checkboxElement.checked) | 302 if (element._checkboxElement.checked) |
| 308 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type); | 303 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type); |
| 309 var hasBreakpoints = this.hasBreakpoints(node); | 304 node.setMarker(WebInspector.DOMBreakpointsSidebarPane.Marker, this.hasBr eakpoints(node) ? true : null); |
| 310 if (hasBreakpoints) | |
| 311 node.setUserProperty(WebInspector.DOMBreakpointsSidebarPane.Breakpoi ntPropertyName, true); | |
| 312 else | |
| 313 node.removeUserProperty(WebInspector.DOMBreakpointsSidebarPane.Break pointPropertyName); | |
| 314 this.dispatchEventToListeners(WebInspector.DOMBreakpointsSidebarPane.Eve nts.BreakpointsChanged, {node: node}); | |
| 315 }, | 305 }, |
| 316 | 306 |
| 317 /** | 307 /** |
| 318 * @param {!WebInspector.DOMNode} node | 308 * @param {!WebInspector.DOMNode} node |
| 319 * @param {!DOMDebuggerAgent.DOMBreakpointType} type | 309 * @param {!DOMDebuggerAgent.DOMBreakpointType} type |
| 320 * @param {!Event} event | 310 * @param {!Event} event |
| 321 */ | 311 */ |
| 322 _contextMenu: function(node, type, event) | 312 _contextMenu: function(node, type, event) |
| 323 { | 313 { |
| 324 var contextMenu = new WebInspector.ContextMenu(event); | 314 var contextMenu = new WebInspector.ContextMenu(event); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 _reattachBody: function() | 481 _reattachBody: function() |
| 492 { | 482 { |
| 493 if (this._wrappedPane.element.parentNode !== this.element) | 483 if (this._wrappedPane.element.parentNode !== this.element) |
| 494 this._wrappedPane.show(this.element); | 484 this._wrappedPane.show(this.element); |
| 495 }, | 485 }, |
| 496 | 486 |
| 497 __proto__: WebInspector.SidebarPane.prototype | 487 __proto__: WebInspector.SidebarPane.prototype |
| 498 } | 488 } |
| 499 | 489 |
| 500 /** | 490 /** |
| 491 * @constructor | |
| 492 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} | |
| 493 */ | |
| 494 WebInspector.DOMBreakpointsSidebarPane.MarkerDecorator = function() | |
| 495 { | |
| 496 } | |
| 497 | |
| 498 WebInspector.DOMBreakpointsSidebarPane.MarkerDecorator.prototype = { | |
| 499 /** | |
| 500 * @override | |
| 501 * @param {!WebInspector.DOMNode} node | |
| 502 * @return {?string} | |
| 503 */ | |
| 504 decorate: function(node) | |
| 505 { | |
| 506 return WebInspector.UIString("DOM Breakpoint"); | |
| 507 } | |
| 508 } | |
| 509 | |
| 510 /** | |
| 501 * @type {!WebInspector.DOMBreakpointsSidebarPane} | 511 * @type {!WebInspector.DOMBreakpointsSidebarPane} |
| 502 */ | 512 */ |
| 503 WebInspector.domBreakpointsSidebarPane; | 513 WebInspector.domBreakpointsSidebarPane; |
| OLD | NEW |