OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!WebInspector.SectionCascade} cascade | 7 * @param {!WebInspector.SectionCascade} cascade |
8 * @param {?WebInspector.CSSRule} rule | 8 * @param {?WebInspector.CSSRule} rule |
9 * @param {!WebInspector.CSSStyleDeclaration} style | 9 * @param {!WebInspector.CSSStyleDeclaration} style |
10 * @param {string} customSelectorText | 10 * @param {string} customSelectorText |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 style.parentRule = this._rule; | 153 style.parentRule = this._rule; |
154 this._rule.style = style; | 154 this._rule.style = style; |
155 } | 155 } |
156 this._cascade._resetUsedProperties(); | 156 this._cascade._resetUsedProperties(); |
157 }, | 157 }, |
158 | 158 |
159 /** | 159 /** |
160 * @param {string} propertyName | 160 * @param {string} propertyName |
161 * @return {boolean} | 161 * @return {boolean} |
162 */ | 162 */ |
| 163 isPropertyInCascade: function(propertyName) |
| 164 { |
| 165 if (!this.hasMatchingSelectors()) |
| 166 return false; |
| 167 if (this.inherited() && !WebInspector.CSSMetadata.isPropertyInherited(pr
opertyName)) |
| 168 return false; |
| 169 return true; |
| 170 }, |
| 171 |
| 172 /** |
| 173 * @param {string} propertyName |
| 174 * @return {boolean} |
| 175 */ |
163 isPropertyOverloaded: function(propertyName) | 176 isPropertyOverloaded: function(propertyName) |
164 { | 177 { |
165 if (!this.hasMatchingSelectors()) | 178 if (!this.isPropertyInCascade(propertyName)) |
166 return false; | 179 return false; |
167 if (this.inherited() && !WebInspector.CSSMetadata.isPropertyInherited(pr
opertyName)) | |
168 return false; | |
169 | |
170 var usedProperties = this._cascade._usedPropertiesForModel(this); | 180 var usedProperties = this._cascade._usedPropertiesForModel(this); |
171 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope
rtyName); | 181 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope
rtyName); |
172 return !usedProperties.has(canonicalName); | 182 return !usedProperties.has(canonicalName); |
173 } | 183 } |
174 } | 184 } |
175 | 185 |
176 /** | 186 /** |
177 * @constructor | 187 * @constructor |
178 */ | 188 */ |
179 WebInspector.SectionCascade = function() | 189 WebInspector.SectionCascade = function() |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 notUsed = notUsed && !styleRuleUsedProperties.has(longhandCanoni
calName); | 360 notUsed = notUsed && !styleRuleUsedProperties.has(longhandCanoni
calName); |
351 } | 361 } |
352 if (!notUsed) | 362 if (!notUsed) |
353 continue; | 363 continue; |
354 styleRuleUsedProperties.delete(canonicalName); | 364 styleRuleUsedProperties.delete(canonicalName); |
355 allUsedProperties.delete(canonicalName); | 365 allUsedProperties.delete(canonicalName); |
356 } | 366 } |
357 } | 367 } |
358 return stylesUsedProperties; | 368 return stylesUsedProperties; |
359 } | 369 } |
OLD | NEW |