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.CSSStyleModel.MatchedStyleResult} matchedStyles | 7 * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} matchedStyles |
8 * @param {!Array<!WebInspector.CSSStyleDeclaration>} styles | 8 * @param {!Array<!WebInspector.CSSStyleDeclaration>} styles |
9 */ | 9 */ |
10 WebInspector.SectionCascade = function(matchedStyles, styles) | 10 WebInspector.SectionCascade = function(matchedStyles, styles) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 /** | 82 /** |
83 * @return {!Array.<!WebInspector.CSSStyleDeclaration>} | 83 * @return {!Array.<!WebInspector.CSSStyleDeclaration>} |
84 */ | 84 */ |
85 styles: function() | 85 styles: function() |
86 { | 86 { |
87 return this._styles; | 87 return this._styles; |
88 }, | 88 }, |
89 | 89 |
90 /** | 90 /** |
91 * @param {!WebInspector.CSSStyleDeclaration} style | |
92 * @param {!WebInspector.CSSStyleDeclaration=} insertAfter | |
93 */ | |
94 insertStyle: function(style, insertAfter) | |
95 { | |
96 if (insertAfter) { | |
97 var index = this._styles.indexOf(insertAfter); | |
98 console.assert(index !== -1, "The insertAfter anchor could not be fo
und in cascade"); | |
99 this._styles.splice(index + 1, 0, style); | |
100 } else { | |
101 this._styles.push(style); | |
102 } | |
103 this.resetActiveProperties(); | |
104 }, | |
105 | |
106 /** | |
107 * @param {!WebInspector.CSSProperty} property | 91 * @param {!WebInspector.CSSProperty} property |
108 * @return {?WebInspector.SectionCascade.PropertyState} | 92 * @return {?WebInspector.SectionCascade.PropertyState} |
109 */ | 93 */ |
110 propertyState: function(property) | 94 propertyState: function(property) |
111 { | 95 { |
112 if (this._propertiesState.size === 0) | 96 if (this._propertiesState.size === 0) |
113 this._propertiesState = this._computeActiveProperties(); | 97 this._propertiesState = this._computeActiveProperties(); |
114 return this._propertiesState.get(property) || null; | 98 return this._propertiesState.get(property) || null; |
115 }, | 99 }, |
116 | 100 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 197 } |
214 return result; | 198 return result; |
215 } | 199 } |
216 } | 200 } |
217 | 201 |
218 /** @enum {string} */ | 202 /** @enum {string} */ |
219 WebInspector.SectionCascade.PropertyState = { | 203 WebInspector.SectionCascade.PropertyState = { |
220 Active: "Active", | 204 Active: "Active", |
221 Overloaded: "Overloaded" | 205 Overloaded: "Overloaded" |
222 } | 206 } |
OLD | NEW |