OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 22 matching lines...) Expand all Loading... |
33 * @extends {TreeElement} | 33 * @extends {TreeElement} |
34 * @param {!WebInspector.DOMNode} node | 34 * @param {!WebInspector.DOMNode} node |
35 * @param {boolean=} elementCloseTag | 35 * @param {boolean=} elementCloseTag |
36 */ | 36 */ |
37 WebInspector.ElementsTreeElement = function(node, elementCloseTag) | 37 WebInspector.ElementsTreeElement = function(node, elementCloseTag) |
38 { | 38 { |
39 // The title will be updated in onattach. | 39 // The title will be updated in onattach. |
40 TreeElement.call(this); | 40 TreeElement.call(this); |
41 this._node = node; | 41 this._node = node; |
42 | 42 |
43 this._decorationsElement = createElementWithClass("div"); | 43 this._decorationsElement = createElementWithClass("div", "hidden"); |
44 this.listItemElement.appendChild(this._decorationsElement); | 44 this.listItemElement.appendChild(this._decorationsElement); |
45 | 45 |
46 this._elementCloseTag = elementCloseTag; | 46 this._elementCloseTag = elementCloseTag; |
47 | 47 |
48 if (this._node.nodeType() == Node.ELEMENT_NODE && !elementCloseTag) | 48 if (this._node.nodeType() == Node.ELEMENT_NODE && !elementCloseTag) |
49 this._canAddAttributes = true; | 49 this._canAddAttributes = true; |
50 this._searchQuery = null; | 50 this._searchQuery = null; |
51 this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildr
enLimit; | 51 this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildr
enLimit; |
52 if (this._node.nodeType() === Node.ELEMENT_NODE && this._node.parentNode &&
this._node.parentNode.nodeType() === Node.DOCUMENT_NODE && !this._node.parentNod
e.parentNode) | 52 if (this._node.nodeType() === Node.ELEMENT_NODE && this._node.parentNode &&
this._node.parentNode.nodeType() === Node.DOCUMENT_NODE && !this._node.parentNod
e.parentNode) |
53 this.setCollapsible(false); | 53 this.setCollapsible(false); |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 } | 1121 } |
1122 | 1122 |
1123 Promise.all(promises).then(setTitle.bind(this)); | 1123 Promise.all(promises).then(setTitle.bind(this)); |
1124 | 1124 |
1125 /** | 1125 /** |
1126 * @this {WebInspector.ElementsTreeElement} | 1126 * @this {WebInspector.ElementsTreeElement} |
1127 */ | 1127 */ |
1128 function setTitle() | 1128 function setTitle() |
1129 { | 1129 { |
1130 this._decorationsElement.removeChildren(); | 1130 this._decorationsElement.removeChildren(); |
| 1131 this._decorationsElement.classList.add("hidden"); |
1131 if (!decorations.length && !descendantDecorations.length) | 1132 if (!decorations.length && !descendantDecorations.length) |
1132 return; | 1133 return; |
1133 | 1134 |
1134 var colors = new Set(); | 1135 var colors = new Set(); |
1135 var titles = []; | 1136 var titles = []; |
1136 | 1137 |
1137 for (var decoration of decorations) { | 1138 for (var decoration of decorations) { |
1138 titles.push(decoration.title); | 1139 titles.push(decoration.title); |
1139 colors.add(decoration.color); | 1140 colors.add(decoration.color); |
1140 } | 1141 } |
(...skipping 17 matching lines...) Expand all Loading... |
1158 | 1159 |
1159 /** | 1160 /** |
1160 * @param {!Set<string>} colors | 1161 * @param {!Set<string>} colors |
1161 * @param {string} className | 1162 * @param {string} className |
1162 * @this {WebInspector.ElementsTreeElement} | 1163 * @this {WebInspector.ElementsTreeElement} |
1163 */ | 1164 */ |
1164 function processColors(colors, className) | 1165 function processColors(colors, className) |
1165 { | 1166 { |
1166 for (var color of colors) { | 1167 for (var color of colors) { |
1167 var child = this._decorationsElement.createChild("div", clas
sName); | 1168 var child = this._decorationsElement.createChild("div", clas
sName); |
| 1169 this._decorationsElement.classList.remove("hidden"); |
1168 child.style.backgroundColor = color; | 1170 child.style.backgroundColor = color; |
1169 child.style.borderColor = color; | 1171 child.style.borderColor = color; |
1170 if (offset) | 1172 if (offset) |
1171 child.style.marginLeft = offset + "px"; | 1173 child.style.marginLeft = offset + "px"; |
1172 offset += 3; | 1174 offset += 3; |
1173 } | 1175 } |
1174 } | 1176 } |
1175 } | 1177 } |
1176 }, | 1178 }, |
1177 | 1179 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 | 1582 |
1581 if (object) | 1583 if (object) |
1582 object.callFunction(scrollIntoView); | 1584 object.callFunction(scrollIntoView); |
1583 } | 1585 } |
1584 | 1586 |
1585 this._node.resolveToObject("", scrollIntoViewCallback); | 1587 this._node.resolveToObject("", scrollIntoViewCallback); |
1586 }, | 1588 }, |
1587 | 1589 |
1588 __proto__: TreeElement.prototype | 1590 __proto__: TreeElement.prototype |
1589 } | 1591 } |
OLD | NEW |