Changeset 228072 in webkit
- Timestamp:
- Feb 4, 2018 9:30:42 PM (6 years ago)
- Location:
- branches/safari-605-branch/Source/WebInspectorUI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-605-branch/Source/WebInspectorUI/ChangeLog
r227822 r228072 1 2018-02-04 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r228030. rdar://problem/37220121 4 5 2018-02-02 Devin Rousso <webkit@devinrousso.com> 6 7 Web Inspector: Styles Redesign: Pasting multiple properties should create properties instead of a bad property 8 https://bugs.webkit.org/show_bug.cgi?id=179622 9 <rdar://problem/35511170> 10 11 Reviewed by Matt Baker. 12 13 * UserInterface/Views/SpreadsheetStyleProperty.js: 14 (WI.SpreadsheetStyleProperty.prototype._remove): 15 (WI.SpreadsheetStyleProperty.prototype._update): 16 (WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidCommit): 17 (WI.SpreadsheetStyleProperty.prototype._handleNamePaste): 18 When the user pastes into the name field, parse the text for a list of name-value pairs and 19 replace the property being edited with the text of those pairs. 20 21 * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js: 22 (WI.SpreadsheetCSSStyleDeclarationEditor): 23 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout): 24 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.addBlankProperty): 25 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyFocusMoved): 26 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyAddBlankPropertySoon): 27 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyRemoved): 28 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._propertiesChanged): 29 (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetCSSStyleDeclarationEditorFocusMoved): Deleted. 30 Calling `addBlankProperty` will trigger a layout on the next frame, but that might be before 31 the CSSAgent has had a chance to finish refreshing, so we need a way to defer the creation 32 of a new property until after we have finished the next layout (which is after the refresh). 33 Drive-by: fix naming of some delegate functions. 34 35 * UserInterface/Models/CSSProperty.js: 36 (WI.CSSProperty.prototype.replaceWithText): 37 Provide a way for replacing the property with new text. 38 1 39 2018-01-30 Jason Marcell <jmarcell@apple.com> 2 40 -
branches/safari-605-branch/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js
r227402 r228072 132 132 } 133 133 134 replaceWithText(text) 135 { 136 this._updateOwnerStyleText(this._text, text, true); 137 } 138 134 139 commentOut(disabled) 135 140 { -
branches/safari-605-branch/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js
r227661 r228072 40 40 41 41 this._propertyPendingStartEditing = null; 42 this._pendingAddBlankPropertyIndexOffset = NaN; 42 43 this._filterText = null; 43 44 } … … 91 92 if (this._filterText) 92 93 this.applyFilter(this._filterText); 94 95 if (!isNaN(this._pendingAddBlankPropertyIndexOffset)) 96 this.addBlankProperty(this._propertyViews.length - 1 - this._pendingAddBlankPropertyIndexOffset); 93 97 } 94 98 … … 205 209 addBlankProperty(index) 206 210 { 211 this._pendingAddBlankPropertyIndexOffset = NaN; 212 207 213 if (index === -1) { 208 214 // Append to the end. … … 214 220 } 215 221 216 spreadsheet CSSStyleDeclarationEditorFocusMoved({direction, movedFromProperty, willRemoveProperty})217 { 218 let movedFromIndex = this._propertyViews.indexOf( movedFromProperty);222 spreadsheetStylePropertyFocusMoved(propertyView, {direction, willRemoveProperty}) 223 { 224 let movedFromIndex = this._propertyViews.indexOf(propertyView); 219 225 console.assert(movedFromIndex !== -1, "Property doesn't exist, focusing on a selector as a fallback."); 220 226 if (movedFromIndex === -1) { … … 255 261 // SpreadsheetStyleProperty delegate 256 262 263 spreadsheetStylePropertyAddBlankPropertySoon(propertyView, {index}) 264 { 265 if (isNaN(index)) 266 index = this._propertyViews.length; 267 this._pendingAddBlankPropertyIndexOffset = this._propertyViews.length - index; 268 } 269 257 270 spreadsheetStylePropertyRemoved(propertyView) 258 271 { … … 261 274 for (let index = 0; index < this._propertyViews.length; index++) 262 275 this._propertyViews[index].index = index; 276 277 this._focused = false; 263 278 } 264 279 … … 323 338 _propertiesChanged(event) 324 339 { 325 if (this.editing ) {340 if (this.editing && isNaN(this._pendingAddBlankPropertyIndexOffset)) { 326 341 for (let propertyView of this._propertyViews) 327 342 propertyView.updateStatus(); -
branches/safari-605-branch/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r227661 r228072 149 149 // Private 150 150 151 _remove( )151 _remove(replacement = "") 152 152 { 153 153 this.element.remove(); 154 this._property.remove(); 154 155 if (replacement) 156 this._property.replaceWithText(replacement); 157 else 158 this._property.remove(); 159 155 160 this.detached(); 156 161 … … 195 200 this._nameElement.tabIndex = 0; 196 201 this._nameElement.addEventListener("beforeinput", this._handleNameBeforeInput.bind(this)); 202 this._nameElement.addEventListener("paste", this._handleNamePaste.bind(this)); 197 203 198 204 this._nameTextField = new WI.SpreadsheetTextField(this, this._nameElement, this._nameCompletionDataProvider.bind(this)); … … 263 269 } 264 270 265 if (typeof this._delegate.spreadsheet CSSStyleDeclarationEditorFocusMoved === "function") {271 if (typeof this._delegate.spreadsheetStylePropertyFocusMoved === "function") { 266 272 // Move focus away from the current property, to the next or previous one, if exists, or to the next or previous rule, if exists. 267 this._delegate.spreadsheet CSSStyleDeclarationEditorFocusMoved({direction, willRemoveProperty, movedFromProperty: this});273 this._delegate.spreadsheetStylePropertyFocusMoved(this, {direction, willRemoveProperty}); 268 274 } 269 275 … … 560 566 } 561 567 568 _handleNamePaste(event) 569 { 570 let text = event.clipboardData.getData("text/plain"); 571 if (!text || !text.includes(":")) 572 return; 573 574 event.preventDefault(); 575 576 this._remove(text); 577 578 if (this._delegate.spreadsheetStylePropertyAddBlankPropertySoon) { 579 this._delegate.spreadsheetStylePropertyAddBlankPropertySoon(this, { 580 index: parseInt(this._element.dataset.propertyIndex) + 1, 581 }); 582 } 583 } 584 562 585 _nameCompletionDataProvider(prefix) 563 586 {
Note: See TracChangeset
for help on using the changeset viewer.