Changeset 31190 in webkit


Ignore:
Timestamp:
Mar 20, 2008 3:58:44 PM (16 years ago)
Author:
Adam Roben
Message:

Highlight nodes in the page when you hover over them in the DOM tree

Part of Bug 16532: Inspector should highlight nodes in page when
hovering over nodes in Inspector's interface

<http://bugs.webkit.org/show_bug.cgi?id=16532>
<rdar://problem/5712896>

The inspected node is no longer highlighted (unless, of course, you
hover over it).

Reviewed by Tim Hatcher.

  • page/inspector/DocumentPanel.js: (WebInspector.DocumentPanel):
    • Don't highlight the focused node when the DOM tree is shown
    • Added mousemove/mouseout event listeners to set/clear the highlighted node. These are added to the root of the DOM tree instead of to each individual list item to avoid flashing as the mouse moves between nodes.

(WebInspector.DocumentPanel.set focusedDOMNode): Don't highlight the
focused node.
(WebInspector.DocumentPanel._onmousemove): Highlight the node under
the mouse.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31189 r31190  
     12008-03-20  Adam Roben  <aroben@apple.com>
     2
     3        Highlight nodes in the page when you hover over them in the DOM tree
     4
     5        Part of Bug 16532: Inspector should highlight nodes in page when
     6        hovering over nodes in Inspector's interface
     7
     8        <http://bugs.webkit.org/show_bug.cgi?id=16532>
     9        <rdar://problem/5712896>
     10
     11        The inspected node is no longer highlighted (unless, of course, you
     12        hover over it).
     13
     14        Reviewed by Tim Hatcher.
     15
     16        * page/inspector/DocumentPanel.js:
     17        (WebInspector.DocumentPanel):
     18          - Don't highlight the focused node when the DOM tree is shown
     19          - Added mousemove/mouseout event listeners to set/clear the
     20            highlighted node. These are added to the root of the DOM tree
     21            instead of to each individual list item to avoid flashing as the
     22            mouse moves between nodes.
     23        (WebInspector.DocumentPanel.set focusedDOMNode): Don't highlight the
     24        focused node.
     25        (WebInspector.DocumentPanel._onmousemove): Highlight the node under
     26        the mouse.
     27
    1282008-03-20  Adam Roben  <aroben@apple.com>
    229
  • trunk/WebCore/page/inspector/DocumentPanel.js

    r31159 r31190  
    3939    domView.hide = function() { InspectorController.hideDOMNodeHighlight() };
    4040    domView.show = function() {
    41         InspectorController.highlightDOMNode(panel.focusedDOMNode);
    4241        panel.updateBreadcrumb();
    4342        panel.updateTreeSelection();
     
    5049    domView.treeContentElement.className = "content tree outline-disclosure";
    5150
     51    function clearNodeHighlight(event)
     52    {
     53        if (event.target === this)
     54            InspectorController.hideDOMNodeHighlight();
     55    }
     56
    5257    domView.treeListElement = document.createElement("ol");
    5358    domView.treeListElement.addEventListener("mousedown", this._onmousedown.bind(this), false);
    5459    domView.treeListElement.addEventListener("dblclick", this._ondblclick.bind(this), false);
     60    domView.treeListElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
     61    domView.treeListElement.addEventListener("mouseout", clearNodeHighlight.bind(domView.treeListElement), false);
    5562    domView.treeOutline = new TreeOutline(domView.treeListElement);
    5663    domView.treeOutline.panel = this;
     
    143150
    144151        this._focusedNodeChanged();
    145 
    146         InspectorController.highlightDOMNode(x);
    147152
    148153        var nodeItem = this.revealNode(x);
     
    820825        element.select();
    821826    },
     827
     828    _onmousemove: function(event)
     829    {
     830        var element = this._treeElementFromEvent(event);
     831        if (!element)
     832            return;
     833
     834        InspectorController.highlightDOMNode(element.representedObject);
     835    },
    822836}
    823837
Note: See TracChangeset for help on using the changeset viewer.