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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1120 (n === node ? decorations : descendantDecorations).push(decoration); | 1120 (n === node ? decorations : descendantDecorations).push(decoration); |
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.classList.toggle("elements-gutter-decoratio n", decorations.length || (descendantDecorations.length && !this.expanded)); | 1130 this._decorationsElement.removeChildren(); |
1131 this._decorationsElement.classList.toggle("elements-has-decorated-ch ildren", descendantDecorations.length && !this.expanded); | 1131 var colors = new Set(); |
1132 var title = decorations.join("\n"); | 1132 var titles = []; |
1133 if (descendantDecorations.length) | 1133 |
1134 title += WebInspector.UIString("\nChildren:\n") + descendantDeco rations.join("\n"); | 1134 if (!decorations.length && !descendantDecorations.length) |
dgozman
2015/08/18 18:35:20
nit: can move this above colors and titles.
pfeldman
2015/08/18 18:40:05
Done.
| |
1135 this._decorationsElement.title = title; | 1135 return; |
1136 | |
1137 for (var decoration of decorations) { | |
1138 titles.push(decoration.title); | |
1139 colors.add(decoration.color); | |
1140 } | |
1141 if (this.expanded && !decorations.length) | |
1142 return; | |
1143 | |
1144 var descendantColors = new Set(); | |
1145 if (descendantDecorations.length) { | |
1146 titles.push(WebInspector.UIString("Children:")); | |
1147 for (var decoration of descendantDecorations) { | |
1148 titles.push(decoration.title); | |
1149 descendantColors.add(decoration.color); | |
1150 } | |
1151 } | |
1152 | |
1153 var offset = 0; | |
1154 processColors.call(this, colors, "elements-gutter-decoration"); | |
1155 if (!this.expanded) | |
1156 processColors.call(this, descendantColors, "elements-gutter-deco ration elements-has-decorated-children"); | |
1157 WebInspector.Tooltip.install(this._decorationsElement, titles.join(" \n")); | |
1158 | |
1159 /** | |
1160 * @param {!Set<string>} colors | |
1161 * @param {string} className | |
1162 * @this {WebInspector.ElementsTreeElement} | |
1163 */ | |
1164 function processColors(colors, className) | |
1165 { | |
1166 for (var color of colors) { | |
dgozman
2015/08/18 18:35:20
Should we limit the number of colors rendered to p
pfeldman
2015/08/18 18:40:05
it is 3 currently :) lets see when it overflows?
| |
1167 var child = this._decorationsElement.createChild("div", clas sName); | |
1168 child.style.backgroundColor = color; | |
1169 child.style.borderColor = color; | |
1170 if (offset) | |
1171 child.style.marginLeft = offset + "px"; | |
dgozman
2015/08/18 18:35:20
Why not put them into a container which handles of
pfeldman
2015/08/18 18:40:05
It is extensible, so I don't really know how many
| |
1172 offset += 3; | |
1173 } | |
1174 } | |
1136 } | 1175 } |
1137 }, | 1176 }, |
1138 | 1177 |
1139 /** | 1178 /** |
1140 * @param {!Node} parentElement | 1179 * @param {!Node} parentElement |
1141 * @param {string} name | 1180 * @param {string} name |
1142 * @param {string} value | 1181 * @param {string} value |
1143 * @param {?WebInspector.ElementsTreeOutline.UpdateRecord} updateRecord | 1182 * @param {?WebInspector.ElementsTreeOutline.UpdateRecord} updateRecord |
1144 * @param {boolean=} forceValue | 1183 * @param {boolean=} forceValue |
1145 * @param {!WebInspector.DOMNode=} node | 1184 * @param {!WebInspector.DOMNode=} node |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1541 | 1580 |
1542 if (object) | 1581 if (object) |
1543 object.callFunction(scrollIntoView); | 1582 object.callFunction(scrollIntoView); |
1544 } | 1583 } |
1545 | 1584 |
1546 this._node.resolveToObject("", scrollIntoViewCallback); | 1585 this._node.resolveToObject("", scrollIntoViewCallback); |
1547 }, | 1586 }, |
1548 | 1587 |
1549 __proto__: TreeElement.prototype | 1588 __proto__: TreeElement.prototype |
1550 } | 1589 } |
OLD | NEW |