Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 swatch.setFormat(WebInspector.Color.detectColorFormat(color)); | 142 swatch.setFormat(WebInspector.Color.detectColorFormat(color)); |
| 143 return swatch; | 143 return swatch; |
| 144 }, | 144 }, |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {?WebInspector.ComputedStyleModel.ComputedStyle} nodeStyle | 147 * @param {?WebInspector.ComputedStyleModel.ComputedStyle} nodeStyle |
| 148 * @param {?WebInspector.CSSMatchedStyles} matchedStyles | 148 * @param {?WebInspector.CSSMatchedStyles} matchedStyles |
| 149 */ | 149 */ |
| 150 _innerRebuildUpdate: function(nodeStyle, matchedStyles) | 150 _innerRebuildUpdate: function(nodeStyle, matchedStyles) |
| 151 { | 151 { |
| 152 /** @type {!Set<string>} */ | |
| 153 var expandedProperties = new Set(); | |
| 154 for (var treeElement of this._propertiesOutline.rootElement().children() ) { | |
| 155 if (!treeElement.expanded) | |
| 156 continue; | |
| 157 var propertyName = treeElement[WebInspector.ComputedStyleWidget._pro pertySymbol].name; | |
| 158 expandedProperties.add(propertyName); | |
| 159 } | |
| 152 this._propertiesOutline.removeChildren(); | 160 this._propertiesOutline.removeChildren(); |
| 153 this._linkifier.reset(); | 161 this._linkifier.reset(); |
| 154 var cssModel = this._computedStyleModel.cssModel(); | 162 var cssModel = this._computedStyleModel.cssModel(); |
| 155 if (!nodeStyle || !matchedStyles || !cssModel) | 163 if (!nodeStyle || !matchedStyles || !cssModel) |
| 156 return; | 164 return; |
| 157 | 165 |
| 158 var uniqueProperties = nodeStyle.computedStyle.keysArray(); | 166 var uniqueProperties = nodeStyle.computedStyle.keysArray(); |
| 159 uniqueProperties.sort(propertySorter); | 167 uniqueProperties.sort(propertySorter); |
| 160 | 168 |
| 161 var propertyTraces = this._computePropertyTraces(matchedStyles); | 169 var propertyTraces = this._computePropertyTraces(matchedStyles); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 this._propertiesOutline.appendChild(treeElement); | 214 this._propertiesOutline.appendChild(treeElement); |
| 207 | 215 |
| 208 var trace = propertyTraces.get(propertyName); | 216 var trace = propertyTraces.get(propertyName); |
| 209 if (trace) { | 217 if (trace) { |
| 210 var activeProperty = this._renderPropertyTrace(cssModel, matched Styles, nodeStyle.node, treeElement, trace); | 218 var activeProperty = this._renderPropertyTrace(cssModel, matched Styles, nodeStyle.node, treeElement, trace); |
| 211 treeElement.listItemElement.addEventListener("mousedown", consum eEvent, false); | 219 treeElement.listItemElement.addEventListener("mousedown", consum eEvent, false); |
| 212 treeElement.listItemElement.addEventListener("dblclick", consume Event, false); | 220 treeElement.listItemElement.addEventListener("dblclick", consume Event, false); |
| 213 treeElement.listItemElement.addEventListener("click", handleClic k.bind(null, treeElement), false); | 221 treeElement.listItemElement.addEventListener("click", handleClic k.bind(null, treeElement), false); |
| 214 var gotoSourceElement = propertyValueElement.createChild("div", "goto-source-icon"); | 222 var gotoSourceElement = propertyValueElement.createChild("div", "goto-source-icon"); |
| 215 gotoSourceElement.addEventListener("click", this._navigateToSour ce.bind(this, activeProperty)); | 223 gotoSourceElement.addEventListener("click", this._navigateToSour ce.bind(this, activeProperty)); |
| 224 if (expandedProperties.has(propertyName)) | |
|
dgozman
2016/07/16 01:14:56
Why is this inside "if (trace)" block?
lushnikov
2016/07/16 03:47:48
Only properties with traces are expandable; others
| |
| 225 treeElement.expand(); | |
| 216 } | 226 } |
| 217 } | 227 } |
| 218 | 228 |
| 219 this._updateFilter(this._filterRegex); | 229 this._updateFilter(this._filterRegex); |
| 220 | 230 |
| 221 /** | 231 /** |
| 222 * @param {string} a | 232 * @param {string} a |
| 223 * @param {string} b | 233 * @param {string} b |
| 224 * @return {number} | 234 * @return {number} |
| 225 */ | 235 */ |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 var children = this._propertiesOutline.rootElement().children(); | 359 var children = this._propertiesOutline.rootElement().children(); |
| 350 for (var child of children) { | 360 for (var child of children) { |
| 351 var property = child[WebInspector.ComputedStyleWidget._propertySymbo l]; | 361 var property = child[WebInspector.ComputedStyleWidget._propertySymbo l]; |
| 352 var matched = !regex || regex.test(property.name) || regex.test(prop erty.value); | 362 var matched = !regex || regex.test(property.name) || regex.test(prop erty.value); |
| 353 child.hidden = !matched; | 363 child.hidden = !matched; |
| 354 } | 364 } |
| 355 }, | 365 }, |
| 356 | 366 |
| 357 __proto__: WebInspector.ThrottledWidget.prototype | 367 __proto__: WebInspector.ThrottledWidget.prototype |
| 358 } | 368 } |
| OLD | NEW |