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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 WebInspector.LayerTreeElement = function(tree, layer) | 178 WebInspector.LayerTreeElement = function(tree, layer) |
179 { | 179 { |
180 TreeElement.call(this, "", layer); | 180 TreeElement.call(this, "", layer); |
181 this._treeOutline = tree; | 181 this._treeOutline = tree; |
182 this._update(); | 182 this._update(); |
183 } | 183 } |
184 | 184 |
185 WebInspector.LayerTreeElement.prototype = { | 185 WebInspector.LayerTreeElement.prototype = { |
186 onattach: function() | 186 onattach: function() |
187 { | 187 { |
188 var selection = document.createElement("div"); | 188 var selection = createElement("div"); |
189 selection.className = "selection"; | 189 selection.className = "selection"; |
190 this.listItemElement.insertBefore(selection, this.listItemElement.firstC
hild); | 190 this.listItemElement.insertBefore(selection, this.listItemElement.firstC
hild); |
191 }, | 191 }, |
192 | 192 |
193 _update: function() | 193 _update: function() |
194 { | 194 { |
195 var layer = /** @type {!WebInspector.Layer} */ (this.representedObject); | 195 var layer = /** @type {!WebInspector.Layer} */ (this.representedObject); |
196 var node = layer.nodeForSelfOrAncestor(); | 196 var node = layer.nodeForSelfOrAncestor(); |
197 var title = document.createDocumentFragment(); | 197 var title = createDocumentFragment(); |
198 title.createChild("div", "selection"); | 198 title.createChild("div", "selection"); |
199 title.createTextChild(node ? WebInspector.DOMPresentationUtils.simpleSel
ector(node) : "#" + layer.id()); | 199 title.createTextChild(node ? WebInspector.DOMPresentationUtils.simpleSel
ector(node) : "#" + layer.id()); |
200 var details = title.createChild("span", "dimmed"); | 200 var details = title.createChild("span", "dimmed"); |
201 details.textContent = WebInspector.UIString(" (%d × %d)", layer.width(),
layer.height()); | 201 details.textContent = WebInspector.UIString(" (%d × %d)", layer.width(),
layer.height()); |
202 this.title = title; | 202 this.title = title; |
203 }, | 203 }, |
204 | 204 |
205 /** | 205 /** |
206 * @override | 206 * @override |
207 * @return {boolean} | 207 * @return {boolean} |
208 */ | 208 */ |
209 onselect: function() | 209 onselect: function() |
210 { | 210 { |
211 this._treeOutline._selectedNodeChanged(this); | 211 this._treeOutline._selectedNodeChanged(this); |
212 return false; | 212 return false; |
213 }, | 213 }, |
214 | 214 |
215 /** | 215 /** |
216 * @param {boolean} hovered | 216 * @param {boolean} hovered |
217 */ | 217 */ |
218 setHovered: function(hovered) | 218 setHovered: function(hovered) |
219 { | 219 { |
220 this.listItemElement.classList.toggle("hovered", hovered); | 220 this.listItemElement.classList.toggle("hovered", hovered); |
221 }, | 221 }, |
222 | 222 |
223 __proto__: TreeElement.prototype | 223 __proto__: TreeElement.prototype |
224 } | 224 } |
OLD | NEW |