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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 this._breakpointTypes = { | 45 this._breakpointTypes = { |
46 SubtreeModified: "subtree-modified", | 46 SubtreeModified: "subtree-modified", |
47 AttributeModified: "attribute-modified", | 47 AttributeModified: "attribute-modified", |
48 NodeRemoved: "node-removed" | 48 NodeRemoved: "node-removed" |
49 }; | 49 }; |
50 this._breakpointTypeLabels = {}; | 50 this._breakpointTypeLabels = {}; |
51 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe
ctor.UIString("Subtree Modified"); | 51 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe
ctor.UIString("Subtree Modified"); |
52 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns
pector.UIString("Attribute Modified"); | 52 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns
pector.UIString("Attribute Modified"); |
53 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector
.UIString("Node Removed"); | 53 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector
.UIString("Node Removed"); |
54 | 54 |
55 this._contextMenuLabels = {}; | 55 this._breakpointTypeNouns = {}; |
56 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto
r.UIString.capitalize("Subtree ^modifications"); | 56 this._breakpointTypeNouns[this._breakpointTypes.SubtreeModified] = WebInspec
tor.UIString.capitalize("Subtree ^modifications"); |
57 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec
tor.UIString.capitalize("Attributes ^modifications"); | 57 this._breakpointTypeNouns[this._breakpointTypes.AttributeModified] = WebInsp
ector.UIString.capitalize("Attribute ^modifications"); |
58 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI
String.capitalize("Node ^removal"); | 58 this._breakpointTypeNouns[this._breakpointTypes.NodeRemoved] = WebInspector.
UIString.capitalize("Node ^removal"); |
59 | 59 |
60 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); | 60 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); |
61 this._update(); | 61 this._update(); |
62 } | 62 } |
63 | 63 |
64 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker"; | 64 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker"; |
65 | 65 |
66 WebInspector.DOMBreakpointsSidebarPane.prototype = { | 66 WebInspector.DOMBreakpointsSidebarPane.prototype = { |
67 /** | 67 /** |
68 * @param {!WebInspector.DOMNode} node | 68 * @param {!WebInspector.DOMNode} node |
(...skipping 16 matching lines...) Expand all Loading... |
85 if (!nodeBreakpoints.has(type)) | 85 if (!nodeBreakpoints.has(type)) |
86 this._setBreakpoint(node, type, true); | 86 this._setBreakpoint(node, type, true); |
87 else | 87 else |
88 this._removeBreakpoint(node, type); | 88 this._removeBreakpoint(node, type); |
89 this._saveBreakpoints(); | 89 this._saveBreakpoints(); |
90 } | 90 } |
91 | 91 |
92 var breakpointsMenu = createSubMenu ? contextMenu.appendSubMenuItem(WebI
nspector.UIString("Break on...")) : contextMenu; | 92 var breakpointsMenu = createSubMenu ? contextMenu.appendSubMenuItem(WebI
nspector.UIString("Break on...")) : contextMenu; |
93 for (var key in this._breakpointTypes) { | 93 for (var key in this._breakpointTypes) { |
94 var type = this._breakpointTypes[key]; | 94 var type = this._breakpointTypes[key]; |
95 var label = this._contextMenuLabels[type]; | 95 var label = this._breakpointTypeNouns[type]; |
96 breakpointsMenu.appendCheckboxItem(label, toggleBreakpoint.bind(this
, type), nodeBreakpoints.has(type)); | 96 breakpointsMenu.appendCheckboxItem(label, toggleBreakpoint.bind(this
, type), nodeBreakpoints.has(type)); |
97 } | 97 } |
98 }, | 98 }, |
99 | 99 |
100 /** | 100 /** |
101 * @param {!WebInspector.DOMNode} node | 101 * @param {!WebInspector.DOMNode} node |
102 * @return {!Set<!DOMDebuggerAgent.DOMBreakpointType>} | 102 * @return {!Set<!DOMDebuggerAgent.DOMBreakpointType>} |
103 */ | 103 */ |
104 _nodeBreakpoints: function(node) | 104 _nodeBreakpoints: function(node) |
105 { | 105 { |
(...skipping 16 matching lines...) Expand all Loading... |
122 if (element._node === node && element._checkboxElement.checked) | 122 if (element._node === node && element._checkboxElement.checked) |
123 return true; | 123 return true; |
124 } | 124 } |
125 return false; | 125 return false; |
126 }, | 126 }, |
127 | 127 |
128 /** | 128 /** |
129 * @param {!WebInspector.DebuggerPausedDetails} details | 129 * @param {!WebInspector.DebuggerPausedDetails} details |
130 * @return {!Element} | 130 * @return {!Element} |
131 */ | 131 */ |
132 createBreakpointHitStatusMessage: function(details) | 132 createBreakpointHitMessage: function(details) |
133 { | 133 { |
| 134 var messageWrapper = createElement("span"); |
| 135 var mainElement = messageWrapper.createChild("div", "status-main"); |
134 var auxData = /** @type {!Object} */ (details.auxData); | 136 var auxData = /** @type {!Object} */ (details.auxData); |
135 var message = "Paused on a \"%s\" breakpoint."; | 137 mainElement.textContent = String.sprintf("Paused on %s", this._breakpoin
tTypeNouns[auxData["type"]]); |
136 var substitutions = []; | |
137 substitutions.push(this._breakpointTypeLabels[auxData["type"]]); | |
138 | 138 |
139 var domModel = WebInspector.DOMModel.fromTarget(details.target()); | 139 var domModel = WebInspector.DOMModel.fromTarget(details.target()); |
140 if (!domModel) | 140 if (domModel) { |
141 return WebInspector.formatLocalized(message, substitutions); | 141 var subElement = messageWrapper.createChild("div", "status-sub"); |
| 142 var node = domModel.nodeForId(auxData["nodeId"]); |
| 143 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeRef
erence(node); |
| 144 subElement.appendChild(linkifiedNode); |
142 | 145 |
143 var node = domModel.nodeForId(auxData["nodeId"]); | 146 var targetNode = auxData["targetNodeId"] ? domModel.nodeForId(auxDat
a["targetNodeId"]) : null; |
144 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen
ce(node); | 147 var targetNodeLink = targetNode ? WebInspector.DOMPresentationUtils.
linkifyNodeReference(targetNode) : ""; |
145 substitutions.push(linkifiedNode); | 148 var message; |
146 | 149 if (auxData.type === this._breakpointTypes.SubtreeModified) { |
147 var targetNode = auxData["targetNodeId"] ? domModel.nodeForId(auxData["t
argetNodeId"]) : null; | 150 if (auxData["insertion"]) |
148 var targetNodeLink = targetNode ? WebInspector.DOMPresentationUtils.link
ifyNodeReference(targetNode) : ""; | 151 message = targetNode === node ? "Child %s added" : "Descenda
nt %s added"; |
149 | 152 else |
150 if (auxData.type === this._breakpointTypes.SubtreeModified) { | 153 message = "Descendant %s removed"; |
151 if (auxData["insertion"]) { | 154 subElement.appendChild(createElement("br")); |
152 if (targetNode !== node) { | 155 subElement.appendChild(WebInspector.formatLocalized(message, [ta
rgetNodeLink])); |
153 message = "Paused on a \"%s\" breakpoint set on %s, because
a new child was added to its descendant %s."; | |
154 substitutions.push(targetNodeLink); | |
155 } else | |
156 message = "Paused on a \"%s\" breakpoint set on %s, because
a new child was added to that node."; | |
157 } else { | |
158 message = "Paused on a \"%s\" breakpoint set on %s, because its
descendant %s was removed."; | |
159 substitutions.push(targetNodeLink); | |
160 } | 156 } |
161 } else { | |
162 message = "Paused on a \"%s\" breakpoint set on %s."; | |
163 } | 157 } |
164 | 158 return messageWrapper; |
165 return WebInspector.formatLocalized(message, substitutions); | |
166 }, | 159 }, |
167 | 160 |
168 _nodeRemoved: function(event) | 161 _nodeRemoved: function(event) |
169 { | 162 { |
170 var node = event.data.node; | 163 var node = event.data.node; |
171 this._removeBreakpointsForNode(event.data.node); | 164 this._removeBreakpointsForNode(event.data.node); |
172 var children = node.children(); | 165 var children = node.children(); |
173 if (!children) | 166 if (!children) |
174 return; | 167 return; |
175 for (var i = 0; i < children.length; ++i) | 168 for (var i = 0; i < children.length; ++i) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 pane.show(this.element); | 418 pane.show(this.element); |
426 }, | 419 }, |
427 | 420 |
428 __proto__: WebInspector.VBox.prototype | 421 __proto__: WebInspector.VBox.prototype |
429 } | 422 } |
430 | 423 |
431 /** | 424 /** |
432 * @type {!WebInspector.DOMBreakpointsSidebarPane} | 425 * @type {!WebInspector.DOMBreakpointsSidebarPane} |
433 */ | 426 */ |
434 WebInspector.domBreakpointsSidebarPane; | 427 WebInspector.domBreakpointsSidebarPane; |
OLD | NEW |