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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.BreakpointsSidebarPaneBase} | 33 * @extends {WebInspector.BreakpointsSidebarPaneBase} |
| 34 * @implements {WebInspector.ContextFlavorListener} |
34 */ | 35 */ |
35 WebInspector.DOMBreakpointsSidebarPane = function() | 36 WebInspector.DOMBreakpointsSidebarPane = function() |
36 { | 37 { |
37 WebInspector.BreakpointsSidebarPaneBase.call(this); | 38 WebInspector.BreakpointsSidebarPaneBase.call(this); |
38 this._domBreakpointsSetting = WebInspector.settings.createLocalSetting("domB
reakpoints", []); | 39 this._domBreakpointsSetting = WebInspector.settings.createLocalSetting("domB
reakpoints", []); |
39 this.listElement.classList.add("dom-breakpoints-list"); | 40 this.listElement.classList.add("dom-breakpoints-list"); |
40 | 41 |
41 this._breakpointElements = {}; | 42 this._breakpointElements = {}; |
42 | 43 |
43 this._breakpointTypes = { | 44 this._breakpointTypes = { |
44 SubtreeModified: "subtree-modified", | 45 SubtreeModified: "subtree-modified", |
45 AttributeModified: "attribute-modified", | 46 AttributeModified: "attribute-modified", |
46 NodeRemoved: "node-removed" | 47 NodeRemoved: "node-removed" |
47 }; | 48 }; |
48 this._breakpointTypeLabels = {}; | 49 this._breakpointTypeLabels = {}; |
49 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe
ctor.UIString("Subtree Modified"); | 50 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe
ctor.UIString("Subtree Modified"); |
50 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns
pector.UIString("Attribute Modified"); | 51 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns
pector.UIString("Attribute Modified"); |
51 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector
.UIString("Node Removed"); | 52 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector
.UIString("Node Removed"); |
52 | 53 |
53 this._contextMenuLabels = {}; | 54 this._contextMenuLabels = {}; |
54 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto
r.UIString.capitalize("Subtree ^modifications"); | 55 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto
r.UIString.capitalize("Subtree ^modifications"); |
55 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec
tor.UIString.capitalize("Attributes ^modifications"); | 56 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec
tor.UIString.capitalize("Attributes ^modifications"); |
56 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI
String.capitalize("Node ^removal"); | 57 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI
String.capitalize("Node ^removal"); |
57 | 58 |
| 59 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); |
58 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.InspectedURLChanged, this._inspectedURLChanged, this); | 60 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); | 61 this._inspectedURL = WebInspector.targetManager.inspectedURL(); |
| 62 this._update(); |
60 } | 63 } |
61 | 64 |
62 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker"; | 65 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker"; |
63 | 66 |
64 WebInspector.DOMBreakpointsSidebarPane.prototype = { | 67 WebInspector.DOMBreakpointsSidebarPane.prototype = { |
65 _inspectedURLChanged: function(event) | 68 _inspectedURLChanged: function() |
66 { | 69 { |
67 var target = /** @type {!WebInspector.Target} */ (event.data); | |
68 if (target !== WebInspector.targetManager.mainTarget()) | |
69 return; | |
70 this._breakpointElements = {}; | 70 this._breakpointElements = {}; |
71 this.reset(); | 71 this.reset(); |
72 this._inspectedURL = target.inspectedURL().removeURLFragment(); | 72 this._inspectedURL = WebInspector.targetManager.inspectedURL(); |
73 }, | 73 }, |
74 | 74 |
75 /** | 75 /** |
76 * @param {!WebInspector.DOMNode} node | 76 * @param {!WebInspector.DOMNode} node |
77 * @param {!WebInspector.ContextMenu} contextMenu | 77 * @param {!WebInspector.ContextMenu} contextMenu |
78 * @param {boolean} createSubMenu | 78 * @param {boolean} createSubMenu |
79 */ | 79 */ |
80 populateNodeContextMenu: function(node, contextMenu, createSubMenu) | 80 populateNodeContextMenu: function(node, contextMenu, createSubMenu) |
81 { | 81 { |
82 if (node.pseudoType()) | 82 if (node.pseudoType()) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 { | 315 { |
316 if (event.target.checked) | 316 if (event.target.checked) |
317 node.target().domdebuggerAgent().setDOMBreakpoint(node.id, type); | 317 node.target().domdebuggerAgent().setDOMBreakpoint(node.id, type); |
318 else | 318 else |
319 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type); | 319 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type); |
320 this._saveBreakpoints(); | 320 this._saveBreakpoints(); |
321 }, | 321 }, |
322 | 322 |
323 /** | 323 /** |
324 * @override | 324 * @override |
325 * @param {?WebInspector.DebuggerPausedDetails} details | 325 * @param {?Object} object |
326 */ | 326 */ |
327 highlightDetails: function(details) | 327 flavorChanged: function(object) |
328 { | 328 { |
| 329 this._update(); |
| 330 }, |
| 331 |
| 332 _update: function() |
| 333 { |
| 334 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDet
ails); |
329 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso
n.DOM) { | 335 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso
n.DOM) { |
330 if (this._highlightedElement) { | 336 if (this._highlightedElement) { |
331 this._highlightedElement.classList.remove("breakpoint-hit"); | 337 this._highlightedElement.classList.remove("breakpoint-hit"); |
332 delete this._highlightedElement; | 338 delete this._highlightedElement; |
333 } | 339 } |
334 return; | 340 return; |
335 } | 341 } |
336 var auxData = details.auxData; | 342 var auxData = details.auxData; |
337 var breakpointId = this._createBreakpointId(auxData.nodeId, auxData.type
); | 343 var breakpointId = this._createBreakpointId(auxData.nodeId, auxData.type
); |
338 var element = this._breakpointElements[breakpointId]; | 344 var element = this._breakpointElements[breakpointId]; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 pane.show(this.element); | 433 pane.show(this.element); |
428 }, | 434 }, |
429 | 435 |
430 __proto__: WebInspector.VBox.prototype | 436 __proto__: WebInspector.VBox.prototype |
431 } | 437 } |
432 | 438 |
433 /** | 439 /** |
434 * @type {!WebInspector.DOMBreakpointsSidebarPane} | 440 * @type {!WebInspector.DOMBreakpointsSidebarPane} |
435 */ | 441 */ |
436 WebInspector.domBreakpointsSidebarPane; | 442 WebInspector.domBreakpointsSidebarPane; |
OLD | NEW |