Changeset 91179 in webkit


Ignore:
Timestamp:
Jul 18, 2011, 6:18:08 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: "Reveal in Elements Panel" is broken.
https://bugs.webkit.org/show_bug.cgi?id=64688

Reviewed by Yury Semikhatsky.

  • inspector/front-end/ElementsTreeOutline.js:

(WebInspector.ElementsTreeOutline):
(WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired.focusElement):
(WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
(WebInspector.ElementsTreeOutline.prototype.populateContextMenu):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91178 r91179  
     12011-07-18  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: "Reveal in Elements Panel" is broken.
     4        https://bugs.webkit.org/show_bug.cgi?id=64688
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/front-end/ElementsTreeOutline.js:
     9        (WebInspector.ElementsTreeOutline):
     10        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired.focusElement):
     11        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
     12        (WebInspector.ElementsTreeOutline.prototype.populateContextMenu):
     13
    1142011-07-18  Julien Chaffraix  <jchaffraix@webkit.org>
    215
  • trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js

    r90626 r91179  
    4747    this.rootDOMNode = null;
    4848    this.focusedDOMNode = null;
     49    this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
    4950}
    5051
     
    380381    },
    381382
     383    _contextMenuEventFired: function(event)
     384    {
     385        if (!this.showInElementsPanelEnabled)
     386            return;
     387
     388        var treeElement = this._treeElementFromEvent(event);
     389        if (!treeElement)
     390            return;
     391
     392        function focusElement()
     393        {
     394            WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
     395        }
     396        var contextMenu = new WebInspector.ContextMenu();
     397        contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
     398        contextMenu.show(event);
     399    },
     400
    382401    populateContextMenu: function(contextMenu, event)
    383402    {
     
    387406
    388407        var populated;
    389         if (this.showInElementsPanelEnabled) {
    390             function focusElement()
    391             {
    392                 WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
    393             }
    394             contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
     408        var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
     409        var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
     410        var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
     411        if (href)
     412            populated = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
     413        if (tag && treeElement._populateTagContextMenu) {
     414            if (populated)
     415                contextMenu.appendSeparator();
     416            treeElement._populateTagContextMenu(contextMenu, event);
    395417            populated = true;
    396         } else {
    397             var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
    398             var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
    399             var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
    400             if (href)
    401                 populated = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
    402             if (tag && treeElement._populateTagContextMenu) {
    403                 if (populated)
    404                     contextMenu.appendSeparator();
    405                 treeElement._populateTagContextMenu(contextMenu, event);
    406                 populated = true;
    407             } else if (textNode && treeElement._populateTextContextMenu) {
    408                 if (populated)
    409                     contextMenu.appendSeparator();
    410                 treeElement._populateTextContextMenu(contextMenu, textNode);
    411                 populated = true;
    412             }
     418        } else if (textNode && treeElement._populateTextContextMenu) {
     419            if (populated)
     420                contextMenu.appendSeparator();
     421            treeElement._populateTextContextMenu(contextMenu, textNode);
     422            populated = true;
    413423        }
    414424
Note: See TracChangeset for help on using the changeset viewer.