Changeset 223970 in webkit
- Timestamp:
- Oct 25, 2017 12:02:28 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r223952 r223970 1 2017-10-25 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Styles Redesign: Newly added invalid property isn't immediately shown as invalid 4 https://bugs.webkit.org/show_bug.cgi?id=178488 5 6 Reviewed by Brian Burg. 7 8 * UserInterface/Models/CSSStyleDeclaration.js: 9 (WI.CSSStyleDeclaration.prototype.newBlankProperty): 10 Call this.update to update _properties, _allProperties, _visibleProperties, and _allVisibleProperties. 11 12 * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css: 13 (.spreadsheet-style-declaration-editor .property:matches(.invalid-name, .other-vendor, .overridden):not(.disabled)): 14 (.spreadsheet-style-declaration-editor .property.invalid-name:not(.disabled)): 15 (.spreadsheet-style-declaration-editor .property.invalid-value:not(.disabled) .value): 16 When the property name is valid, but the value isn't, display red line-through only for the value. 17 This is how it works in the old styles sidebar as well. 18 19 * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js: 20 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._propertiesChanged): 21 (WI.SpreadsheetCSSStyleDeclarationEditor): 22 * UserInterface/Views/SpreadsheetStyleProperty.js: 23 (WI.SpreadsheetStyleProperty): 24 (WI.SpreadsheetStyleProperty.prototype.updateClassNames): 25 (WI.SpreadsheetStyleProperty.prototype._update): 26 Introduce updateClassNames method. Unlike _update, it doesn't change text selection or focus and 27 can be safely called on a property while it's being edited. 28 1 29 2017-10-25 Devin Rousso <webkit@devinrousso.com> 2 30 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
r222959 r223970 362 362 let text, name, value, priority, overridden, implicit, anonymous; 363 363 let enabled = true; 364 let valid = true;364 let valid = false; 365 365 let styleSheetTextRange = this._rangeAfterPropertyAtIndex(insertAfterIndex); 366 let property = new WI.CSSProperty(insertAfterIndex + 1, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange); 367 property.ownerStyle = this; 366 367 let propertyIndex = insertAfterIndex + 1; 368 let property = new WI.CSSProperty(propertyIndex, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange); 369 370 this._allProperties.insertAtIndex(property, propertyIndex); 371 const suppressEvents = true; 372 this.update(this._text, this._allProperties, this._styleSheetTextRange, suppressEvents); 368 373 369 374 return property; -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css
r223575 r223970 76 76 } 77 77 78 .spreadsheet-style-declaration-editor .property:matches(.invalid , .other-vendor, .overridden):not(.disabled) {78 .spreadsheet-style-declaration-editor .property:matches(.invalid-name, .other-vendor, .overridden):not(.disabled) { 79 79 text-decoration: line-through; 80 80 -webkit-text-decoration-color: hsla(0, 0%, 0%, 0.6); 81 81 } 82 82 83 .spreadsheet-style-declaration-editor .property.invalid:not(.disabled) { 84 -webkit-text-decoration-color: hsla(0, 100%, 50%, 0.6); 83 .spreadsheet-style-declaration-editor .property.invalid-name:not(.disabled) { 84 -webkit-text-decoration-color: hsla(0, 100%, 50%, 0.5); 85 } 86 87 .spreadsheet-style-declaration-editor .property.invalid-value:not(.disabled) .value { 88 text-decoration: line-through; 89 -webkit-text-decoration-color: hsla(0, 100%, 50%, 0.5); 85 90 } 86 91 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js
r223333 r223970 222 222 _propertiesChanged(event) 223 223 { 224 if (!this._isFocused()) 224 if (this._isFocused()) { 225 for (let propertyView of this._propertyViews) 226 propertyView.updateClassNames(); 227 } else 225 228 this.needsLayout(); 226 229 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r223867 r223970 47 47 this._update(); 48 48 property.addEventListener(WI.CSSProperty.Event.OverriddenStatusChanged, this._update, this); 49 property.addEventListener(WI.CSSProperty.Event.Changed, this.updateClassNames, this); 49 50 } 50 51 … … 71 72 } 72 73 73 // Private 74 75 _remove() 76 { 77 this.element.remove(); 78 this._property.remove(); 79 this.detached(); 80 81 if (this._delegate && typeof this._delegate.spreadsheetStylePropertyRemoved === "function") 82 this._delegate.spreadsheetStylePropertyRemoved(this); 83 } 84 85 _update() 86 { 87 this.element.removeChildren(); 88 this.element.className = ""; 89 74 updateClassNames() 75 { 90 76 let duplicatePropertyExistsBelow = (cssProperty) => { 91 77 let propertyFound = false; … … 114 100 if (!this._property.valid && this._property.hasOtherVendorNameOrKeyword()) 115 101 classNames.push("other-vendor"); 116 else if (!this._property.valid ) {102 else if (!this._property.valid && this._property.value !== "") { 117 103 let propertyNameIsValid = false; 118 104 if (WI.CSSCompletions.cssNameCompletions) … … 120 106 121 107 if (!propertyNameIsValid || duplicatePropertyExistsBelow(this._property)) 122 classNames.push("invalid"); 108 classNames.push("invalid-name"); 109 else 110 classNames.push("invalid-value"); 123 111 } 124 112 … … 126 114 classNames.push("disabled"); 127 115 128 this._element.classList.add(...classNames); 116 this._element.className = classNames.join(" "); 117 } 118 119 // Private 120 121 _remove() 122 { 123 this.element.remove(); 124 this._property.remove(); 125 this.detached(); 126 127 if (this._delegate && typeof this._delegate.spreadsheetStylePropertyRemoved === "function") 128 this._delegate.spreadsheetStylePropertyRemoved(this); 129 } 130 131 _update() 132 { 133 this.element.removeChildren(); 134 this.updateClassNames(); 129 135 130 136 if (this._property.editable) {
Note: See TracChangeset
for help on using the changeset viewer.