Changeset 96805 in webkit


Ignore:
Timestamp:
Oct 6, 2011, 6:14:22 AM (14 years ago)
Author:
pfeldman@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96804 r96805  
     12011-10-05  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: make ElementsTreeOutline compile
     4        https://bugs.webkit.org/show_bug.cgi?id=69439
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/compile-front-end.sh:
     9        * inspector/front-end/DOMAgent.js:
     10        * inspector/front-end/DOMSyntaxHighlighter.js:
     11        * inspector/front-end/ElementsPanel.js:
     12        (WebInspector.ElementsPanel.get this):
     13        (WebInspector.ElementsPanel):
     14        (WebInspector.ElementsPanel.prototype._populateContextMenu):
     15        (WebInspector.ElementsPanel.prototype._inspectElementRequested):
     16        * inspector/front-end/ElementsTreeOutline.js:
     17        (WebInspector.ElementsTreeOutline):
     18        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired.focusElement):
     19        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
     20        (WebInspector.ElementsTreeOutline.prototype._updateModifiedNodes):
     21        (WebInspector.ElementsTreeOutline.prototype._populateContextMenu):
     22        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
     23        (WebInspector.ElementsTreeElement.prototype._startEditingAttribute):
     24        (WebInspector.ElementsTreeElement.prototype._startEditingTextNode):
     25        (WebInspector.ElementsTreeElement.prototype._startEditingTagName):
     26        (WebInspector.ElementsTreeElement.prototype._startEditingAsHTML):
     27        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
     28        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
     29        ():
     30        * inspector/front-end/externs.js:
     31        (WebInspector.highlightDOMNode):
     32        (WebInspector.resourceURLForRelatedNode):
     33
    1342011-10-06  Pavel Feldman  <pfeldman@google.com>
    235
  • trunk/Source/WebCore/inspector/compile-front-end.sh

    r96695 r96805  
    6969        --js Source/WebCore/inspector/front-end/NetworkManager.js \
    7070        --js Source/WebCore/inspector/front-end/UISourceCode.js \
    71     --module jsmodule_ui:28:jsmodule_common \
     71    --module jsmodule_ui:29:jsmodule_common \
    7272        --js Source/WebCore/inspector/front-end/Checkbox.js \
    7373        --js Source/WebCore/inspector/front-end/Color.js \
    7474        --js Source/WebCore/inspector/front-end/ContextMenu.js \
    7575        --js Source/WebCore/inspector/front-end/CookiesTable.js \
     76        --js Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js \
    7677        --js Source/WebCore/inspector/front-end/DataGrid.js \
    7778        --js Source/WebCore/inspector/front-end/Drawer.js \
     
    9899        --js Source/WebCore/inspector/front-end/UIUtils.js \
    99100        --js Source/WebCore/inspector/front-end/View.js \
    100     --module jsmodule_inspector:18:jsmodule_sdk,jsmodule_ui \
     101    --module jsmodule_inspector:19:jsmodule_sdk,jsmodule_ui \
    101102        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
    102103        --js Source/WebCore/inspector/front-end/ConsoleView.js \
     104        --js Source/WebCore/inspector/front-end/ElementsTreeOutline.js \
    103105        --js Source/WebCore/inspector/front-end/FontView.js \
    104106        --js Source/WebCore/inspector/front-end/ImageView.js \
  • trunk/Source/WebCore/inspector/front-end/DOMAgent.js

    r96604 r96805  
    618618    },
    619619
     620    /**
     621     * @param {number} nodeId
     622     */
    620623    inspectElement: function(nodeId)
    621624    {
     
    645648    {
    646649        DOMAgent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(callback));
     650    },
     651
     652    /**
     653     * @param {?number} nodeId
     654     * @param {string=} mode
     655     */
     656    highlightDOMNode: function(nodeId, mode)
     657    {
     658        if (this._hideDOMNodeHighlightTimeout) {
     659            clearTimeout(this._hideDOMNodeHighlightTimeout);
     660            delete this._hideDOMNodeHighlightTimeout;
     661        }
     662
     663        this._highlightedDOMNodeId = nodeId;
     664        if (nodeId)
     665            DOMAgent.highlightNode(nodeId, this._buildHighlightConfig(mode));
     666        else
     667            DOMAgent.hideHighlight();
     668    },
     669
     670    hideDOMNodeHighlight: function()
     671    {
     672        this.highlightDOMNode(0);
     673    },
     674
     675    highlightDOMNodeForTwoSeconds: function(nodeId)
     676    {
     677        this.highlightDOMNode(nodeId);
     678        this._hideDOMNodeHighlightTimeout = setTimeout(this.hideDOMNodeHighlight.bind(this), 2000);
     679    },
     680
     681    setInspectModeEnabled: function(enabled, callback)
     682    {
     683        DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), callback);
     684    },
     685
     686    /**
     687     * @param {string=} mode
     688     */
     689    _buildHighlightConfig: function(mode)
     690    {
     691        mode = mode || "all";
     692        var highlightConfig = { showInfo: mode === "all" };
     693        if (mode === "all" || mode === "content")
     694            highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();
     695
     696        if (mode === "all" || mode === "padding")
     697            highlightConfig.paddingColor = WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();
     698
     699        if (mode === "all" || mode === "border")
     700            highlightConfig.borderColor = WebInspector.Color.PageHighlight.Border.toProtocolRGBA();
     701
     702        if (mode === "all" || mode === "margin")
     703            highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();
     704
     705        return highlightConfig;
    647706    }
    648707}
  • trunk/Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js

    r87294 r96805  
    2929 */
    3030
     31/**
     32 * @constructor
     33 */
    3134WebInspector.DOMSyntaxHighlighter = function(mimeType, stripExtraWhitespace)
    3235{
  • trunk/Source/WebCore/inspector/front-end/ElementsPanel.js

    r96711 r96805  
    4242    this.contentElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
    4343
    44     this.treeOutline = new WebInspector.ElementsTreeOutline(true, true);
     44    this.treeOutline = new WebInspector.ElementsTreeOutline(true, true, false, this._populateContextMenu.bind(this));
    4545    this.treeOutline.wireToDomAgent();
    4646
     
    9898    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved, this._nodeRemoved, this);
    9999    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
     100    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectElementRequested, this._inspectElementRequested, this);
    100101}
    101102
     
    137138        WebInspector.Panel.prototype.hide.call(this);
    138139
    139         WebInspector.highlightDOMNode(0);
     140        WebInspector.domAgent.hideDOMNodeHighlight();
    140141        this.setSearchingForNode(false);
    141142        this.treeOutline.setVisible(false);
     
    285286        WebInspector.setCurrentPanel(this);
    286287        this.selectDOMNode(node, true);
     288    },
     289
     290    _populateContextMenu: function(contextMenu, node)
     291    {
     292        if (Preferences.nativeInstrumentationEnabled) {
     293            // Add debbuging-related actions
     294            contextMenu.appendSeparator();
     295            var pane = this.sidebarPanes.domBreakpoints;
     296            pane.populateNodeContextMenu(node, contextMenu);
     297        }
    287298    },
    288299
     
    415426        var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");
    416427
    417         WebInspector.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
     428        WebInspector.domAgent.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
    418429
    419430        if ("_mouseOutOfCrumbsTimeout" in this) {
     
    429440            return;
    430441
    431         WebInspector.highlightDOMNode(0);
     442        WebInspector.domAgent.hideDOMNodeHighlight();
    432443
    433444        this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000);
     
    608619        link.className = "node-link";
    609620        this.decorateNodeLabel(node, link);
    610         WebInspector.wireElementWithDOMNode(link, node.id);
     621
     622        link.addEventListener("click", this.revealAndSelectNode.bind(this, node.id), false);
     623        link.addEventListener("mouseover", WebInspector.domAgent.highlightDOMNode.bind(WebInspector.domAgent, node.id, ""), false);
     624        link.addEventListener("mouseout", WebInspector.domAgent.hideDOMNodeHighlight.bind(WebInspector.domAgent), false);
     625
    611626        return link;
    612627    },
     
    9851000    },
    9861001
    987     updateFocusedNode: function(nodeId)
    988     {
     1002    _inspectElementRequested: function(event)
     1003    {
     1004        var node = event.data;
     1005        this.revealAndSelectNode(node.id);
     1006    },
     1007
     1008    revealAndSelectNode: function(nodeId)
     1009    {
     1010        WebInspector.setCurrentPanel(this);
     1011
    9891012        var node = WebInspector.domAgent.nodeForId(nodeId);
    9901013        if (!node)
    9911014            return;
    9921015
     1016        WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId);
    9931017        this.selectDOMNode(node, true);
    9941018        if (this.nodeSearchButton.toggled) {
     
    9981022    },
    9991023
    1000     _setSearchingForNode: function(enabled)
    1001     {
    1002         this.nodeSearchButton.toggled = enabled;
    1003     },
    1004 
    10051024    setSearchingForNode: function(enabled)
    10061025    {
    1007         DOMAgent.setInspectModeEnabled(enabled, WebInspector.buildHighlightConfig(), this._setSearchingForNode.bind(this, enabled));
     1026        function callback(error)
     1027        {
     1028            if (!error)
     1029                this.nodeSearchButton.toggled = enabled;
     1030        }
     1031        WebInspector.domAgent.setInspectModeEnabled(enabled, callback.bind(this));
    10081032    },
    10091033
  • trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js

    r96711 r96805  
    3535 * @param {boolean=} selectEnabled
    3636 * @param {boolean=} showInElementsPanelEnabled
     37 * @param {function(WebInspector.ContextMenu, WebInspector.DOMNode)=} contextMenuCallback
    3738 */
    38 WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled)
     39WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled, contextMenuCallback)
    3940{
    4041    this.element = document.createElement("ol");
     
    6162
    6263    this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
     64    this._contextMenuCallback = contextMenuCallback;
    6365}
    6466
     
    305307        }
    306308
    307         WebInspector.highlightDOMNode(element ? element.representedObject.id : 0);
     309        WebInspector.domAgent.highlightDOMNode(element ? element.representedObject.id : 0);
    308310    },
    309311
     
    319321        }
    320322
    321         WebInspector.highlightDOMNode(0);
     323        WebInspector.domAgent.hideDOMNodeHighlight();
    322324    },
    323325
     
    338340        this._nodeBeingDragged = treeElement.representedObject;
    339341
    340         WebInspector.highlightDOMNode(0);
     342        WebInspector.domAgent.hideDOMNodeHighlight();
    341343
    342344        return true;
     
    449451        function focusElement()
    450452        {
    451             WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
     453            WebInspector.domAgent.inspectElement(treeElement.representedObject.id);
    452454        }
    453455        var contextMenu = new WebInspector.ContextMenu();
     
    488490        if (this._elementsTreeUpdater)
    489491            this._elementsTreeUpdater._updateModifiedNodes();
     492    },
     493
     494    _populateContextMenu: function(contextMenu, node)
     495    {
     496        if (this._contextMenuCallback)
     497            this._contextMenuCallback(contextMenu, node);
    490498    }
    491499}
     
    736744    },
    737745
     746    /**
     747     * @param {boolean=} fullRefresh
     748     */
    738749    updateChildren: function(fullRefresh)
    739750    {
     
    743754    },
    744755
     756    /**
     757     * @param {boolean=} closingTag
     758     */
    745759    insertChildElement: function(child, index, closingTag)
    746760    {
     
    760774    },
    761775
     776    /**
     777     * @param {boolean=} fullRefresh
     778     */
    762779    _updateChildren: function(fullRefresh)
    763780    {
     
    767784        this._updateChildrenInProgress = true;
    768785        var selectedNode = this.treeOutline.selectedDOMNode();
    769         var originalScrollTop;
     786        var originalScrollTop = 0;
    770787        if (fullRefresh) {
    771788            var treeOutlineContainerElement = this.treeOutline.element.parentNode;
     
    924941        this.treeOutline.selectDOMNode(this.representedObject, selectedByUser);
    925942        if (selectedByUser)
    926             WebInspector.highlightDOMNode(this.representedObject.id);
     943            WebInspector.domAgent.highlightDOMNode(this.representedObject.id);
    927944        this.updateSelection();
    928945        this.treeOutline.suppressRevealAndSelect = false;
     
    10361053        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this));
    10371054
    1038         if (Preferences.nativeInstrumentationEnabled) {
    1039             // Add debbuging-related actions
    1040             contextMenu.appendSeparator();
    1041             var pane = WebInspector.panels.elements.sidebarPanes.domBreakpoints;
    1042             pane.populateNodeContextMenu(this.representedObject, contextMenu);
    1043         }
     1055        this.treeOutline._populateContextMenu(contextMenu, this.representedObject);
    10441056    },
    10451057
     
    11311143        removeZeroWidthSpaceRecursive(attribute);
    11321144
    1133         this._editing = WebInspector.startEditing(attribute, {
    1134             context: attributeName,
    1135             commitHandler: this._attributeEditingCommitted.bind(this),
    1136             cancelHandler: this._editingCancelled.bind(this)
    1137         });
     1145        var config = new WebInspector.EditingConfig();
     1146        config.setContext(attributeName);
     1147        config.setCommitHandler(this._attributeEditingCommitted.bind(this));
     1148        config.setCancelHandler(this._editingCancelled.bind(this));
     1149        this._editing = WebInspector.startEditing(attribute, config);
     1150
    11381151        window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1);
    11391152
     
    11461159            return true;
    11471160
    1148         this._editing = WebInspector.startEditing(textNode, {
    1149             context: null,
    1150             commitHandler: this._textNodeEditingCommitted.bind(this),
    1151             cancelHandler: this._editingCancelled.bind(this)
    1152         });
     1161        var config = new WebInspector.EditingConfig();
     1162        config.setCommitHandler(this._textNodeEditingCommitted.bind(this));
     1163        config.setCancelHandler(this._editingCancelled.bind(this));
     1164
     1165        this._editing = WebInspector.startEditing(textNode, config);
    11531166        window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1);
    11541167
     
    11931206        tagNameElement.addEventListener('keyup', keyupListener, false);
    11941207
    1195         this._editing = WebInspector.startEditing(tagNameElement, {
    1196             context: tagName,
    1197             commitHandler: editingComitted.bind(this),
    1198             cancelHandler: editingCancelled.bind(this)
    1199         });
     1208        var config = new WebInspector.EditingConfig();
     1209        config.setContext(tagName);
     1210        config.setCommitHandler(editingComitted.bind(this));
     1211        config.setCancelHandler(editingCancelled.bind(this));
     1212
     1213        this._editing = WebInspector.startEditing(tagNameElement, config);
    12001214        window.getSelection().setBaseAndExtent(tagNameElement, 0, tagNameElement, 1);
    12011215        return true;
     
    12531267        }
    12541268
    1255         this._editing = WebInspector.startEditing(this._htmlEditElement, {
    1256             context: null,
    1257             commitHandler: commit.bind(this),
    1258             cancelHandler: dispose.bind(this),
    1259             multiline: true
    1260         });
     1269        var config = new WebInspector.EditingConfig();
     1270        config.setCommitHandler(commit.bind(this));
     1271        config.setCancelHandler(dispose.bind(this));
     1272        config.setMultiline(true);
     1273
     1274        this._editing = WebInspector.startEditing(this._htmlEditElement, config);
    12611275    },
    12621276
     
    13631377            }
    13641378
     1379            var node = WebInspector.domAgent.nodeForId(nodeId);
     1380
    13651381            // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
    13661382            treeOutline._updateModifiedNodes();
    1367 
    1368             WebInspector.updateFocusedNode(nodeId);
    1369             var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
     1383            treeOutline.selectDOMNode(node, true);
     1384
     1385            var newTreeItem = treeOutline.findTreeElement(node);
    13701386            if (wasExpanded)
    13711387                newTreeItem.expand();
     
    14181434    },
    14191435
     1436    /**
     1437     * @param {boolean=} onlySearchQueryChanged
     1438     */
    14201439    updateTitle: function(onlySearchQueryChanged)
    14211440    {
     
    14421461    },
    14431462
     1463    /**
     1464     * @param {WebInspector.DOMNode=} node
     1465     * @param {function(string, string, string, boolean=, string=)=} linkify
     1466     */
    14441467    _buildAttributeDOM: function(parentElement, name, value, node, linkify)
    14451468    {
     
    14661489    },
    14671490
     1491    /**
     1492     * @param {function(string, string, string, boolean=, string=)=} linkify
     1493     */
    14681494    _buildTagDOM: function(parentElement, tagName, isClosingTag, isDistinctTreeElement, linkify)
    14691495    {
    1470         var node = this.representedObject;
     1496        var node = /** @type WebInspector.DOMNode */ this.representedObject;
    14711497        var classes = [ "webkit-html-tag" ];
    14721498        if (isClosingTag && isDistinctTreeElement)
     
    15261552                        info.titleDOM.appendChild(document.createTextNode("\u200B"));
    15271553                    }
    1528                     this._buildTagDOM(info.titleDOM, tagName, true, false, false);
     1554                    this._buildTagDOM(info.titleDOM, tagName, true, false);
    15291555                }
    15301556
     
    16471673                return;
    16481674
     1675            var node = WebInspector.domAgent.nodeForId(nodeId);
    16491676            // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
    16501677            treeOutline._updateModifiedNodes();
    1651 
    1652             WebInspector.updateFocusedNode(nodeId);
     1678            treeOutline.selectDOMNode(node, true);
     1679
    16531680            if (wasExpanded) {
    1654                 var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
     1681                var newTreeItem = treeOutline.findTreeElement(node);
    16551682                if (newTreeItem)
    16561683                    newTreeItem.expand();
     
    17141741    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
    17151742    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
    1716     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectElementRequested, this._inspectElementRequested, this);
    17171743
    17181744    this._treeOutline = treeOutline;
     
    17661792        if (treeElement)
    17671793            treeElement.hasChildren = event.data.hasChildNodes();
    1768     },
    1769 
    1770     _inspectElementRequested: function(event)
    1771     {
    1772         var node = event.data;
    1773         WebInspector.updateFocusedNode(node.id);
    17741794    },
    17751795
     
    18221842        this._treeOutline.rootDOMNode = null;
    18231843        this._treeOutline.selectDOMNode(null, false);
    1824         WebInspector.highlightDOMNode(0);
     1844        WebInspector.domAgent.hideDOMNodeHighlight();
    18251845        this._recentlyModifiedNodes = [];
    18261846    }
  • trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js

    r96106 r96805  
    109109                return;
    110110            this._highlightMode = mode;
    111             WebInspector.highlightDOMNode(nodeId, mode);
     111            WebInspector.domAgent.highlightDOMNode(nodeId, mode);
    112112        } else {
    113113            delete this._highlightMode;
    114             WebInspector.highlightDOMNode(0, "");
     114            WebInspector.domAgent.hideDOMNodeHighlight();
    115115        }
    116116
     
    420420
    421421            if (typeof self._highlightMode !== "undefined") {
    422                 WebInspector.highlightDOMNode(0, "");
    423                 WebInspector.highlightDOMNode(self.node.id, self._highlightMode);
     422                WebInspector.domAgent.highlightDOMNode(self.node.id, self._highlightMode);
    424423            }
    425424
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r96711 r96805  
    107107
    108108/**
    109  * @constructor
    110  * @extends {TreeOutline}
    111  * @param {boolean=} omitRootDOMNode
    112  * @param {boolean=} selectEnabled
    113  * @param {boolean=} showInElementsPanelEnabled
    114  */
    115 WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled)
    116 {
    117 }
    118 
    119 /**
    120109 * @param {NetworkAgent.RequestId} requestId
    121110 * @return {?WebInspector.Resource}
     
    203192 */
    204193WebInspector.log = function(message, messageLevel, showConsole) {}
     194
     195WebInspector.resourceURLForRelatedNode = function(node, url) {}
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r96695 r96805  
    365365    },
    366366
    367     buildHighlightConfig: function(mode)
    368     {
    369         mode = mode || "all";
    370         var highlightConfig = { showInfo: mode === "all" };
    371         if (mode === "all" || mode === "content")
    372             highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();
    373 
    374         if (mode === "all" || mode === "padding")
    375             highlightConfig.paddingColor = WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();
    376 
    377         if (mode === "all" || mode === "border")
    378             highlightConfig.borderColor = WebInspector.Color.PageHighlight.Border.toProtocolRGBA();
    379 
    380         if (mode === "all" || mode === "margin")
    381             highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();
    382 
    383         return highlightConfig;
    384     },
    385 
    386     highlightDOMNode: function(nodeId, mode)
    387     {
    388         if ("_hideDOMNodeHighlightTimeout" in this) {
    389             clearTimeout(this._hideDOMNodeHighlightTimeout);
    390             delete this._hideDOMNodeHighlightTimeout;
    391         }
    392 
    393         this._highlightedDOMNodeId = nodeId;
    394         if (nodeId)
    395             DOMAgent.highlightNode(nodeId, this.buildHighlightConfig(mode));
    396         else
    397             DOMAgent.hideHighlight();
    398     },
    399 
    400     highlightDOMNodeForTwoSeconds: function(nodeId)
    401     {
    402         this.highlightDOMNode(nodeId);
    403         this._hideDOMNodeHighlightTimeout = setTimeout(this.highlightDOMNode.bind(this, 0), 2000);
    404     },
    405 
    406     wireElementWithDOMNode: function(element, nodeId)
    407     {
    408         element.addEventListener("click", this._updateFocusedNode.bind(this, nodeId), false);
    409         element.addEventListener("mouseover", this.highlightDOMNode.bind(this, nodeId, "all"), false);
    410         element.addEventListener("mouseout", this.highlightDOMNode.bind(this, 0), false);
    411     },
    412 
    413     _updateFocusedNode: function(nodeId)
    414     {
    415         this.setCurrentPanel(this.panels.elements);
    416         this.panels.elements.updateFocusedNode(nodeId);
    417     },
    418 
    419367    networkResourceById: function(id)
    420368    {
     
    931879    }
    932880
    933     this.highlightDOMNode(0);
     881    this.domAgent.hideDOMNodeHighlight();
    934882
    935883    if (!WebInspector.settings.preserveConsoleLog.get())
     
    10721020WebInspector.updateFocusedNode = function(nodeId)
    10731021{
    1074     this._updateFocusedNode(nodeId);
    1075     this.highlightDOMNodeForTwoSeconds(nodeId);
     1022    this.panels.elements.revealAndSelectNode(nodeId);
    10761023}
    10771024
Note: See TracChangeset for help on using the changeset viewer.