WebKit Bugzilla
Attachment 361233 Details for
Bug 194300
: Web Inspector: Elements tab: selection is broken after deleting the selected node
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194300-20190205154358.patch (text/plain), 3.12 KB, created by
Matt Baker
on 2019-02-05 15:43:59 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Matt Baker
Created:
2019-02-05 15:43:59 PST
Size:
3.12 KB
patch
obsolete
>Subversion Revision: 240992 >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index d9f248038f25173c7379fb774c42d1afaf27f9a7..c8a3aa8f0d78fb1d913a1d53179cd6e4569c43f3 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,22 @@ >+2019-02-05 Matt Baker <mattbaker@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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 Nikita Vasilyev <nvasilyev@apple.com> > > Web Inspector: Styles: remove harmless "property was unlocked" asserts >diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >index f783acdabfa6dad37ba01d535b77327775bf853e..1303b9b78469b30fdc461ecaf11719141948a346 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >+++ b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >@@ -1090,26 +1090,25 @@ WI.TreeOutline = class TreeOutline extends WI.Object > if (!treeOutline) > return null; > >- let firstChild = treeElement.children[0]; >- if (treeElement.root && !firstChild) >- return null; >- >- let current = firstChild || treeElement; >- let startIndex = treeOutline._indexOfTreeElement(current); >- let endIndex = startIndex; >- >- const skipUnrevealed = false; >- const stayWithin = treeElement; >- const dontPopulate = true; >- >- while (current = current.traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate)) >- endIndex++; >+ 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 count = endIndex - startIndex + 1; >+ count++; >+ elements.push(...child.children); >+ } >+ return count; >+ } > >+ 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; > } > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194300
:
361217
|
361224
|
361233
|
361235