Title: [159151] trunk/Source/WebInspectorUI
Revision
159151
Author
[email protected]
Date
2013-11-12 15:03:59 -0800 (Tue, 12 Nov 2013)

Log Message

Web Inspector: ContentFlowTreeContentView should use only one DOMTreeOutline
https://bugs.webkit.org/show_bug.cgi?id=124230

Reviewed by Timothy Hatcher.

Changed ContentFlowTreeContentView to use one DOMTreeOutline by just
populating it with root DOMTreeElements directly. That is very
similar to how DOMTreeOutline works when omitRootDOMNode is used.

Now that ContentFlowTreeContentView has only one DOMTreeOutline,
it makes sense to change its base class to be DOMTreeContentView instead.
Also, with that I've changed its name to ContentFlowDOMTreeContentView.

I had to move all the DOMTree document loading code from DOMTreeContentView to a
new class called FrameDOMTreeContentView. This is used to display the DOM of the
frame objects. FrameDOMTreeContentView is also inheriting from DOMTreeContentView.

Issues that are fixed as a side effect:
- Selection path components are now displaying all the sibling elements for contentFlow.contentNodes
(those are the nodes that have "-webkit-flow-into" set directly).
- Keyboard navigation works for the contentFlow.contentNodes.
- Search is implemented in DOMTreeContentView, so that code now works for flows too.
The DOMAgents's search API will use all the Documents to lookup for nodes, so it might
find DOM nodes that are not part of the flow. This is in line with the behavior for the
frames.

* UserInterface/ContentFlowDOMTreeContentView.js: Renamed from ContentFlowTreeContentView
to better reflect the inheritance from DOMTreeContentView.
(WebInspector.ContentFlowDOMTreeContentView):
(WebInspector.ContentFlowDOMTreeContentView.prototype.closed):
(WebInspector.ContentFlowDOMTreeContentView.prototype._createContentTrees):
(WebInspector.ContentFlowDOMTreeContentView.prototype._contentNodeWasAdded):
(WebInspector.ContentFlowDOMTreeContentView.prototype._contentNodeWasRemoved):
* UserInterface/ContentView.js:
(WebInspector.ContentView):
* UserInterface/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView):
(WebInspector.DOMTreeContentView.prototype.closed):
(WebInspector.DOMTreeContentView.prototype.):
(WebInspector.DOMTreeContentView.prototype._restoreSelectedNodeAfterUpdate):
(WebInspector.DOMTreeContentView.prototype._selectedNodeDidChange):
* UserInterface/FrameDOMTreeContentView.js: Added.
(WebInspector.FrameDOMTreeContentView):
(WebInspector.FrameDOMTreeContentView.prototype.get domTree):
(WebInspector.FrameDOMTreeContentView.prototype.closed):
(WebInspector.FrameDOMTreeContentView.prototype._rootDOMNodeAvailable):
(WebInspector.FrameDOMTreeContentView.prototype._rootDOMNodeInvalidated):
(WebInspector.FrameDOMTreeContentView.prototype._requestRootDOMNode):
* UserInterface/Main.html:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (159150 => 159151)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-11-12 22:51:12 UTC (rev 159150)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-11-12 23:03:59 UTC (rev 159151)
@@ -1,3 +1,55 @@
+2013-11-12  Alexandru Chiculita  <[email protected]>
+
+        Web Inspector: ContentFlowTreeContentView should use only one DOMTreeOutline
+        https://bugs.webkit.org/show_bug.cgi?id=124230
+
+        Reviewed by Timothy Hatcher.
+
+        Changed ContentFlowTreeContentView to use one DOMTreeOutline by just
+        populating it with root DOMTreeElements directly. That is very
+        similar to how DOMTreeOutline works when omitRootDOMNode is used.
+
+        Now that ContentFlowTreeContentView has only one DOMTreeOutline,
+        it makes sense to change its base class to be DOMTreeContentView instead.
+        Also, with that I've changed its name to ContentFlowDOMTreeContentView.
+
+        I had to move all the DOMTree document loading code from DOMTreeContentView to a
+        new class called FrameDOMTreeContentView. This is used to display the DOM of the
+        frame objects. FrameDOMTreeContentView is also inheriting from DOMTreeContentView.
+
+        Issues that are fixed as a side effect:
+        - Selection path components are now displaying all the sibling elements for contentFlow.contentNodes
+        (those are the nodes that have "-webkit-flow-into" set directly).
+        - Keyboard navigation works for the contentFlow.contentNodes.
+        - Search is implemented in DOMTreeContentView, so that code now works for flows too.
+        The DOMAgents's search API will use all the Documents to lookup for nodes, so it might
+        find DOM nodes that are not part of the flow. This is in line with the behavior for the
+        frames.
+
+        * UserInterface/ContentFlowDOMTreeContentView.js: Renamed from ContentFlowTreeContentView
+        to better reflect the inheritance from DOMTreeContentView.
+        (WebInspector.ContentFlowDOMTreeContentView):
+        (WebInspector.ContentFlowDOMTreeContentView.prototype.closed):
+        (WebInspector.ContentFlowDOMTreeContentView.prototype._createContentTrees):
+        (WebInspector.ContentFlowDOMTreeContentView.prototype._contentNodeWasAdded):
+        (WebInspector.ContentFlowDOMTreeContentView.prototype._contentNodeWasRemoved):
+        * UserInterface/ContentView.js:
+        (WebInspector.ContentView):
+        * UserInterface/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView):
+        (WebInspector.DOMTreeContentView.prototype.closed):
+        (WebInspector.DOMTreeContentView.prototype.):
+        (WebInspector.DOMTreeContentView.prototype._restoreSelectedNodeAfterUpdate):
+        (WebInspector.DOMTreeContentView.prototype._selectedNodeDidChange):
+        * UserInterface/FrameDOMTreeContentView.js: Added.
+        (WebInspector.FrameDOMTreeContentView):
+        (WebInspector.FrameDOMTreeContentView.prototype.get domTree):
+        (WebInspector.FrameDOMTreeContentView.prototype.closed):
+        (WebInspector.FrameDOMTreeContentView.prototype._rootDOMNodeAvailable):
+        (WebInspector.FrameDOMTreeContentView.prototype._rootDOMNodeInvalidated):
+        (WebInspector.FrameDOMTreeContentView.prototype._requestRootDOMNode):
+        * UserInterface/Main.html:
+
 2013-11-08  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: remove -webkit-min and -webkit-max from CSS completions

Added: trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js (0 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js	2013-11-12 23:03:59 UTC (rev 159151)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+WebInspector.ContentFlowDOMTreeContentView = function(contentFlow)
+{
+    console.assert(contentFlow);
+
+    WebInspector.DOMTreeContentView.call(this, contentFlow);
+
+    contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
+    contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
+
+    this._createContentTrees();
+};
+
+WebInspector.ContentFlowDOMTreeContentView.prototype = {
+    constructor: WebInspector.ContentFlowDOMTreeContentView,
+    __proto__: WebInspector.DOMTreeContentView.prototype,
+
+    // Public
+
+    closed: function()
+    {
+        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
+        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
+        WebInspector.DOMTreeContentView.prototype.closed.call(this);
+    },
+
+    // Private
+
+    _createContentTrees: function()
+    {
+        var contentNodes = this.representedObject.contentNodes;
+        for (var contentNode of contentNodes)
+            this.domTreeOutline.appendChild(new WebInspector.DOMTreeElement(contentNode));
+
+        var documentURL = contentNodes.length ? contentNodes[0].ownerDocument.documentURL : null;
+        this._restoreSelectedNodeAfterUpdate(documentURL, contentNodes[0]);
+    },
+
+    _contentNodeWasAdded: function(event)
+    {
+        var treeElement = new WebInspector.DOMTreeElement(event.data.node);
+        if (!event.data.before) {
+            this.domTreeOutline.appendChild(treeElement);
+            return;
+        }
+
+        var beforeElement = this.domTreeOutline.findTreeElement(event.data.before);
+        console.assert(beforeElement);
+
+        var index = this.domTreeOutline.children.indexOf(beforeElement);
+        console.assert(index !== -1);
+
+        this.domTreeOutline.insertChild(treeElement, index);
+    },
+
+    _contentNodeWasRemoved: function(event)
+    {
+        var treeElement = this.domTreeOutline.findTreeElement(event.data.node);
+        console.assert(treeElement);
+        this.domTreeOutline.removeChild(treeElement);
+    }
+};

Deleted: trunk/Source/WebInspectorUI/UserInterface/ContentFlowTreeContentView.js (159150 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/ContentFlowTreeContentView.js	2013-11-12 22:51:12 UTC (rev 159150)
+++ trunk/Source/WebInspectorUI/UserInterface/ContentFlowTreeContentView.js	2013-11-12 23:03:59 UTC (rev 159151)
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials
- *    provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-WebInspector.ContentFlowTreeContentView = function(contentFlow)
-{
-    console.assert(contentFlow);
-
-    WebInspector.ContentView.call(this, contentFlow);
-
-    this._selectedTreeElement = null;
-
-    // Map of contentNode ids to DOMTreeOutline objects.
-    this._nodesMap = new Map();
-
-    this._createContentTrees();
-
-    contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
-    contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
-};
-
-WebInspector.ContentFlowTreeContentView.StyleClassName = "content-flow-tree";
-
-WebInspector.ContentFlowTreeContentView.prototype = {
-    constructor: WebInspector.ContentFlowTreeContentView,
-    __proto__: WebInspector.ContentView.prototype,
-
-    // Public
-
-    get selectionPathComponents()
-    {
-        var treeElement = this._selectedTreeElement;
-        var pathComponents = [];
-
-        while (treeElement && !treeElement.root) {
-            // The close tag is contained within the element it closes. So skip it since we don't want to
-            // show the same node twice in the hierarchy.
-            if (treeElement.isCloseTag()) {
-                treeElement = treeElement.parent;
-                continue;
-            }
-
-            // FIXME: ContentFlow.contentNodes should be linked to each other.
-            var pathComponent = new WebInspector.DOMTreeElementPathComponent(treeElement, treeElement.representedObject);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
-            pathComponents.unshift(pathComponent);
-
-            // Do not display elements outside the ContentFlow.
-            if (this._nodesMap.has(treeElement.representedObject.id))
-                break;
-
-            treeElement = treeElement.parent;
-        }
-
-        return pathComponents;
-    },
-
-    updateLayout: function()
-    {
-        this._nodesMap.forEach(function(node) {
-            node.updateSelection();
-        });
-    },
-
-    shown: function()
-    {
-        var omitFocus = WebInspector.isConsoleFocused();
-        this._nodesMap.forEach(function(node) {
-            node.setVisible(true, omitFocus);
-        });
-    },
-
-    hidden: function()
-    {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
-        this._nodesMap.forEach(function(node) {
-            node.setVisible(false);
-        });
-    },
-
-    closed: function()
-    {
-        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
-        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
-        this._nodesMap.forEach(function(node) {
-            node.close();
-        });
-    },
-
-    // Private
-
-    _selectedNodeDidChange: function(contentNodeOutline, event)
-    {
-        var selectedTreeElement = contentNodeOutline.selectedTreeElement;
-        if (this._selectedTreeElement === selectedTreeElement)
-            return;
-
-        // Make sure that moving from one tree to the other will deselect the previous element.
-        if (this._selectedTreeElement && this._selectedTreeElement.treeOutline !== contentNodeOutline)
-            this._selectedTreeElement.deselect();
-
-        this._selectedTreeElement = selectedTreeElement;
-        if (selectedTreeElement) {
-            // FIXME: Switching between different ContentFlowTreeContentView or DOMTreeContentView elements should call ConsoleAgent.addInspectedNode.
-            ConsoleAgent.addInspectedNode(selectedTreeElement.representedObject.id);
-        }
-
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-    },
-
-    _pathComponentSelected: function(event)
-    {
-        console.assert(event.data.pathComponent instanceof WebInspector.DOMTreeElementPathComponent);
-        console.assert(event.data.pathComponent.domTreeElement instanceof WebInspector.DOMTreeElement);
-
-        var treeElement = event.data.pathComponent.domTreeElement;
-        treeElement.treeOutline.selectDOMNode(treeElement.representedObject, true);
-    },
-
-    _createContentNodeTree: function(node)
-    {
-        console.assert(!this._nodesMap.has(node.id));
-
-        // FIXME: DOMTree's should be linked to each other when navigating with keyboard up/down events.
-        var contentNodeOutline = new WebInspector.DOMTreeOutline(false, true, true);
-        contentNodeOutline.addEventListener(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged, this._selectedNodeDidChange.bind(this, contentNodeOutline), this);
-        contentNodeOutline.setVisible(this.visible, WebInspector.isConsoleFocused());
-        contentNodeOutline.wireToDomAgent();
-        contentNodeOutline.rootDOMNode = node;
-
-        this._nodesMap.set(node.id, contentNodeOutline);
-
-        return contentNodeOutline;
-    },
-
-    _createContentTrees: function()
-    {
-        for (var contentNode of this.representedObject.contentNodes) {
-            var contentNodeOutline = this._createContentNodeTree(contentNode);
-            this.element.appendChild(contentNodeOutline.element);
-        }
-    },
-
-    _contentNodeWasAdded: function(event)
-    {
-        var treeElement = this._createContentNodeTree(event.data.node);
-        if (event.data.before) {
-            var beforeElement = this._nodesMap.get(event.data.before.id);
-            console.assert(beforeElement);
-            this.element.insertBefore(treeElement.element, beforeElement.element);
-        } else
-            this.element.appendChild(treeElement.element);
-    },
-
-    _contentNodeWasRemoved: function(event)
-    {
-        var contentNodeOutline = this._nodesMap.get(event.data.node.id);
-        contentNodeOutline.close();
-        contentNodeOutline.element.remove();
-
-        this._nodesMap.delete(event.data.node.id);
-    }
-};

Modified: trunk/Source/WebInspectorUI/UserInterface/ContentView.js (159150 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/ContentView.js	2013-11-12 22:51:12 UTC (rev 159150)
+++ trunk/Source/WebInspectorUI/UserInterface/ContentView.js	2013-11-12 23:03:59 UTC (rev 159151)
@@ -55,7 +55,7 @@
             return new WebInspector.ApplicationCacheFrameContentView(representedObject);
 
         if (representedObject instanceof WebInspector.DOMTree)
-            return new WebInspector.DOMTreeContentView(representedObject);
+            return new WebInspector.FrameDOMTreeContentView(representedObject);
 
         if (representedObject instanceof WebInspector.LogObject)
             return new WebInspector.LogContentView(representedObject);
@@ -73,7 +73,7 @@
             return new WebInspector.CanvasProfileView(representedObject);
 
         if (representedObject instanceof WebInspector.ContentFlow)
-            return new WebInspector.ContentFlowTreeContentView(representedObject);
+            return new WebInspector.ContentFlowDOMTreeContentView(representedObject);
 
         if (typeof representedObject === "string" || representedObject instanceof String)
             return new WebInspector.TextContentView(representedObject);

Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js (159150 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js	2013-11-12 22:51:12 UTC (rev 159150)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js	2013-11-12 23:03:59 UTC (rev 159151)
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeContentView = function(domTree)
+WebInspector.DOMTreeContentView = function(representedObject)
 {
-    console.assert(domTree);
+    console.assert(representedObject);
 
-    WebInspector.ContentView.call(this, domTree);
+    WebInspector.ContentView.call(this, representedObject);
 
     this._compositingBordersButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("layer-borders", WebInspector.UIString("Show compositing borders"), WebInspector.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 16, 16);
     this._compositingBordersButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
@@ -41,9 +41,6 @@
     this.element.classList.add(WebInspector.DOMTreeContentView.StyleClassName);
     this.element.addEventListener("click", this._mouseWasClicked.bind(this), false);
 
-    this._domTree = domTree;
-    this._domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
-
     this._domTreeOutline = new WebInspector.DOMTreeOutline(true, true, false);
     this._domTreeOutline.addEventListener(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged, this._selectedNodeDidChange, this);
     this._domTreeOutline.wireToDomAgent();
@@ -56,14 +53,13 @@
     this._lastSelectedNodePathSetting = new WebInspector.Setting("last-selected-node-path", null);
 
     this._numberOfSearchResults = null;
-
-    this._requestRootDOMNode();
 };
 
 WebInspector.DOMTreeContentView.StyleClassName = "dom-tree";
 
 WebInspector.DOMTreeContentView.prototype = {
     constructor: WebInspector.DOMTreeContentView,
+    __proto__: WebInspector.ContentView.prototype,
 
     // Public
 
@@ -72,9 +68,9 @@
         return [this._showsShadowDOMButtonNavigationItem, this._compositingBordersButtonNavigationItem];
     },
 
-    get domTree()
+    get domTreeOutline()
     {
-        return this._domTree;
+        return this._domTreeOutline;
     },
 
     get scrollableElements()
@@ -101,7 +97,6 @@
 
     closed: function()
     {
-        this._domTree.removeEventListener(null, null, this);
         WebInspector.domTreeManager.removeEventListener(null, null, this);
 
         this._domTreeOutline.close();
@@ -284,20 +279,13 @@
         DOMAgent.getSearchResults(this._searchIdentifier, index, index + 1, revealResult.bind(this));
     },
 
-    _rootDOMNodeAvailable: function(rootDOMNode)
+    _restoreSelectedNodeAfterUpdate: function(documentURL, defaultNode)
     {
-        this._domTreeOutline.rootDOMNode = rootDOMNode;
-
-        if (!rootDOMNode) {
-            this._domTreeOutline.selectDOMNode(null, false);
-            return;
-        }
-
         function selectNode(lastSelectedNode)
         {
             var nodeToFocus = lastSelectedNode;
             if (!nodeToFocus)
-                nodeToFocus = rootDOMNode.body || rootDOMNode.documentElement;
+                nodeToFocus = defaultNode;
 
             if (!nodeToFocus)
                 return;
@@ -316,27 +304,17 @@
             selectNode.call(this, WebInspector.domTreeManager.nodeForId(nodeId));
         }
 
-        if (this._lastSelectedNodePathSetting.value && this._lastSelectedNodePathSetting.value.path && this._lastSelectedNodePathSetting.value.url ="" this._domTree.frame.url.hash)
+        if (documentURL && this._lastSelectedNodePathSetting.value && this._lastSelectedNodePathSetting.value.path && this._lastSelectedNodePathSetting.value.url ="" documentURL.hash)
             WebInspector.domTreeManager.pushNodeByPathToFrontend(this._lastSelectedNodePathSetting.value.path, selectLastSelectedNode.bind(this));
         else
             selectNode.call(this);
     },
 
-    _rootDOMNodeInvalidated: function(event)
-    {
-        this._requestRootDOMNode();
-    },
-
-    _requestRootDOMNode: function()
-    {
-        this._domTree.requestRootDOMNode(this._rootDOMNodeAvailable.bind(this));
-    },
-
     _selectedNodeDidChange: function(event)
     {
         var selectedDOMNode = this._domTreeOutline.selectedDOMNode();
         if (selectedDOMNode && !this._dontSetLastSelectedNodePath)
-            this._lastSelectedNodePathSetting.value = {url: this._domTree.frame.url.hash, path: selectedDOMNode.path()};
+            this._lastSelectedNodePathSetting.value = {url: selectedDOMNode.ownerDocument.documentURL.hash, path: selectedDOMNode.path()};
 
         if (selectedDOMNode)
             ConsoleAgent.addInspectedNode(selectedDOMNode.id);
@@ -409,7 +387,7 @@
         this._compositingBordersButtonNavigationItem.activated = activated;
         PageAgent.setCompositingBordersVisible(activated);
     },
-    
+
     _updateCompositingBordersButtonToMatchPageSettings: function()
     {
         if (!PageAgent.getCompositingBordersVisible)
@@ -434,5 +412,3 @@
         WebInspector.showShadowDOMSetting.value = !WebInspector.showShadowDOMSetting.value;
     }
 };
-
-WebInspector.DOMTreeContentView.prototype.__proto__ = WebInspector.ContentView.prototype;

Added: trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js (0 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js	2013-11-12 23:03:59 UTC (rev 159151)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.FrameDOMTreeContentView = function(domTree)
+{
+    console.assert(domTree);
+
+    WebInspector.DOMTreeContentView.call(this, domTree);
+
+    this._domTree = domTree;
+    this._domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
+
+    this._requestRootDOMNode();
+};
+
+
+WebInspector.FrameDOMTreeContentView.prototype = {
+    constructor: WebInspector.FrameDOMTreeContentView,
+    __proto__: WebInspector.DOMTreeContentView.prototype,
+
+    // Public
+
+    get domTree()
+    {
+        return this._domTree;
+    },
+
+    closed: function()
+    {
+        this._domTree.removeEventListener(null, null, this);
+        WebInspector.DOMTreeContentView.prototype.closed.call(this);
+    },
+
+    // Private
+
+    _rootDOMNodeAvailable: function(rootDOMNode)
+    {
+        this.domTreeOutline.rootDOMNode = rootDOMNode;
+
+        if (!rootDOMNode) {
+            this.domTreeOutline.selectDOMNode(null, false);
+            return;
+        }
+
+        this._restoreSelectedNodeAfterUpdate(this._domTree.frame.url, rootDOMNode.body || rootDOMNode.documentElement);
+    },
+
+    _rootDOMNodeInvalidated: function(event)
+    {
+        this._requestRootDOMNode();
+    },
+
+    _requestRootDOMNode: function()
+    {
+        this._domTree.requestRootDOMNode(this._rootDOMNodeAvailable.bind(this));
+    }
+
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (159150 => 159151)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2013-11-12 22:51:12 UTC (rev 159150)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2013-11-12 23:03:59 UTC (rev 159151)
@@ -275,6 +275,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""
@@ -400,7 +401,7 @@
     <script src=""
     <script src=""
     <script src=""
-    <script src=""
+    <script src=""
     <script src=""
 
     <script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to