Title: [93035] trunk/Source/WebCore
Revision
93035
Author
[email protected]
Date
2011-08-15 02:26:41 -0700 (Mon, 15 Aug 2011)

Log Message

Web Inspector: context menu on the link in the console does not have standard link options.
https://bugs.webkit.org/show_bug.cgi?id=66214

Patch by Pavel Feldman <[email protected]> on 2011-08-15
Reviewed by Yury Semikhatsky.

* English.lproj/localizedStrings.js:
* inspector/front-end/ConsoleView.js:
* inspector/front-end/ElementsPanel.js:
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype.populateContextMenu):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._contextMenu):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._contextMenuEventFired):
* inspector/front-end/inspector.js:
(WebInspector.openLinkExternallyLabel):
(WebInspector.copyLinkAddressLabel):
(WebInspector.populateHrefContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93034 => 93035)


--- trunk/Source/WebCore/ChangeLog	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/ChangeLog	2011-08-15 09:26:41 UTC (rev 93035)
@@ -1,3 +1,24 @@
+2011-08-15  Pavel Feldman  <[email protected]>
+
+        Web Inspector: context menu on the link in the console does not have standard link options.
+        https://bugs.webkit.org/show_bug.cgi?id=66214
+
+        Reviewed by Yury Semikhatsky.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ConsoleView.js:
+        * inspector/front-end/ElementsPanel.js:
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline.prototype.populateContextMenu):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype._contextMenu):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype._contextMenuEventFired):
+        * inspector/front-end/inspector.js:
+        (WebInspector.openLinkExternallyLabel):
+        (WebInspector.copyLinkAddressLabel):
+        (WebInspector.populateHrefContextMenu):
+
 2011-08-14  Pavel Feldman  <[email protected]>
 
         Web Inspector: showContextMenu missing in Remote DevTools

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (93034 => 93035)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -530,6 +530,9 @@
 
         var contextMenu = new WebInspector.ContextMenu();
 
+        if (WebInspector.populateHrefContextMenu(contextMenu, null, event))
+            contextMenu.appendSeparator();
+
         function monitoringXHRItemAction()
         {
             WebInspector.settings.monitoringXHREnabled.set(!WebInspector.settings.monitoringXHREnabled.get());

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


--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -293,22 +293,6 @@
             treeElement.updateSelection(); // Recalculate selection highlight dimensions.
     },
 
-    populateHrefContextMenu: function(contextMenu, event, anchorElement)
-    {
-        if (!anchorElement.href)
-            return false;
-
-        var resourceURL = WebInspector.resourceURLForRelatedNode(this.selectedDOMNode(), anchorElement.href);
-        if (!resourceURL)
-            return false;
-
-        // Add resource-related actions.
-        contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, resourceURL, false));
-        if (WebInspector.resourceForURL(resourceURL))
-            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in Resources panel" : "Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true));
-        return true;
-    },
-
     switchToAndFocus: function(node)
     {
         // Reset search restore.

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


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -402,12 +402,9 @@
         if (!treeElement)
             return false;
 
-        var populated;
-        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);
+        var populated = WebInspector.populateHrefContextMenu(contextMenu, this.selectedDOMNode(), event);
         if (tag && treeElement._populateTagContextMenu) {
             if (populated)
                 contextMenu.appendSeparator();

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (93034 => 93035)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -985,7 +985,7 @@
         if (resource) {
             contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, resource.url, false));
             contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy location" : "Copy Location"), this._copyLocation.bind(this, resource));
+            contextMenu.appendItem(WebInspector.copyLinkAddressLabel(), this._copyLocation.bind(this, resource));
             if (resource.requestHeadersText)
                 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy request headers" : "Copy Request Headers"), this._copyRequestHeaders.bind(this, resource));
             if (resource.responseHeadersText)

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (93034 => 93035)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -206,13 +206,9 @@
 WebInspector.StylesSidebarPane.prototype = {
     _contextMenuEventFired: function(event)
     {
-        var href = "" || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
-        if (href) {
-            var contextMenu = new WebInspector.ContextMenu();
-            var filled = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
-            if (filled)
-                contextMenu.show(event);
-        }
+        var contextMenu = new WebInspector.ContextMenu();
+        if (WebInspector.populateHrefContextMenu(contextMenu, this.node, event))
+            contextMenu.show(event);
     },
 
     update: function(node, forceUpdate)

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


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-08-15 08:13:33 UTC (rev 93034)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-08-15 09:26:41 UTC (rev 93035)
@@ -425,6 +425,11 @@
     openLinkExternallyLabel: function()
     {
         return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in new tab" : "Open Link in New Tab");
+    },
+
+    copyLinkAddressLabel: function()
+    {
+        return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy link address" : "Copy Link Address");
     }
 }
 
@@ -1361,6 +1366,24 @@
     return resourceURL;
 }
 
+WebInspector.populateHrefContextMenu = function(contextMenu, contextNode, event)
+{
+    var anchorElement = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
+    if (!anchorElement)
+        return false;
+
+    var resourceURL = WebInspector.resourceURLForRelatedNode(contextNode, anchorElement.href);
+    if (!resourceURL)
+        return false;
+
+    // Add resource-related actions.
+    contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, resourceURL, false));
+    if (WebInspector.resourceForURL(resourceURL))
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in Resources panel" : "Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true));
+    contextMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFrontendHost.copyText.bind(InspectorFrontendHost, resourceURL));
+    return true;
+}
+
 WebInspector.completeURL = function(baseURL, href)
 {
     if (href) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to