Title: [96805] trunk/Source/WebCore
Revision
96805
Author
pfeld...@chromium.org
Date
2011-10-06 06:14:22 -0700 (Thu, 06 Oct 2011)

Log Message

Web Inspector: make ElementsTreeOutline compile
https://bugs.webkit.org/show_bug.cgi?id=69439

Reviewed by Yury Semikhatsky.

* inspector/compile-front-end.sh:
* inspector/front-end/DOMAgent.js:
* inspector/front-end/DOMSyntaxHighlighter.js:
* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel.get this):
(WebInspector.ElementsPanel):
(WebInspector.ElementsPanel.prototype._populateContextMenu):
(WebInspector.ElementsPanel.prototype._inspectElementRequested):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline):
(WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired.focusElement):
(WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
(WebInspector.ElementsTreeOutline.prototype._updateModifiedNodes):
(WebInspector.ElementsTreeOutline.prototype._populateContextMenu):
(WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
(WebInspector.ElementsTreeElement.prototype._startEditingAttribute):
(WebInspector.ElementsTreeElement.prototype._startEditingTextNode):
(WebInspector.ElementsTreeElement.prototype._startEditingTagName):
(WebInspector.ElementsTreeElement.prototype._startEditingAsHTML):
(WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
(WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
():
* inspector/front-end/externs.js:
(WebInspector.highlightDOMNode):
(WebInspector.resourceURLForRelatedNode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96804 => 96805)


--- trunk/Source/WebCore/ChangeLog	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/ChangeLog	2011-10-06 13:14:22 UTC (rev 96805)
@@ -1,3 +1,36 @@
+2011-10-05  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: make ElementsTreeOutline compile
+        https://bugs.webkit.org/show_bug.cgi?id=69439
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/DOMAgent.js:
+        * inspector/front-end/DOMSyntaxHighlighter.js:
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.get this):
+        (WebInspector.ElementsPanel):
+        (WebInspector.ElementsPanel.prototype._populateContextMenu):
+        (WebInspector.ElementsPanel.prototype._inspectElementRequested):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline):
+        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired.focusElement):
+        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
+        (WebInspector.ElementsTreeOutline.prototype._updateModifiedNodes):
+        (WebInspector.ElementsTreeOutline.prototype._populateContextMenu):
+        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
+        (WebInspector.ElementsTreeElement.prototype._startEditingAttribute):
+        (WebInspector.ElementsTreeElement.prototype._startEditingTextNode):
+        (WebInspector.ElementsTreeElement.prototype._startEditingTagName):
+        (WebInspector.ElementsTreeElement.prototype._startEditingAsHTML):
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
+        ():
+        * inspector/front-end/externs.js:
+        (WebInspector.highlightDOMNode):
+        (WebInspector.resourceURLForRelatedNode):
+
 2011-10-06  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: Inspector fails to start if there was at least one watch _expression_.

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (96804 => 96805)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2011-10-06 13:14:22 UTC (rev 96805)
@@ -68,11 +68,12 @@
         --js Source/WebCore/inspector/front-end/Resource.js \
         --js Source/WebCore/inspector/front-end/NetworkManager.js \
         --js Source/WebCore/inspector/front-end/UISourceCode.js \
-    --module jsmodule_ui:28:jsmodule_common \
+    --module jsmodule_ui:29:jsmodule_common \
         --js Source/WebCore/inspector/front-end/Checkbox.js \
         --js Source/WebCore/inspector/front-end/Color.js \
         --js Source/WebCore/inspector/front-end/ContextMenu.js \
         --js Source/WebCore/inspector/front-end/CookiesTable.js \
+        --js Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js \
         --js Source/WebCore/inspector/front-end/DataGrid.js \
         --js Source/WebCore/inspector/front-end/Drawer.js \
         --js Source/WebCore/inspector/front-end/EmptyView.js \
@@ -97,9 +98,10 @@
         --js Source/WebCore/inspector/front-end/Toolbar.js \
         --js Source/WebCore/inspector/front-end/UIUtils.js \
         --js Source/WebCore/inspector/front-end/View.js \
-    --module jsmodule_inspector:18:jsmodule_sdk,jsmodule_ui \
+    --module jsmodule_inspector:19:jsmodule_sdk,jsmodule_ui \
         --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
         --js Source/WebCore/inspector/front-end/ConsoleView.js \
+        --js Source/WebCore/inspector/front-end/ElementsTreeOutline.js \
         --js Source/WebCore/inspector/front-end/FontView.js \
         --js Source/WebCore/inspector/front-end/ImageView.js \
         --js Source/WebCore/inspector/front-end/_javascript_ContextManager.js \

Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -617,6 +617,9 @@
         delete this._idToDOMNode[nodeId];
     },
 
+    /**
+     * @param {number} nodeId
+     */
     inspectElement: function(nodeId)
     {
         var node = this._idToDOMNode[nodeId];
@@ -644,6 +647,62 @@
     querySelectorAll: function(nodeId, selectors, callback)
     {
         DOMAgent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(callback));
+    },
+
+    /**
+     * @param {?number} nodeId
+     * @param {string=} mode
+     */
+    highlightDOMNode: function(nodeId, mode)
+    {
+        if (this._hideDOMNodeHighlightTimeout) {
+            clearTimeout(this._hideDOMNodeHighlightTimeout);
+            delete this._hideDOMNodeHighlightTimeout;
+        }
+
+        this._highlightedDOMNodeId = nodeId;
+        if (nodeId)
+            DOMAgent.highlightNode(nodeId, this._buildHighlightConfig(mode));
+        else
+            DOMAgent.hideHighlight();
+    },
+
+    hideDOMNodeHighlight: function()
+    {
+        this.highlightDOMNode(0);
+    },
+
+    highlightDOMNodeForTwoSeconds: function(nodeId)
+    {
+        this.highlightDOMNode(nodeId);
+        this._hideDOMNodeHighlightTimeout = setTimeout(this.hideDOMNodeHighlight.bind(this), 2000);
+    },
+
+    setInspectModeEnabled: function(enabled, callback)
+    {
+        DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), callback);
+    },
+
+    /**
+     * @param {string=} mode
+     */
+    _buildHighlightConfig: function(mode)
+    {
+        mode = mode || "all";
+        var highlightConfig = { showInfo: mode === "all" };
+        if (mode === "all" || mode === "content")
+            highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();
+
+        if (mode === "all" || mode === "padding")
+            highlightConfig.paddingColor = WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();
+
+        if (mode === "all" || mode === "border")
+            highlightConfig.borderColor = WebInspector.Color.PageHighlight.Border.toProtocolRGBA();
+
+        if (mode === "all" || mode === "margin")
+            highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();
+
+        return highlightConfig;
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -28,6 +28,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.DOMSyntaxHighlighter = function(mimeType, stripExtraWhitespace)
 {
     this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);

Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -41,7 +41,7 @@
 
     this.contentElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
 
-    this.treeOutline = new WebInspector.ElementsTreeOutline(true, true);
+    this.treeOutline = new WebInspector.ElementsTreeOutline(true, true, false, this._populateContextMenu.bind(this));
     this.treeOutline.wireToDomAgent();
 
     this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this);
@@ -97,6 +97,7 @@
 
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved, this._nodeRemoved, this);
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
+    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectElementRequested, this._inspectElementRequested, this);
 }
 
 WebInspector.ElementsPanel.prototype = {
@@ -136,7 +137,7 @@
     {
         WebInspector.Panel.prototype.hide.call(this);
 
-        WebInspector.highlightDOMNode(0);
+        WebInspector.domAgent.hideDOMNodeHighlight();
         this.setSearchingForNode(false);
         this.treeOutline.setVisible(false);
     },
@@ -286,6 +287,16 @@
         this.selectDOMNode(node, true);
     },
 
+    _populateContextMenu: function(contextMenu, node)
+    {
+        if (Preferences.nativeInstrumentationEnabled) {
+            // Add debbuging-related actions
+            contextMenu.appendSeparator();
+            var pane = this.sidebarPanes.domBreakpoints;
+            pane.populateNodeContextMenu(node, contextMenu);
+        }
+    },
+
     _updateMatchesCount: function()
     {
         WebInspector.searchController.updateSearchMatchesCount(this._searchResults.length, this);
@@ -414,7 +425,7 @@
         var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
         var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");
 
-        WebInspector.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
+        WebInspector.domAgent.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
 
         if ("_mouseOutOfCrumbsTimeout" in this) {
             clearTimeout(this._mouseOutOfCrumbsTimeout);
@@ -428,7 +439,7 @@
         if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement))
             return;
 
-        WebInspector.highlightDOMNode(0);
+        WebInspector.domAgent.hideDOMNodeHighlight();
 
         this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000);
     },
@@ -607,7 +618,11 @@
         var link = document.createElement("span");
         link.className = "node-link";
         this.decorateNodeLabel(node, link);
-        WebInspector.wireElementWithDOMNode(link, node.id);
+
+        link.addEventListener("click", this.revealAndSelectNode.bind(this, node.id), false);
+        link.addEventListener("mouseover", WebInspector.domAgent.highlightDOMNode.bind(WebInspector.domAgent, node.id, ""), false);
+        link.addEventListener("mouseout", WebInspector.domAgent.hideDOMNodeHighlight.bind(WebInspector.domAgent), false);
+
         return link;
     },
 
@@ -984,12 +999,21 @@
         this.treeOutline.updateSelection();
     },
 
-    updateFocusedNode: function(nodeId)
+    _inspectElementRequested: function(event)
     {
+        var node = event.data;
+        this.revealAndSelectNode(node.id);
+    },
+
+    revealAndSelectNode: function(nodeId)
+    {
+        WebInspector.setCurrentPanel(this);
+
         var node = WebInspector.domAgent.nodeForId(nodeId);
         if (!node)
             return;
 
+        WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId);
         this.selectDOMNode(node, true);
         if (this.nodeSearchButton.toggled) {
             InspectorFrontendHost.bringToFront();
@@ -997,14 +1021,14 @@
         }
     },
 
-    _setSearchingForNode: function(enabled)
-    {
-        this.nodeSearchButton.toggled = enabled;
-    },
-
     setSearchingForNode: function(enabled)
     {
-        DOMAgent.setInspectModeEnabled(enabled, WebInspector.buildHighlightConfig(), this._setSearchingForNode.bind(this, enabled));
+        function callback(error)
+        {
+            if (!error)
+                this.nodeSearchButton.toggled = enabled;
+        }
+        WebInspector.domAgent.setInspectModeEnabled(enabled, callback.bind(this));
     },
 
     toggleSearchingForNode: function()

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -34,8 +34,9 @@
  * @param {boolean=} omitRootDOMNode
  * @param {boolean=} selectEnabled
  * @param {boolean=} showInElementsPanelEnabled
+ * @param {function(WebInspector.ContextMenu, WebInspector.DOMNode)=} contextMenuCallback
  */
-WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled)
+WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled, contextMenuCallback)
 {
     this.element = document.createElement("ol");
     this.element.addEventListener("mousedown", this._onmousedown.bind(this), false);
@@ -60,6 +61,7 @@
     this._visible = false;
 
     this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
+    this._contextMenuCallback = contextMenuCallback;
 }
 
 WebInspector.ElementsTreeOutline.Events = {
@@ -304,7 +306,7 @@
                 element._createTooltipForNode();
         }
 
-        WebInspector.highlightDOMNode(element ? element.representedObject.id : 0);
+        WebInspector.domAgent.highlightDOMNode(element ? element.representedObject.id : 0);
     },
 
     _onmouseout: function(event)
@@ -318,7 +320,7 @@
             delete this._previousHoveredElement;
         }
 
-        WebInspector.highlightDOMNode(0);
+        WebInspector.domAgent.hideDOMNodeHighlight();
     },
 
     _ondragstart: function(event)
@@ -337,7 +339,7 @@
         event.dataTransfer.effectAllowed = "copyMove";
         this._nodeBeingDragged = treeElement.representedObject;
 
-        WebInspector.highlightDOMNode(0);
+        WebInspector.domAgent.hideDOMNodeHighlight();
 
         return true;
     },
@@ -448,7 +450,7 @@
 
         function focusElement()
         {
-            WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
+            WebInspector.domAgent.inspectElement(treeElement.representedObject.id);
         }
         var contextMenu = new WebInspector.ContextMenu();
         contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
@@ -487,6 +489,12 @@
     {
         if (this._elementsTreeUpdater)
             this._elementsTreeUpdater._updateModifiedNodes();
+    },
+
+    _populateContextMenu: function(contextMenu, node)
+    {
+        if (this._contextMenuCallback)
+            this._contextMenuCallback(contextMenu, node);
     }
 }
 
@@ -735,6 +743,9 @@
         this.updateChildren();
     },
 
+    /**
+     * @param {boolean=} fullRefresh
+     */
     updateChildren: function(fullRefresh)
     {
         if (this._elementCloseTag)
@@ -742,6 +753,9 @@
         this.representedObject.getChildNodes(this._updateChildren.bind(this, fullRefresh));
     },
 
+    /**
+     * @param {boolean=} closingTag
+     */
     insertChildElement: function(child, index, closingTag)
     {
         var newElement = new WebInspector.ElementsTreeElement(child, closingTag);
@@ -759,6 +773,9 @@
             child.select();
     },
 
+    /**
+     * @param {boolean=} fullRefresh
+     */
     _updateChildren: function(fullRefresh)
     {
         if (this._updateChildrenInProgress)
@@ -766,7 +783,7 @@
 
         this._updateChildrenInProgress = true;
         var selectedNode = this.treeOutline.selectedDOMNode();
-        var originalScrollTop;
+        var originalScrollTop = 0;
         if (fullRefresh) {
             var treeOutlineContainerElement = this.treeOutline.element.parentNode;
             originalScrollTop = treeOutlineContainerElement.scrollTop;
@@ -923,7 +940,7 @@
         this.treeOutline.suppressRevealAndSelect = true;
         this.treeOutline.selectDOMNode(this.representedObject, selectedByUser);
         if (selectedByUser)
-            WebInspector.highlightDOMNode(this.representedObject.id);
+            WebInspector.domAgent.highlightDOMNode(this.representedObject.id);
         this.updateSelection();
         this.treeOutline.suppressRevealAndSelect = false;
     },
@@ -1035,12 +1052,7 @@
         contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
         contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this));
 
-        if (Preferences.nativeInstrumentationEnabled) {
-            // Add debbuging-related actions
-            contextMenu.appendSeparator();
-            var pane = WebInspector.panels.elements.sidebarPanes.domBreakpoints;
-            pane.populateNodeContextMenu(this.representedObject, contextMenu);
-        }
+        this.treeOutline._populateContextMenu(contextMenu, this.representedObject);
     },
 
     _populateTextContextMenu: function(contextMenu, textNode)
@@ -1130,11 +1142,12 @@
         // Remove zero-width spaces that were added by nodeTitleInfo.
         removeZeroWidthSpaceRecursive(attribute);
 
-        this._editing = WebInspector.startEditing(attribute, {
-            context: attributeName,
-            commitHandler: this._attributeEditingCommitted.bind(this),
-            cancelHandler: this._editingCancelled.bind(this)
-        });
+        var config = new WebInspector.EditingConfig();
+        config.setContext(attributeName);
+        config.setCommitHandler(this._attributeEditingCommitted.bind(this));
+        config.setCancelHandler(this._editingCancelled.bind(this));
+        this._editing = WebInspector.startEditing(attribute, config);
+
         window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1);
 
         return true;
@@ -1145,11 +1158,11 @@
         if (WebInspector.isBeingEdited(textNode))
             return true;
 
-        this._editing = WebInspector.startEditing(textNode, {
-            context: null,
-            commitHandler: this._textNodeEditingCommitted.bind(this),
-            cancelHandler: this._editingCancelled.bind(this)
-        });
+        var config = new WebInspector.EditingConfig();
+        config.setCommitHandler(this._textNodeEditingCommitted.bind(this));
+        config.setCancelHandler(this._editingCancelled.bind(this));
+
+        this._editing = WebInspector.startEditing(textNode, config);
         window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1);
 
         return true;
@@ -1192,11 +1205,12 @@
 
         tagNameElement.addEventListener('keyup', keyupListener, false);
 
-        this._editing = WebInspector.startEditing(tagNameElement, {
-            context: tagName,
-            commitHandler: editingComitted.bind(this),
-            cancelHandler: editingCancelled.bind(this)
-        });
+        var config = new WebInspector.EditingConfig();
+        config.setContext(tagName);
+        config.setCommitHandler(editingComitted.bind(this));
+        config.setCancelHandler(editingCancelled.bind(this));
+
+        this._editing = WebInspector.startEditing(tagNameElement, config);
         window.getSelection().setBaseAndExtent(tagNameElement, 0, tagNameElement, 1);
         return true;
     },
@@ -1252,12 +1266,12 @@
             this.updateSelection();
         }
 
-        this._editing = WebInspector.startEditing(this._htmlEditElement, {
-            context: null,
-            commitHandler: commit.bind(this),
-            cancelHandler: dispose.bind(this),
-            multiline: true
-        });
+        var config = new WebInspector.EditingConfig();
+        config.setCommitHandler(commit.bind(this));
+        config.setCancelHandler(dispose.bind(this));
+        config.setMultiline(true);
+
+        this._editing = WebInspector.startEditing(this._htmlEditElement, config);
     },
 
     _attributeEditingCommitted: function(element, newText, oldText, attributeName, moveDirection)
@@ -1362,11 +1376,13 @@
                 return;
             }
 
+            var node = WebInspector.domAgent.nodeForId(nodeId);
+
             // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
             treeOutline._updateModifiedNodes();
+            treeOutline.selectDOMNode(node, true);
 
-            WebInspector.updateFocusedNode(nodeId);
-            var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
+            var newTreeItem = treeOutline.findTreeElement(node);
             if (wasExpanded)
                 newTreeItem.expand();
 
@@ -1417,6 +1433,9 @@
         return (tags.length === 1 ? null : tags[tags.length-1]);
     },
 
+    /**
+     * @param {boolean=} onlySearchQueryChanged
+     */
     updateTitle: function(onlySearchQueryChanged)
     {
         // If we are editing, return early to prevent canceling the edit.
@@ -1441,6 +1460,10 @@
         this._highlightSearchResults();
     },
 
+    /**
+     * @param {WebInspector.DOMNode=} node
+     * @param {function(string, string, string, boolean=, string=)=} linkify
+     */
     _buildAttributeDOM: function(parentElement, name, value, node, linkify)
     {
         var hasText = (value.length > 0);
@@ -1465,9 +1488,12 @@
             attrSpanElement.appendChild(document.createTextNode("\""));
     },
 
+    /**
+     * @param {function(string, string, string, boolean=, string=)=} linkify
+     */
     _buildTagDOM: function(parentElement, tagName, isClosingTag, isDistinctTreeElement, linkify)
     {
-        var node = this.representedObject;
+        var node = /** @type WebInspector.DOMNode */ this.representedObject;
         var classes = [ "webkit-html-tag" ];
         if (isClosingTag && isDistinctTreeElement)
             classes.push("close");
@@ -1525,7 +1551,7 @@
                         textNodeElement.textContent = "\u2026";
                         info.titleDOM.appendChild(document.createTextNode("\u200B"));
                     }
-                    this._buildTagDOM(info.titleDOM, tagName, true, false, false);
+                    this._buildTagDOM(info.titleDOM, tagName, true, false);
                 }
 
                 // If this element only has a single child that is a text node,
@@ -1646,12 +1672,13 @@
             if (error || !nodeId)
                 return;
 
+            var node = WebInspector.domAgent.nodeForId(nodeId);
             // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
             treeOutline._updateModifiedNodes();
+            treeOutline.selectDOMNode(node, true);
 
-            WebInspector.updateFocusedNode(nodeId);
             if (wasExpanded) {
-                var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
+                var newTreeItem = treeOutline.findTreeElement(node);
                 if (newTreeItem)
                     newTreeItem.expand();
             }
@@ -1713,7 +1740,6 @@
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.CharacterDataModified, this._characterDataModified, this);
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
-    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectElementRequested, this._inspectElementRequested, this);
 
     this._treeOutline = treeOutline;
     this._recentlyModifiedNodes = [];
@@ -1767,12 +1793,6 @@
             treeElement.hasChildren = event.data.hasChildNodes();
     },
 
-    _inspectElementRequested: function(event)
-    {
-        var node = event.data;
-        WebInspector.updateFocusedNode(node.id);
-    },
-
     _updateModifiedNodesSoon: function()
     {
         if (this._updateModifiedNodesTimeout)
@@ -1821,7 +1841,7 @@
     {
         this._treeOutline.rootDOMNode = null;
         this._treeOutline.selectDOMNode(null, false);
-        WebInspector.highlightDOMNode(0);
+        WebInspector.domAgent.hideDOMNodeHighlight();
         this._recentlyModifiedNodes = [];
     }
 }

Modified: trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -108,10 +108,10 @@
             if (this._highlightMode === mode)
                 return;
             this._highlightMode = mode;
-            WebInspector.highlightDOMNode(nodeId, mode);
+            WebInspector.domAgent.highlightDOMNode(nodeId, mode);
         } else {
             delete this._highlightMode;
-            WebInspector.highlightDOMNode(0, "");
+            WebInspector.domAgent.hideDOMNodeHighlight();
         }
 
         for (var i = 0; this._boxElements && i < this._boxElements.length; ++i) {
@@ -419,8 +419,7 @@
                 self.originalPropertyData = self.previousPropertyDataCandidate;
 
             if (typeof self._highlightMode !== "undefined") {
-                WebInspector.highlightDOMNode(0, "");
-                WebInspector.highlightDOMNode(self.node.id, self._highlightMode);
+                WebInspector.domAgent.highlightDOMNode(self.node.id, self._highlightMode);
             }
 
             if (commitEditor) {

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -106,17 +106,6 @@
 }
 
 /**
- * @constructor
- * @extends {TreeOutline}
- * @param {boolean=} omitRootDOMNode
- * @param {boolean=} selectEnabled
- * @param {boolean=} showInElementsPanelEnabled
- */
-WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled)
-{
-}
-
-/**
  * @param {NetworkAgent.RequestId} requestId
  * @return {?WebInspector.Resource}
  */
@@ -202,3 +191,5 @@
  * @param {boolean=} showConsole
  */
 WebInspector.log = function(message, messageLevel, showConsole) {}
+
+WebInspector.resourceURLForRelatedNode = function(node, url) {}

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (96804 => 96805)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-10-06 13:04:45 UTC (rev 96804)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-10-06 13:14:22 UTC (rev 96805)
@@ -364,58 +364,6 @@
             errorWarningElement.title = null;
     },
 
-    buildHighlightConfig: function(mode)
-    {
-        mode = mode || "all";
-        var highlightConfig = { showInfo: mode === "all" };
-        if (mode === "all" || mode === "content")
-            highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();
-
-        if (mode === "all" || mode === "padding")
-            highlightConfig.paddingColor = WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();
-
-        if (mode === "all" || mode === "border")
-            highlightConfig.borderColor = WebInspector.Color.PageHighlight.Border.toProtocolRGBA();
-
-        if (mode === "all" || mode === "margin")
-            highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();
-
-        return highlightConfig;
-    },
-
-    highlightDOMNode: function(nodeId, mode)
-    {
-        if ("_hideDOMNodeHighlightTimeout" in this) {
-            clearTimeout(this._hideDOMNodeHighlightTimeout);
-            delete this._hideDOMNodeHighlightTimeout;
-        }
-
-        this._highlightedDOMNodeId = nodeId;
-        if (nodeId)
-            DOMAgent.highlightNode(nodeId, this.buildHighlightConfig(mode));
-        else
-            DOMAgent.hideHighlight();
-    },
-
-    highlightDOMNodeForTwoSeconds: function(nodeId)
-    {
-        this.highlightDOMNode(nodeId);
-        this._hideDOMNodeHighlightTimeout = setTimeout(this.highlightDOMNode.bind(this, 0), 2000);
-    },
-
-    wireElementWithDOMNode: function(element, nodeId)
-    {
-        element.addEventListener("click", this._updateFocusedNode.bind(this, nodeId), false);
-        element.addEventListener("mouseover", this.highlightDOMNode.bind(this, nodeId, "all"), false);
-        element.addEventListener("mouseout", this.highlightDOMNode.bind(this, 0), false);
-    },
-
-    _updateFocusedNode: function(nodeId)
-    {
-        this.setCurrentPanel(this.panels.elements);
-        this.panels.elements.updateFocusedNode(nodeId);
-    },
-
     networkResourceById: function(id)
     {
         return this.panels.network.resourceById(id);
@@ -930,7 +878,7 @@
             panel.reset();
     }
 
-    this.highlightDOMNode(0);
+    this.domAgent.hideDOMNodeHighlight();
 
     if (!WebInspector.settings.preserveConsoleLog.get())
         this.console.clearMessages();
@@ -1071,8 +1019,7 @@
 
 WebInspector.updateFocusedNode = function(nodeId)
 {
-    this._updateFocusedNode(nodeId);
-    this.highlightDOMNodeForTwoSeconds(nodeId);
+    this.panels.elements.revealAndSelectNode(nodeId);
 }
 
 WebInspector.displayNameForURL = function(url)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to