Changeset 239870 in webkit
- Timestamp:
- Jan 11, 2019 1:02:28 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r239858 r239870 1 2019-01-11 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: REGRESSION: deleting an audit puts selection in a selected but invisible state 4 https://bugs.webkit.org/show_bug.cgi?id=192917 5 <rdar://problem/46875285> 6 7 Reviewed by Devin Rousso. 8 9 SelectionController should not be notified of removed children until the 10 child items have been removed from the TreeOutline. Doing so at this stage 11 is unsafe, since this method checks `this.selectedTreeElement`, which could 12 return the adjusted index from the SelectionController before anything has 13 actually been removed from the TreeOutline. 14 15 The number of calls to SelectionController.prototype.didRemoveItems is also 16 reduced somewhat, since we're no longer calling it for every TreeElement. 17 18 * UserInterface/Views/TreeOutline.js: 19 (WI.TreeOutline.prototype.removeChildAtIndex): 20 (WI.TreeOutline.prototype.removeChildren): 21 (WI.TreeOutline.prototype._forgetTreeElement): 22 (WI.TreeOutline.prototype._indexesForSubtree): Added. 23 1 24 2019-01-10 Devin Rousso <drousso@apple.com> 2 25 -
trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
r239405 r239870 330 330 } 331 331 332 let removedIndexes = this._indexesForSubtree(child); 333 332 334 if (child.previousSibling) 333 335 child.previousSibling.nextSibling = child.nextSibling; … … 343 345 child.previousSibling = null; 344 346 345 if (treeOutline) 347 if (treeOutline) { 348 treeOutline._selectionController.didRemoveItems(removedIndexes); 346 349 treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child}); 350 } 347 351 } 348 352 … … 379 383 } 380 384 385 let removedIndexes = treeOutline._indexesForSubtree(child); 386 381 387 child._detach(); 382 388 child.treeOutline = null; … … 385 391 child.previousSibling = null; 386 392 387 if (treeOutline) 393 this.children.shift(); 394 395 if (treeOutline) { 396 treeOutline._selectionController.didRemoveItems(removedIndexes); 388 397 treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child}); 389 390 this.children.shift(); 398 } 391 399 } 392 400 } … … 420 428 } 421 429 if (this._knownTreeElements[element.identifier]) { 422 let index = this._indexOfTreeElement(element);423 if (index >= 0)424 this._selectionController.didRemoveItems(new WI.IndexSet([index]));425 426 430 this._knownTreeElements[element.identifier].remove(element, true); 427 431 this._cachedNumberOfDescendents--; … … 1073 1077 this.dispatchEventToListeners(WI.TreeOutline.Event.SelectionDidChange, {selectedByUser}); 1074 1078 } 1079 1080 _indexesForSubtree(treeElement) 1081 { 1082 let treeOutline = treeElement.treeOutline; 1083 if (!treeOutline) 1084 return new WI.IndexSet; 1085 1086 let firstChild = treeElement.children[0]; 1087 if (!firstChild) 1088 return new WI.IndexSet; 1089 1090 let startIndex = treeOutline._indexOfTreeElement(firstChild); 1091 let endIndex = startIndex; 1092 1093 const skipUnrevealed = false; 1094 const stayWithin = treeElement; 1095 const dontPopulate = true; 1096 1097 let current = firstChild; 1098 while (current = current.traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate)) 1099 endIndex++; 1100 1101 // Include the index of the subtree's root, unless it's the TreeOutline root. 1102 if (!treeElement.root) 1103 startIndex--; 1104 1105 let count = endIndex - startIndex + 1; 1106 1107 let indexes = new WI.IndexSet; 1108 indexes.addRange(startIndex, count); 1109 1110 return indexes; 1111 } 1075 1112 }; 1076 1113
Note: See TracChangeset
for help on using the changeset viewer.