Bug 177690 - Web Inspector: Layers tab sidebar's DOM highlight should be by row hover, not row selection
Summary: Web Inspector: Layers tab sidebar's DOM highlight should be by row hover, not...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 174176
  Show dependency treegraph
 
Reported: 2017-09-29 16:28 PDT by Ross Kirsling
Modified: 2017-10-03 12:22 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.47 KB, patch)
2017-09-29 16:31 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch (4.58 KB, patch)
2017-09-29 18:29 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch (4.66 KB, patch)
2017-10-02 16:45 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2017-09-29 16:28:42 PDT
(Follow-up to https://webkit.org/b/177477.)

The Layers sidebar does DOM highlighting when a DataGridNode is selected (and the DataGrid is focused), but this is like nowhere else in Web Inspector.

For consistency, we should highlight on *hover*.
Comment 1 Ross Kirsling 2017-09-29 16:31:54 PDT
Created attachment 322252 [details]
Patch
Comment 2 Devin Rousso 2017-09-29 17:03:39 PDT
Comment on attachment 322252 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322252&action=review

> Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:134
> +        if (!node || node === this._hoveredDataGridNode)

As a precaution against having a highlight that stays visible even after the user has moved their mouse, I would recommend you also have a call to `WI.domTreeManager.hideDOMNodeHighlight();` inside an early-return for `if (!node)`.

> Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:148
> +        if (!this._hoveredDataGridNode)

Ditto (134).
Comment 3 Ross Kirsling 2017-09-29 17:58:47 PDT
I(In reply to Devin Rousso from comment #2)
> Comment on attachment 322252 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322252&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:134
> > +        if (!node || node === this._hoveredDataGridNode)
> 
> As a precaution against having a highlight that stays visible even after the
> user has moved their mouse, I would recommend you also have a call to
> `WI.domTreeManager.hideDOMNodeHighlight();` inside an early-return for `if
> (!node)`.
> 
> > Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:148
> > +        if (!this._hoveredDataGridNode)
> 
> Ditto (134).

Is this a conceivable scenario? FWIW, the logic here is ripped straight from https://trac.webkit.org/browser/webkit/trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js.
Comment 4 Ross Kirsling 2017-09-29 18:14:59 PDT
Hmm, perhaps DOMTreeDataGrid isn't even being used?

And admittedly, DOMTreeOutline is almost the same, except does the thing you suggested:
https://trac.webkit.org/browser/webkit/trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js#L295
Comment 5 Ross Kirsling 2017-09-29 18:29:01 PDT
Created attachment 322263 [details]
Patch
Comment 6 Devin Rousso 2017-10-02 15:59:04 PDT
Comment on attachment 322263 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322263&action=review

r=me.  Looks good, with a few minor comments.

> Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:96
> +        this._dataGrid.element.addEventListener("mouseout", this._dataGridMouseOut.bind(this), false);

I think you want to use "mouseleave" instead.  "mouseout" will fire every time the mouse leaves any child element, of which there are a lot in DataGrid.  This case is already covered by your "mousemove" implementation, so you only need to add a listener for when the mouse leaves the DataGrid itself, not any of its children.

<https://developer.mozilla.org/en-US/docs/Web/Events/mouseleave>

> Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js:139
> +        if (node === this._hoveredDataGridNode)

This check should probably happen before the if on (134), as otherwise we are firing unnecessary `WI.domTreeManager.hideDOMNodeHighlight` calls.

    let node = this._dataGrid.dataGridNodeFromNode(event.target);
    if (node === this._hoveredDataGridNode)
        return;

    if (!node) {
        this._hideDOMNodeHighlight();
        return;
    }
Comment 7 Ross Kirsling 2017-10-02 16:45:01 PDT
Created attachment 322470 [details]
Patch
Comment 8 WebKit Commit Bot 2017-10-03 12:21:57 PDT
Comment on attachment 322470 [details]
Patch

Clearing flags on attachment: 322470

Committed r222801: <http://trac.webkit.org/changeset/222801>
Comment 9 WebKit Commit Bot 2017-10-03 12:21:59 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2017-10-03 12:22:52 PDT
<rdar://problem/34796203>