Changeset 227232 in webkit
- Timestamp:
- Jan 19, 2018 1:36:58 PM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r227228 r227232 1 2018-01-19 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Styles Redesign: tabbing on commented out property throws exception 4 https://bugs.webkit.org/show_bug.cgi?id=180676 5 <rdar://problem/35981058> 6 7 Reviewed by Joseph Pecoraro. 8 9 * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js: 10 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingFirstProperty): 11 Tabbing from the selector field should focus on the first editable property. 12 When no editable properties are present, a new blank property should be added after the commented out ones. 13 14 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingLastProperty): 15 Shift-tabbing from the selector field should focus on the last editable property of the previous CSS rule. 16 When no editable properties are present, a new blank property should be added after the commented out ones. 17 18 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetCSSStyleDeclarationEditorFocusMoved): 19 When navigating between properties skip the commented out ones. 20 21 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyAfter): 22 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyBefore): 23 * UserInterface/Views/SpreadsheetStyleProperty.js: 24 (WI.SpreadsheetStyleProperty.prototype.get enabled): 25 (WI.SpreadsheetStyleProperty.prototype._update): 26 1 27 2018-01-19 Nikita Vasilyev <nvasilyev@apple.com> 2 28 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js
r226994 r227232 102 102 startEditingFirstProperty() 103 103 { 104 if (this._propertyViews.length) 105 this._propertyViews[0].nameTextField.startEditing(); 104 let firstEditableProperty = this._editablePropertyAfter(-1); 105 if (firstEditableProperty) 106 firstEditableProperty.nameTextField.startEditing(); 106 107 else { 107 let index = 0;108 this.addBlankProperty( index);108 const appendAfterLast = -1; 109 this.addBlankProperty(appendAfterLast); 109 110 } 110 111 } … … 112 113 startEditingLastProperty() 113 114 { 114 let last Property = this._propertyViews.lastValue;115 if (last Property)116 last Property.valueTextField.startEditing();115 let lastEditableProperty = this._editablePropertyBefore(this._propertyViews.length); 116 if (lastEditableProperty) 117 lastEditableProperty.valueTextField.startEditing(); 117 118 else { 118 let index = 0;119 this.addBlankProperty( index);119 const appendAfterLast = -1; 120 this.addBlankProperty(appendAfterLast); 120 121 } 121 122 } … … 195 196 196 197 if (direction === "forward") { 197 // Move from the value to the next property's name.198 let index = movedFromIndex + 1;199 if ( index < this._propertyViews.length)200 this._propertyViews[index].nameTextField.startEditing();198 // Move from the value to the next enabled property's name. 199 let propertyView = this._editablePropertyAfter(movedFromIndex); 200 if (propertyView) 201 propertyView.nameTextField.startEditing(); 201 202 else { 202 203 if (willRemoveProperty) { … … 204 205 let reverse = false; 205 206 this._delegate.cssStyleDeclarationEditorStartEditingAdjacentRule(reverse); 206 } else 207 this.addBlankProperty(index); 207 } else { 208 const appendAfterLast = -1; 209 this.addBlankProperty(appendAfterLast); 210 } 208 211 } 209 212 } else { 210 let index = movedFromIndex - 1; 211 if (index < 0) { 213 let propertyView = this._editablePropertyBefore(movedFromIndex); 214 if (propertyView) { 215 // Move from the property's name to the previous enabled property's value. 216 propertyView.valueTextField.startEditing() 217 } else { 212 218 // Move from the first property's name to the rule's selector. 213 219 if (this._style.selectorEditable) 214 220 this._delegate.cssStyleDeclarationTextEditorStartEditingRuleSelector(); 215 } else {216 // Move from the property's name to the previous property's value.217 let valueTextField = this._propertyViews[index].valueTextField;218 if (valueTextField)219 valueTextField.startEditing();220 221 } 221 222 } … … 252 253 253 254 return this._style.allProperties; 255 } 256 257 _editablePropertyAfter(propertyIndex) 258 { 259 for (let index = propertyIndex + 1; index < this._propertyViews.length; index++) { 260 let property = this._propertyViews[index]; 261 if (property.enabled) 262 return property; 263 } 264 265 return null; 266 } 267 268 _editablePropertyBefore(propertyIndex) 269 { 270 for (let index = propertyIndex - 1; index >= 0; index--) { 271 let property = this._propertyViews[index]; 272 if (property.enabled) 273 return property; 274 } 275 276 return null; 254 277 } 255 278 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r226939 r227232 58 58 get nameTextField() { return this._nameTextField; } 59 59 get valueTextField() { return this._valueTextField; } 60 get enabled() { return this._property.enabled; } 60 61 61 62 detached()
Note: See TracChangeset
for help on using the changeset viewer.