Title: [241003] trunk/Source/WebInspectorUI
- Revision
- 241003
- Author
- [email protected]
- Date
- 2019-02-05 16:55:28 -0800 (Tue, 05 Feb 2019)
Log Message
Web Inspector: Elements tab: selection is broken after deleting the selected node
https://bugs.webkit.org/show_bug.cgi?id=194300
<rdar://problem/47829275>
Reviewed by Devin Rousso.
Deleting a TreeElement can cause an IndexSet including indexes
outside the deleted range to be passed to SelectionController,
corrupting the internal selection state.
* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype._indexesForSubtree.numberOfElementsInSubtree): Added.
(WI.TreeOutline.prototype._indexesForSubtree):
Finding the last (rightmost leaf) TreeElement in the subtree used
TreeElement.prototype.traverseNextElement to do a depth first traversal.
This method did not stay within the subtree rooted at `treeElement`.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (241002 => 241003)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-02-06 00:49:48 UTC (rev 241002)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-02-06 00:55:28 UTC (rev 241003)
@@ -1,5 +1,24 @@
2019-02-05 Matt Baker <[email protected]>
+ Web Inspector: Elements tab: selection is broken after deleting the selected node
+ https://bugs.webkit.org/show_bug.cgi?id=194300
+ <rdar://problem/47829275>
+
+ Reviewed by Devin Rousso.
+
+ Deleting a TreeElement can cause an IndexSet including indexes
+ outside the deleted range to be passed to SelectionController,
+ corrupting the internal selection state.
+
+ * UserInterface/Views/TreeOutline.js:
+ (WI.TreeOutline.prototype._indexesForSubtree.numberOfElementsInSubtree): Added.
+ (WI.TreeOutline.prototype._indexesForSubtree):
+ Finding the last (rightmost leaf) TreeElement in the subtree used
+ TreeElement.prototype.traverseNextElement to do a depth first traversal.
+ This method did not stay within the subtree rooted at `treeElement`.
+
+2019-02-05 Matt Baker <[email protected]>
+
Web Inspector: REGRESSION (r240947): Resources tab: can't select main frame after refreshing page
https://bugs.webkit.org/show_bug.cgi?id=194254
<rdar://problem/47805023>
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (241002 => 241003)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js 2019-02-06 00:49:48 UTC (rev 241002)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js 2019-02-06 00:55:28 UTC (rev 241003)
@@ -1089,26 +1089,25 @@
if (!treeOutline)
return null;
- let firstChild = treeElement.children[0];
- if (treeElement.root && !firstChild)
- return null;
+ function numberOfElementsInSubtree(treeElement) {
+ let elements = treeElement.root ? Array.from(treeElement.children) : [treeElement];
+ let count = 0;
+ while (elements.length) {
+ let child = elements.pop();
+ if (child.hidden)
+ continue;
- let current = firstChild || treeElement;
- let startIndex = treeOutline._indexOfTreeElement(current);
- let endIndex = startIndex;
+ count++;
+ elements = elements.concat(child.children);
+ }
+ return count;
+ }
- const skipUnrevealed = false;
- const stayWithin = treeElement;
- const dontPopulate = true;
-
- while (current = current.traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate))
- endIndex++;
-
- let count = endIndex - startIndex + 1;
-
+ let firstChild = treeElement.root ? treeElement.children[0] : treeElement;
+ let startIndex = treeOutline._indexOfTreeElement(firstChild);
+ let count = numberOfElementsInSubtree(treeElement);
let indexes = new WI.IndexSet;
indexes.addRange(startIndex, count);
-
return indexes;
}
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes