The Inspector should support console.dirXML for Firebug parity.
<rdar://problem/5950860>
Created attachment 22832 [details] proposed patch Doesn't highlight so not very interactive, but working.
Created attachment 22833 [details] screenshot
Comment on attachment 22832 [details] proposed patch Too much coped code. We need to share this with the Element's DOM more. But the approach seems good! I propose to factor out the TreeOutline code from ElementsPanel.js into a new file and make it a TreeOutline subclass, like ElementsTreeOutline or NodeTreeOutline. Then you might not need the ConsoleElementsInspector, since that class is very small I don't see the need, Also Firebug shows the element that was passed , not just the children. So you need to show the body in your example. For the record, I hate the "dir" names...
Created attachment 22850 [details] proposed patch I moved a lot of things around so I'm not sure if it's working properly. As far as I can tell the Alt key is broken but other than that seems to be working. The ElementsTreeOutline in the console is selectable but the z-index of highlight is -1 so it's hidden. Is there a good way to disable select in a TreeOutline?
Oh, and how do I add a js file to the build system?
Created attachment 22851 [details] alt key fixed Alt key works now.
Created attachment 22852 [details] patch Fixed inspect element from context menu and search.
Comment on attachment 22852 [details] patch There are a few issues that are preventing this from landing. The WebInspector.ElementsPanel constructor is indented 1 more space than it needs to be, causing massive changed lines. Undo this so real changes can be seen. + this.treeOutline._updateHoverHighlight = function() { + if ("_updateHoverHighlightTimeout" in this) { + clearTimeout(this._updateHoverHighlightTimeout); + delete this._updateHoverHighlightTimeout; + } + + if (this._hoveredDOMNode && this.panel.visible && (this.panel._altKeyDown || this.panel.forceHoverHighlight)) + InspectorController.highlightDOMNode(this._hoveredDOMNode); + else + InspectorController.hideDOMNodeHighlight(); + }, Why do you need thsi when the same function is in ElementsTreeOutline? Also you are ending the function with a coma, not a semicolon. + this.treeOutline.element.addEventListener("mousemove", this._onmousemove.bind(this), false); + this.treeOutline.element.addEventListener("mouseout", this._onmouseout.bind(this), false); These event listeners can be removed and all of the _onmousemove and _onmouseout functions should move to ElementsTreeOutline. - this.updateTreeSelection(); + this.treeOutline.updateTreeSelection(); Rename this to updateSelection since the word tree is redundant now. reset: function() { - this.rootDOMNode = null; - this.focusedDOMNode = null; - this.altKeyDown = false; - this.hoveredDOMNode = null; this.forceHoverHighlight = false; You still need to set rootDOMNode, focusedDOMNode and hoveredDOMNode to null here. get forceHoverHighlight() set forceHoverHighlight() get altKeyDown() set altKeyDown() These functions should move with set hoveredDOMNode. The more I think about the hovered node code, it should live in inspector.js seperate from the tree outline. That way code like the breadcrumbs and console messages can support hover and use the shared functions to update the hovered node. So move _updateHoverHighlight, _updateHoverHighlightSoon, get/set hoveredDOMNode, get/set forceHoverHighlight, and get/set altKeyDown to WebInspector.prototype in inspector.js. Move _getDocumentForNode, _parentNodeOrFrameElement and _isAncestorIncludingParentFrames to utilities.js, since they are move helper functions and not good class methods. Drop the underscore prefix too. _onmousemove: function(event) { - var element = this._treeElementFromEvent(event); + var element = this.treeOutline._treeElementFromEvent(event); if (!element) return; this.altKeyDown = event.altKey; - this.hoveredDOMNode = element.representedObject; this.forceHoverHighlight = element.selected; }, @@ -1091,332 +909,8 @@ WebInspector.ElementsPanel.prototype = { if (event.target !== this.treeListElement) return; this.altKeyDown = false; - this.hoveredDOMNode = null; this.forceHoverHighlight = false; } } These event listener methods should move entirely to ElementsTreeOutline. To add the file to the Windows project and Qt project see: http://trac.webkit.org/changeset/33408#file1 http://trac.webkit.org/changeset/33408#file7 Also you need to add the file to inspector.html, see: http://trac.webkit.org/changeset/33408#file8
Comment on attachment 22852 [details] patch Also one really important change to make! + updateTreeOutline: function() + { + this.removeChildrenRecursive(); This needs to be removeChildren(). removeChildrenRecursive() is doing more work than is needed here, and just removing the top level children is enough. This should be a good performance win! I know it was removeChildrenRecursive in the original code, not sure why I did that!!
Created attachment 23223 [details] new patch I think moving all hover related code to WebInspector turned out great. Made the code simpler.
Comment on attachment 23223 [details] new patch This is ready to land! Nice job!
Landed in r36255.