Changeset 185757 in webkit
- Timestamp:
- Jun 19, 2015, 11:49:19 AM (11 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Localizations/en.lproj/localizedStrings.js (modified) (2 diffs)
-
UserInterface/Views/CSSStyleDeclarationSection.css (modified) (1 diff)
-
UserInterface/Views/CSSStyleDeclarationSection.js (modified) (3 diffs)
-
UserInterface/Views/CSSStyleDeclarationTextEditor.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r185750 r185757 1 2015-06-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Make rule icon toggle all properties for that selector on and off 4 https://bugs.webkit.org/show_bug.cgi?id=146031 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Views/CSSStyleDeclarationSection.css: 9 (.style-declaration-section > .header > .icon.toggle-able:hover): 10 (.style-declaration-section.rule-disabled > .header > .icon): 11 * UserInterface/Views/CSSStyleDeclarationSection.js: 12 (WebInspector.CSSStyleDeclarationSection): Added event listener to selector icon to toggle commenting of all properties for that rule. 13 (WebInspector.CSSStyleDeclarationSection.prototype._toggleRuleOnOff): Adds or removes comments to all properties for that rule. 14 * UserInterface/Views/CSSStyleDeclarationTextEditor.js: 15 (WebInspector.CSSStyleDeclarationTextEditor.prototype.uncommentAllProperties.uncommentProperties): 16 (WebInspector.CSSStyleDeclarationTextEditor.prototype.uncommentAllProperties): Uncomments all properties. 17 (WebInspector.CSSStyleDeclarationTextEditor.prototype.commentAllProperties): Comments out all properties. 18 (WebInspector.CSSStyleDeclarationTextEditor.prototype._propertyCheckboxChanged): Moved comment logic to its own function. 19 (WebInspector.CSSStyleDeclarationTextEditor.prototype._propertyCommentCheckboxChanged): Moved uncomment logic to its own function. 20 1 21 2015-06-19 Jon Lee <jonlee@apple.com> 2 22 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r185723 r185757 108 108 localizedStrings["Collapse columns"] = "Collapse columns"; 109 109 localizedStrings["Comment"] = "Comment"; 110 localizedStrings["Comment All Properties"] = "Comment All Properties"; 110 111 localizedStrings["Compressed"] = "Compressed"; 111 112 localizedStrings["Compression"] = "Compression"; … … 494 495 localizedStrings["Type information for variable: %s"] = "Type information for variable: %s"; 495 496 localizedStrings["Unable to determine path to property from root"] = "Unable to determine path to property from root"; 497 localizedStrings["Uncomment All Properties"] = "Uncomment All Properties"; 496 498 localizedStrings["Unknown node"] = "Unknown node"; 497 499 localizedStrings["Untitled"] = "Untitled"; -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css
r183579 r185757 67 67 width: 16px; 68 68 height: 16px; 69 } 70 71 .style-declaration-section > .header > .icon.toggle-able:hover { 72 -webkit-filter: brightness(0.9); 73 } 74 75 .style-declaration-section.rule-disabled > .header > .icon { 76 opacity: 0.5; 69 77 } 70 78 -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
r185723 r185757 34 34 this._style = style || null; 35 35 this._selectorElements = []; 36 this._ruleDisabled = false; 36 37 37 38 this._element = document.createElement("div"); … … 87 88 iconClassName = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName; 88 89 break; 90 } 91 92 // Matches all situations except for User Agent styles. 93 if (!(style.ownerRule && style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)) { 94 this._iconElement.classList.add("toggle-able"); 95 this._iconElement.title = WebInspector.UIString("Comment All Properties"); 96 this._iconElement.addEventListener("click", this._toggleRuleOnOff.bind(this)); 89 97 } 90 98 … … 377 385 }, 378 386 387 _toggleRuleOnOff: function() 388 { 389 this._ruleDisabled = this._ruleDisabled ? !this._propertiesTextEditor.uncommentAllProperties() : this._propertiesTextEditor.commentAllProperties(); 390 this._iconElement.title = this._ruleDisabled ? WebInspector.UIString("Uncomment All Properties") : WebInspector.UIString("Comment All Properties"); 391 this._element.classList.toggle("rule-disabled", this._ruleDisabled); 392 }, 393 379 394 _commitSelector: function(mutations) 380 395 { -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
r185723 r185757 303 303 } 304 304 305 uncommentAllProperties() 306 { 307 function uncommentProperties(properties) 308 { 309 if (!properties.length) 310 return false; 311 312 for (var property of properties) { 313 if (property._commentRange) { 314 this._uncommentRange(property._commentRange); 315 property._commentRange = null; 316 } 317 } 318 319 return true; 320 } 321 322 return uncommentProperties.call(this, this._style.pendingProperties) || uncommentProperties.call(this, this._style.properties); 323 } 324 325 commentAllProperties() 326 { 327 if (!this._style.properties.length) 328 return false; 329 330 for (var property of this._style.properties) { 331 if (property.__propertyTextMarker) 332 this._commentProperty(property); 333 } 334 335 return true; 336 } 337 305 338 // Protected 306 339 … … 713 746 return; 714 747 748 this._commentProperty(property); 749 } 750 751 _commentProperty(property) 752 { 715 753 var textMarker = property.__propertyTextMarker; 716 754 console.assert(textMarker); … … 724 762 return; 725 763 764 property._commentRange = range; 765 property._commentRange.to.ch += 6; // Number of characters added by comments. 766 726 767 var text = this._codeMirror.getRange(range.from, range.to); 727 768 … … 751 792 return; 752 793 794 this._uncommentRange(range); 795 } 796 797 _uncommentRange(range) 798 { 753 799 var text = this._codeMirror.getRange(range.from, range.to); 754 800
Note:
See TracChangeset
for help on using the changeset viewer.