Bug 192711

Summary: Web Inspector: REGRESSION (r238602): Elements: deleting the last child of a collapsed parent selects the parent's next sibling
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Matt Baker <mattbaker>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, hi, inspector-bugzilla-changes, mattbaker, rniwa, timothy, webkit-bug-importer
Priority: P3 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
URL: https://devinrousso.com/demo/WebKit/test.html
Bug Depends on:    
Bug Blocks: 197051    
Attachments:
Description Flags
WIP
none
WIP
none
Archive of layout-test-results from ews103 for mac-highsierra
none
Archive of layout-test-results from ews105 for mac-highsierra-wk2
none
Archive of layout-test-results from ews114 for mac-highsierra
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Devin Rousso
Reported 2018-12-14 12:52:39 PST
# STEPS TO REPRODUCE: 1. open WebInspector 2. go to the Elements tab 3. select the last child of the <section> 4. collapse the <section> (make sure to not change the selection when collapsing) 5. press ⌫ to delete any selected elements => the next sibling of the <section> becomes selected, instead of the deleted child's previous sibling Another thing of note is that if the same steps are repeated except for (4), the closing tag of the parent is briefly selected before the selection changes to be the deleted child's previous sibling
Attachments
WIP (2.95 KB, patch)
2019-03-28 13:21 PDT, Matt Baker
no flags
WIP (3.97 KB, patch)
2019-03-28 14:11 PDT, Matt Baker
no flags
Archive of layout-test-results from ews103 for mac-highsierra (2.60 MB, application/zip)
2019-03-28 14:50 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (3.01 MB, application/zip)
2019-03-28 15:04 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews114 for mac-highsierra (2.56 MB, application/zip)
2019-03-28 15:55 PDT, EWS Watchlist
no flags
Patch (11.65 KB, patch)
2019-03-28 18:25 PDT, Matt Baker
no flags
Patch (12.25 KB, patch)
2019-03-28 18:51 PDT, Matt Baker
no flags
Patch (12.74 KB, patch)
2019-03-29 17:39 PDT, Matt Baker
no flags
Patch (14.33 KB, patch)
2019-04-01 11:08 PDT, Matt Baker
no flags
Patch (14.63 KB, patch)
2019-04-10 15:09 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2018-12-14 12:53:25 PST
Matt Baker
Comment 2 2019-03-28 13:21:02 PDT
Matt Baker
Comment 3 2019-03-28 13:24:50 PDT
Need to add special-case handling for TreeOutline, so that both sibling axes are searched before going up the parent chain.
Matt Baker
Comment 4 2019-03-28 14:11:15 PDT
EWS Watchlist
Comment 5 2019-03-28 14:50:45 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 6 2019-03-28 14:50:47 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 7 2019-03-28 15:04:30 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 8 2019-03-28 15:04:32 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 9 2019-03-28 15:55:22 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 10 2019-03-28 15:55:24 PDT Comment hidden (obsolete)
Matt Baker
Comment 11 2019-03-28 18:25:10 PDT
Matt Baker
Comment 12 2019-03-28 18:51:34 PDT
Matt Baker
Comment 13 2019-03-28 18:52:37 PDT
(In reply to Matt Baker from comment #12) > Created attachment 366232 [details] > Patch After a delete, the new selected TreeElement is revealed.
Devin Rousso
Comment 14 2019-03-29 13:46:20 PDT
Comment on attachment 366232 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366232&action=review > Source/WebInspectorUI/ChangeLog:19 > + When a hidden node is selected, its selection area is drawn with a height > + of 0px. The selection area needs to be updated once the hidden node's > + parent is expanded. AFAIK, this has always been broken. So technically, this is a "drive-by"? If so, please add that before the comment for clarity. > Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js:323 > + if (this.selectedTreeElement) > + this.selectedTreeElement.reveal(); Should we be iterating over `this.selectedTreeElements` and calling `reveal()` on each instead? If not, are we assuming that there will only ever be one selected item after any deletion? If so, please add a `console.assert`. > Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:840 > - const skipUnrevealed = true; > + const skipUnrevealed = false; Why was this change made? > Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:845 > + // to check siblings along the opposite axis, if they exist. "opposite axis" is a weird phrase. I'd use "other direction" (assuming that I understand your meaning). > Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:846 > + if (!treeElement.previousSibling && treeElement.nextSibling) Should we limit the `previousSibling`/`nextSibling` to be only ones that are visible? If we have a hidden (or non-`selectable`) `TreeElement` before/after the given `item`, I don't think we should count that as being "valid".
Matt Baker
Comment 15 2019-03-29 17:39:57 PDT
Matt Baker
Comment 16 2019-03-29 17:40:44 PDT
Comment on attachment 366333 [details] Patch Clearing r?; need to make one more change.
Matt Baker
Comment 17 2019-03-29 18:53:28 PDT
I just noticed the change to TreeOutline.prototype.selectionControllerPreviousSelectableItem breaks up-arrow key traversal up the parent chain. DOMTreeOutline could override selectionControllerPreviousSelectableItem. The overridden version could check whether this._treeElementsToRemove exists, and if it does, perform the additional check in the opposite sibling direction.
Matt Baker
Comment 18 2019-04-01 11:08:35 PDT
Devin Rousso
Comment 19 2019-04-10 15:09:58 PDT
WebKit Commit Bot
Comment 20 2019-04-10 15:44:55 PDT
Comment on attachment 367168 [details] Patch Clearing flags on attachment: 367168 Committed r244155: <https://trac.webkit.org/changeset/244155>
WebKit Commit Bot
Comment 21 2019-04-10 15:44:57 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.