Title: [91179] trunk/Source/WebCore
Revision
91179
Author
[email protected]
Date
2011-07-18 06:18:08 -0700 (Mon, 18 Jul 2011)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91178 => 91179)


--- trunk/Source/WebCore/ChangeLog	2011-07-18 12:40:35 UTC (rev 91178)
+++ trunk/Source/WebCore/ChangeLog	2011-07-18 13:18:08 UTC (rev 91179)
@@ -1,3 +1,16 @@
+2011-07-18  Pavel Feldman  <[email protected]>
+
+        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):
+
 2011-07-18  Julien Chaffraix  <[email protected]>
 
         Remove RenderObject::addLayers second argument

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


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-07-18 12:40:35 UTC (rev 91178)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-07-18 13:18:08 UTC (rev 91179)
@@ -46,6 +46,7 @@
     this.showInElementsPanelEnabled = false;
     this.rootDOMNode = null;
     this.focusedDOMNode = null;
+    this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
 }
 
 WebInspector.ElementsTreeOutline.prototype = {
@@ -379,6 +380,24 @@
         }
     },
 
+    _contextMenuEventFired: function(event)
+    {
+        if (!this.showInElementsPanelEnabled)
+            return;
+
+        var treeElement = this._treeElementFromEvent(event);
+        if (!treeElement)
+            return;
+
+        function focusElement()
+        {
+            WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
+        }
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
+        contextMenu.show(event);
+    },
+
     populateContextMenu: function(contextMenu, event)
     {
         var treeElement = this._treeElementFromEvent(event);
@@ -386,30 +405,21 @@
             return false;
 
         var populated;
-        if (this.showInElementsPanelEnabled) {
-            function focusElement()
-            {
-                WebInspector.panels.elements.switchToAndFocus(treeElement.representedObject);
-            }
-            contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
+        var href = "" || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
+        var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
+        var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
+        if (href)
+            populated = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
+        if (tag && treeElement._populateTagContextMenu) {
+            if (populated)
+                contextMenu.appendSeparator();
+            treeElement._populateTagContextMenu(contextMenu, event);
             populated = true;
-        } else {
-            var href = "" || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
-            var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
-            var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
-            if (href)
-                populated = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
-            if (tag && treeElement._populateTagContextMenu) {
-                if (populated)
-                    contextMenu.appendSeparator();
-                treeElement._populateTagContextMenu(contextMenu, event);
-                populated = true;
-            } else if (textNode && treeElement._populateTextContextMenu) {
-                if (populated)
-                    contextMenu.appendSeparator();
-                treeElement._populateTextContextMenu(contextMenu, textNode);
-                populated = true;
-            }
+        } else if (textNode && treeElement._populateTextContextMenu) {
+            if (populated)
+                contextMenu.appendSeparator();
+            treeElement._populateTextContextMenu(contextMenu, textNode);
+            populated = true;
         }
 
         return populated;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to