Changeset 225572 in webkit
- Timestamp:
- Dec 6, 2017 12:51:47 AM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r225571 r225572 1 2017-12-06 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Styles Redesign: display related pseudo-elements 4 https://bugs.webkit.org/show_bug.cgi?id=176187 5 <rdar://problem/34194917> 6 7 Reviewed by Timothy Hatcher. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 11 * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: 12 (WI.SpreadsheetRulesStyleDetailsPanel): 13 (WI.SpreadsheetRulesStyleDetailsPanel.prototype.refresh): 14 (WI.SpreadsheetRulesStyleDetailsPanel.prototype.applyFilter): 15 (WI.SpreadsheetRulesStyleDetailsPanel.prototype._handleSectionFilterApplied): 16 * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.css: 17 (.spreadsheet-style-panel .section-header): 18 (.spreadsheet-style-panel .section-header .node-link): 19 (.spreadsheet-style-panel .section-header .node-link:hover): 20 (.spreadsheet-style-panel .section-inherited): Deleted. 21 (.spreadsheet-style-panel .section-inherited .node-link): Deleted. 22 (.spreadsheet-style-panel .section-inherited .node-link:hover): Deleted. 23 After all of the matched and inherited styles are added, loop over each pseudo-element, get 24 the DOMNodeStyles for each, refresh them if needed, and then add the header and sections. 25 26 * UserInterface/Models/DOMNodeStyles.js: 27 (WI.DOMNodeStyles.prototype.refreshIfNeeded): 28 (WI.DOMNodeStyles.prototype.refresh): 29 Return a reference to the DOMNodeStyles object once the refresh promise is resolved. 30 31 * UserInterface/Models/DOMNode.js: 32 (WI.DOMNode.prototype.get displayName): 33 If the node is a pseudo-element, display the pseudo-type instead of the node name. 34 1 35 2017-12-06 Devin Rousso <webkit@devinrousso.com> 2 36 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r225547 r225572 502 502 localizedStrings["Info: "] = "Info: "; 503 503 localizedStrings["Infos"] = "Infos"; 504 localizedStrings["Inherited From"] = "Inherited From"; 504 505 localizedStrings["Inherited From: "] = "Inherited From: "; 505 506 localizedStrings["Inherited from %s"] = "Inherited from %s"; … … 717 718 localizedStrings["Property"] = "Property"; 718 719 localizedStrings["Protocol"] = "Protocol"; 720 localizedStrings["Pseudo Element"] = "Pseudo Element"; 719 721 localizedStrings["Query Parameters"] = "Query Parameters"; 720 722 localizedStrings["Query String"] = "Query String"; -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
r224648 r225572 637 637 get displayName() 638 638 { 639 if (this.isPseudoElement()) 640 return "::" + this._pseudoType; 639 641 return this.nodeNameInCorrectCase() + this.escapedIdSelector + this.escapedClassSelector; 640 642 } -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
r223308 r225572 64 64 refreshIfNeeded() 65 65 { 66 if (this._pendingRefreshTask) 67 return this._pendingRefreshTask; 66 68 if (!this._needsRefresh) 67 return ;68 this.refresh();69 return Promise.resolve(this); 70 return this.refresh(); 69 71 } 70 72 … … 259 261 .then(() => { 260 262 this._pendingRefreshTask = null; 263 return this; 261 264 }); 262 265 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.css
r221662 r225572 103 103 } 104 104 105 .spreadsheet-style-panel .section- inherited{105 .spreadsheet-style-panel .section-header { 106 106 margin: 0; 107 107 padding: 4px 6px; … … 112 112 } 113 113 114 .spreadsheet-style-panel .section- inherited.node-link {114 .spreadsheet-style-panel .section-header .node-link { 115 115 color: inherit; 116 116 } 117 117 118 .spreadsheet-style-panel .section- inherited.node-link:hover {118 .spreadsheet-style-panel .section-header .node-link:hover { 119 119 color: black; 120 120 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js
r225571 r225572 35 35 this.element.classList.add("spreadsheet-style-panel"); 36 36 37 this._ inheritedHeaderMap = new Map;37 this._headerMap = new Map; 38 38 this._sections = []; 39 39 this._newRuleSelector = null; … … 55 55 return; 56 56 } 57 58 this.removeAllSubviews(); 59 60 let previousStyle = null; 61 this._headerMap.clear(); 62 this._sections = []; 57 63 58 64 let uniqueOrderedStyles = (orderedStyles) => { … … 80 86 }; 81 87 82 let createInheritedHeader = (style) => { 83 let inheritedHeader = document.createElement("h2"); 84 inheritedHeader.classList.add("section-inherited"); 85 inheritedHeader.append(WI.UIString("Inherited From: "), WI.linkifyNodeReference(style.node, { 88 let createHeader = (text, node) => { 89 let header = this.element.appendChild(document.createElement("h2")); 90 header.classList.add("section-header"); 91 header.append(text); 92 header.append(" ", WI.linkifyNodeReference(node, { 86 93 maxLength: 100, 87 94 excludeRevealElement: true, 88 95 })); 89 96 90 this._inheritedHeaderMap.set(style.node, inheritedHeader); 91 92 return inheritedHeader; 97 this._headerMap.set(node, header); 93 98 }; 94 99 95 this.removeAllSubviews(); 96 97 let orderedStyles = uniqueOrderedStyles(this.nodeStyles.orderedStyles); 98 let previousStyle = null; 99 100 this._inheritedHeaderMap.clear(); 101 this._sections = []; 102 103 for (let style of orderedStyles) { 104 if (style.inherited && (!previousStyle || previousStyle.node !== style.node)) 105 this.element.append(createInheritedHeader(style)); 106 107 // FIXME: <https://webkit.org/b/176187> Display matching pseudo-styles 108 // FIXME: <https://webkit.org/b/176289> Display at-rule section headers (@media, @keyframes, etc.) 109 100 let createSection = (style) => { 110 101 let section = style[WI.SpreadsheetRulesStyleDetailsPanel.RuleSection]; 111 102 if (!section) { … … 124 115 125 116 previousStyle = style; 126 } 117 }; 118 119 for (let style of uniqueOrderedStyles(this.nodeStyles.orderedStyles)) { 120 if (style.inherited && (!previousStyle || previousStyle.node !== style.node)) 121 createHeader(WI.UIString("Inherited From"), style.node); 122 123 createSection(style); 124 } 125 126 let pseudoElements = Array.from(this.nodeStyles.node.pseudoElements().values()); 127 Promise.all(pseudoElements.map((pseudoElement) => WI.cssStyleManager.stylesForNode(pseudoElement).refreshIfNeeded())) 128 .then((pseudoNodeStyles) => { 129 for (let pseudoNodeStyle of pseudoNodeStyles) { 130 createHeader(WI.UIString("Pseudo Element"), pseudoNodeStyle.node); 131 132 for (let style of uniqueOrderedStyles(pseudoNodeStyle.orderedStyles)) 133 createSection(style); 134 } 135 }); 127 136 128 137 this._newRuleSelector = null; … … 231 240 this.element.classList.add("filter-non-matching"); 232 241 233 for (let inheritedHeader of this._inheritedHeaderMap.values())234 inheritedHeader.classList.remove(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);242 for (let header of this._headerMap.values()) 243 header.classList.remove(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName); 235 244 236 245 for (let section of this._sections) … … 253 262 if (event.data.matches) 254 263 this.element.classList.remove("filter-non-matching"); 255 else if (event.target.style.inherited){256 let inheritedHeader = this._inheritedHeaderMap.get(event.target.style.node);257 if ( inheritedHeader)258 inheritedHeader.classList.add(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);264 else { 265 let header = this._headerMap.get(event.target.style.node); 266 if (header) 267 header.classList.add(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName); 259 268 } 260 269 }
Note: See TracChangeset
for help on using the changeset viewer.