OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 * @param {?Event} event | 152 * @param {?Event} event |
153 */ | 153 */ |
154 _onContextMenu: function(event) | 154 _onContextMenu: function(event) |
155 { | 155 { |
156 var node = this._treeOutline.treeElementFromPoint(event.pageX, event.pag
eY); | 156 var node = this._treeOutline.treeElementFromPoint(event.pageX, event.pag
eY); |
157 if (!node || !node.representedObject) | 157 if (!node || !node.representedObject) |
158 return; | 158 return; |
159 var layer = /** @type {!WebInspector.Layer} */ (node.representedObject); | 159 var layer = /** @type {!WebInspector.Layer} */ (node.representedObject); |
160 if (!layer) | 160 if (!layer) |
161 return; | 161 return; |
162 var nodeId = layer.nodeId(); | 162 var nodeId = layer.nodeIdForSelfOrAncestor(); |
163 if (!nodeId) | 163 if (!nodeId) |
164 return; | 164 return; |
165 var domNode = WebInspector.domAgent.nodeForId(nodeId); | 165 var domNode = WebInspector.domAgent.nodeForId(nodeId); |
166 if (!domNode) | 166 if (!domNode) |
167 return; | 167 return; |
168 var contextMenu = new WebInspector.ContextMenu(event); | 168 var contextMenu = new WebInspector.ContextMenu(event); |
169 contextMenu.appendApplicableItems(domNode); | 169 contextMenu.appendApplicableItems(domNode); |
170 contextMenu.show(); | 170 contextMenu.show(); |
171 }, | 171 }, |
172 | 172 |
(...skipping 21 matching lines...) Expand all Loading... |
194 this.listItemElement.insertBefore(selection, this.listItemElement.firstC
hild); | 194 this.listItemElement.insertBefore(selection, this.listItemElement.firstC
hild); |
195 }, | 195 }, |
196 | 196 |
197 _update: function() | 197 _update: function() |
198 { | 198 { |
199 var layer = /** @type {!WebInspector.Layer} */ (this.representedObject); | 199 var layer = /** @type {!WebInspector.Layer} */ (this.representedObject); |
200 var nodeId = layer.nodeIdForSelfOrAncestor(); | 200 var nodeId = layer.nodeIdForSelfOrAncestor(); |
201 var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; | 201 var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; |
202 var title = document.createDocumentFragment(); | 202 var title = document.createDocumentFragment(); |
203 title.createChild("div", "selection"); | 203 title.createChild("div", "selection"); |
204 title.appendChild(document.createTextNode(node ? WebInspector.DOMPresent
ationUtils.fullQualifiedSelector(node, false) : "#" + layer.id())); | 204 title.appendChild(document.createTextNode(node ? WebInspector.DOMPresent
ationUtils.simpleSelector(node) : "#" + layer.id())); |
205 var details = title.createChild("span", "dimmed"); | 205 var details = title.createChild("span", "dimmed"); |
206 details.textContent = WebInspector.UIString(" (%d × %d)", layer.width(),
layer.height()); | 206 details.textContent = WebInspector.UIString(" (%d × %d)", layer.width(),
layer.height()); |
207 this.title = title; | 207 this.title = title; |
208 }, | 208 }, |
209 | 209 |
210 /** | 210 /** |
211 * @override | 211 * @override |
212 * @return {boolean} | 212 * @return {boolean} |
213 */ | 213 */ |
214 onselect: function() | 214 onselect: function() |
215 { | 215 { |
216 this._layerTree._selectedNodeChanged(this); | 216 this._layerTree._selectedNodeChanged(this); |
217 return false; | 217 return false; |
218 }, | 218 }, |
219 | 219 |
220 /** | 220 /** |
221 * @param {boolean} hovered | 221 * @param {boolean} hovered |
222 */ | 222 */ |
223 setHovered: function(hovered) | 223 setHovered: function(hovered) |
224 { | 224 { |
225 this.listItemElement.classList.toggle("hovered", hovered); | 225 this.listItemElement.classList.toggle("hovered", hovered); |
226 }, | 226 }, |
227 | 227 |
228 __proto__: TreeElement.prototype | 228 __proto__: TreeElement.prototype |
229 } | 229 } |
OLD | NEW |