Changeset 186717 in webkit
- Timestamp:
- Jul 11, 2015 3:29:55 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r186708 r186717 1 2015-07-11 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Improve runtime of pseudo-element sidebar style ordering 4 https://bugs.webkit.org/show_bug.cgi?id=146866 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Models/CSSRule.js: 9 (WebInspector.CSSRule.prototype.update): Determines the most specific selector and saves it to a variable. 10 (WebInspector.CSSRule.prototype.get mostSpecificSelector): Returns the most specific selector. 11 (WebInspector.CSSRule.prototype.selectorIsGreater): Compares the most specific selector to a given selector. 12 (WebInspector.CSSRule.prototype._determineMostSpecificSelector): 13 Searches through the selector list to find and return the selector that is the most specific. 14 (WebInspector.CSSRule): 15 * UserInterface/Views/RulesStyleDetailsPanel.js: 16 (WebInspector.RulesStyleDetailsPanel.prototype.refresh): 17 1 18 2015-07-11 Devin Rousso <drousso@apple.com> 2 19 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js
r186635 r186717 81 81 this._selectors = selectors; 82 82 this._matchedSelectorIndices = matchedSelectorIndices; 83 this._mostSpecificSelector = null; 83 84 this._style = style; 84 85 this._mediaList = mediaList; … … 183 184 } 184 185 185 selectorIsGreater(otherSelectors) 186 { 187 if (!otherSelectors || !otherSelectors.length) 188 return true; 189 190 var selectorIsGreater = true; 186 get mostSpecificSelector() 187 { 188 if (!this._mostSpecificSelector) 189 this._mostSpecificSelector = this._determineMostSpecificSelector(); 190 191 return this._mostSpecificSelector; 192 } 193 194 selectorIsGreater(otherSelector) 195 { 196 var mostSpecificSelector = this.mostSpecificSelector; 197 198 if (!mostSpecificSelector) 199 return false; 200 201 return mostSpecificSelector.isGreaterThan(otherSelector); 202 } 203 204 // Protected 205 206 get nodeStyles() 207 { 208 return this._nodeStyles; 209 } 210 211 // Private 212 213 _determineMostSpecificSelector() 214 { 215 if (!this._selectors || !this._selectors.length) 216 return null; 191 217 192 218 var selectors = this.matchedSelectors; 219 193 220 if (!selectors.length) 194 221 selectors = this._selectors; 195 222 223 var specificSelector = selectors[0]; 224 196 225 for (var selector of selectors) { 197 for (var otherSelector of otherSelectors) { 198 if (selector.isGreaterThan(otherSelector)) 199 continue; 200 201 selectorIsGreater = false; 202 } 203 204 if (selectorIsGreater) 205 return true; 206 } 207 208 return false; 209 } 210 211 // Protected 212 213 get nodeStyles() 214 { 215 return this._nodeStyles; 226 if (selector.isGreaterThan(specificSelector)) 227 specificSelector = selector; 228 } 229 230 return specificSelector; 216 231 } 217 232 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js
r186635 r186717 280 280 } 281 281 282 if (matchedSelectorText.includes(pseudoElement.selectorText) || !ownerRule.selectorIsGreater(pseudoElement.style.ownerRule. selectors))282 if (matchedSelectorText.includes(pseudoElement.selectorText) || !ownerRule.selectorIsGreater(pseudoElement.style.ownerRule.mostSpecificSelector)) 283 283 pseudoElement.lastMatchingSelector = matchedSelectorText; 284 284 }
Note: See TracChangeset
for help on using the changeset viewer.