Web Inspector: Debugger Popover for Node object should have go-to-arrow to show the...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 14:55:56 +0000 (14:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 14:55:56 +0000 (14:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145594

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-06-03
Reviewed by Timothy Hatcher.

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype.inspectElement):
Previously we could get an exception later on if we tried to
inspect an element that was not in the DOM. Bail if the node
is not in the DOM or not.

* UserInterface/Views/SourceCodeTextEditor.css:
(.popover .debugger-popover-content > .title > .go-to-arrow):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject.data.pushNodeToFrontend):
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject):
For a node type, add a go-to-arrow in the popover if it is in the DOM or not.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185150 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.css
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

index 74db029..60e65dd 100644 (file)
@@ -1,3 +1,23 @@
+2015-06-03  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Debugger Popover for Node object should have go-to-arrow to show the node in DOM tree
+        https://bugs.webkit.org/show_bug.cgi?id=145594
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/DOMTreeManager.js:
+        (WebInspector.DOMTreeManager.prototype.inspectElement):
+        Previously we could get an exception later on if we tried to
+        inspect an element that was not in the DOM. Bail if the node
+        is not in the DOM or not.
+
+        * UserInterface/Views/SourceCodeTextEditor.css:
+        (.popover .debugger-popover-content > .title > .go-to-arrow):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject.data.pushNodeToFrontend):
+        (WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject):
+        For a node type, add a go-to-arrow in the popover if it is in the DOM or not.
+
 2015-06-02  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Remove uses of delete in Sidebar related code
index c0f3d2c..e68acca 100644 (file)
@@ -266,8 +266,10 @@ WebInspector.DOMTreeManager = class DOMTreeManager extends WebInspector.Object
     inspectElement(nodeId)
     {
         var node = this._idToDOMNode[nodeId];
-        if (node)
-            this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, {node});
+        if (!node || !node.ownerDocument)
+            return;
+
+        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, {node});
 
         this._inspectModeEnabled = false;
         this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);
index 189c047..efe832b 100644 (file)
     white-space: nowrap;
 }
 
+.popover .debugger-popover-content > .title > .go-to-arrow {
+    position: relative;
+    top: 2px;
+    left: 4px;
+    width: 12px;
+    height: 12px;
+}
+
 .popover .debugger-popover-content > .body {
     border-top: 1px solid rgb(194, 194, 147);
     overflow: auto;
index f3c591e..077610b 100644 (file)
@@ -1502,6 +1502,22 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
         titleElement.textContent = data.description;
         content.appendChild(titleElement);
 
+        if (data.subtype === "node") {
+            data.pushNodeToFrontend(function(nodeId) {
+                if (!nodeId)
+                    return;
+
+                var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+                if (!domNode.ownerDocument)
+                    return;
+
+                var goToButton = titleElement.appendChild(WebInspector.createGoToArrowButton());
+                goToButton.addEventListener("click", function() {
+                    WebInspector.domTreeManager.inspectElement(nodeId);
+                });
+            });
+        }
+
         // FIXME: If this is a variable, it would be nice to put the variable name in the PropertyPath.
         var objectTree = new WebInspector.ObjectTreeView(data);
         objectTree.showOnlyProperties();