2011-04-29 Pavel Feldman <pfeldman@google.com>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2011 09:34:56 +0000 (09:34 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2011 09:34:56 +0000 (09:34 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: add "open link in new tab" action into the network and resources panels.
        https://bugs.webkit.org/show_bug.cgi?id=59788

        This change also distinguishes context menu items case between platforms.

        * English.lproj/localizedStrings.js:
        * inspector/front-end/ConsoleView.js:
        (WebInspector.ConsoleView.prototype._handleContextMenuEvent):
        * inspector/front-end/DOMBreakpointsSidebarPane.js:
        (WebInspector.DOMBreakpointsSidebarPane):
        * inspector/front-end/ElementsPanel.js:
        (WebInspector.ElementsPanel.prototype._contextMenuEventFired):
        (WebInspector.ElementsPanel.prototype.populateHrefContextMenu):
        * inspector/front-end/ElementsTreeOutline.js:
        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
        (WebInspector.ElementsTreeElement.prototype._populateTextContextMenu):
        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkPanel.prototype._contextMenu):
        * inspector/front-end/ResourcesPanel.js:
        (WebInspector.FrameResourceTreeElement.prototype._handleContextMenuEvent):
        (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction):
        (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent):
        * inspector/front-end/Settings.js:
        * inspector/front-end/SourceFrame.js:
        (WebInspector.SourceFrame.prototype.populateLineGutterContextMenu):
        * inspector/front-end/TextViewer.js:
        (WebInspector.TextViewer.prototype._contextMenu):
        * inspector/front-end/inspector.js:
        (WebInspector.openLinkExternallyLabel):
        (WebInspector.openResource):
        (WebInspector.useLowerCaseMenuTitles):
2011-04-29  Pavel Feldman  <pfeldman@google.com>

        Reviewed by Yury Semikhatsky.

        Web Inspector: add "open link in new tab" action into the network and resources panels.
        https://bugs.webkit.org/show_bug.cgi?id=59788

        This change also distinguishes context menu items case between platforms.

        * src/js/DevTools.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85312 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/ElementsTreeOutline.js
Source/WebCore/inspector/front-end/NetworkPanel.js
Source/WebCore/inspector/front-end/ResourcesPanel.js
Source/WebCore/inspector/front-end/Settings.js
Source/WebCore/inspector/front-end/SourceFrame.js
Source/WebCore/inspector/front-end/TextViewer.js
Source/WebCore/inspector/front-end/inspector.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/js/DevTools.js

index 2431088..ca1c1b9 100644 (file)
@@ -1,3 +1,39 @@
+2011-04-29  Pavel Feldman  <pfeldman@google.com>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: add "open link in new tab" action into the network and resources panels.
+        https://bugs.webkit.org/show_bug.cgi?id=59788
+
+        This change also distinguishes context menu items case between platforms.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._handleContextMenuEvent):
+        * inspector/front-end/DOMBreakpointsSidebarPane.js:
+        (WebInspector.DOMBreakpointsSidebarPane):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._contextMenuEventFired):
+        (WebInspector.ElementsPanel.prototype.populateHrefContextMenu):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
+        (WebInspector.ElementsTreeElement.prototype._populateTextContextMenu):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype._contextMenu):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.FrameResourceTreeElement.prototype._handleContextMenuEvent):
+        (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction):
+        (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent):
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype.populateLineGutterContextMenu):
+        * inspector/front-end/TextViewer.js:
+        (WebInspector.TextViewer.prototype._contextMenu):
+        * inspector/front-end/inspector.js:
+        (WebInspector.openLinkExternallyLabel):
+        (WebInspector.openResource):
+        (WebInspector.useLowerCaseMenuTitles):
+
 2011-04-28  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein.
index b0100d4..747a462 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index 6248a3c..058d95f 100644 (file)
@@ -432,8 +432,8 @@ WebInspector.ConsoleView.prototype = {
             ConsoleAgent.setMonitoringXHREnabled(WebInspector.settings.monitoringXHREnabled);
         }.bind(this);
         var contextMenu = new WebInspector.ContextMenu();
-        contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, WebInspector.settings.monitoringXHREnabled)
-        contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this));
+        contextMenu.appendCheckboxItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "XMLHttpRequest logging" : "XMLHttpRequest Logging"), itemAction, WebInspector.settings.monitoringXHREnabled)
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear console" : "Clear Console"), this.requestClearMessages.bind(this));
         contextMenu.show(event);
     },
 
index c6f44b5..843dd75 100644 (file)
@@ -45,9 +45,9 @@ WebInspector.DOMBreakpointsSidebarPane = function()
         WebInspector.UIString("Node Removed")
     ];
     this._contextMenuLabels = [
-        WebInspector.UIString("Break on Subtree Modifications"),
-        WebInspector.UIString("Break on Attributes Modifications"),
-        WebInspector.UIString("Break on Node Removal")
+        WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on subtree modifications" : "Break on Subtree Modifications"),
+        WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on attributes modifications" : "Break on Attributes Modifications"),
+        WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on node removal" : "Break on Node Removal")
     ];
     WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
 }
index 182584b..fbd5139 100644 (file)
@@ -287,7 +287,7 @@ WebInspector.ElementsPanel.prototype = {
         var populated = this.treeOutline.populateContextMenu(contextMenu, event);
         if (populated)
             contextMenu.appendSeparator();
-        contextMenu.appendCheckboxItem(WebInspector.UIString("Word Wrap"), toggleWordWrap.bind(this), isTextWrapped.call(this));
+        contextMenu.appendCheckboxItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Word wrap" : "Word Wrap"), toggleWordWrap.bind(this), isTextWrapped.call(this));
 
         contextMenu.show(event);
     },
@@ -302,9 +302,9 @@ WebInspector.ElementsPanel.prototype = {
             return false;
 
         // Add resource-related actions.
-        contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(null, resourceURL, false));
+        contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, resourceURL, false));
         if (WebInspector.resourceForURL(resourceURL))
-            contextMenu.appendItem(WebInspector.UIString("Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in Resources panel" : "Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true));
         return true;
     },
 
index 2ecc3f9..ebb9cc3 100644 (file)
@@ -778,15 +778,15 @@ WebInspector.ElementsTreeElement.prototype = {
         var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attribute");
 
         // Add attribute-related actions.
-        contextMenu.appendItem(WebInspector.UIString("Add Attribute"), this._addNewAttribute.bind(this));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add attribute" : "Add Attribute"), this._addNewAttribute.bind(this));
         if (attribute && !newAttribute)
-            contextMenu.appendItem(WebInspector.UIString("Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Edit attribute" : "Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
         contextMenu.appendSeparator();
 
         // Add free-form node-related actions.
         contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._editAsHTML.bind(this));
         contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
-        contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this));
 
         if (Preferences.nativeInstrumentationEnabled) {
             // Add debbuging-related actions
@@ -798,7 +798,7 @@ WebInspector.ElementsTreeElement.prototype = {
 
     _populateTextContextMenu: function(contextMenu, textNode)
     {
-        contextMenu.appendItem(WebInspector.UIString("Edit Text"), this._startEditingTextNode.bind(this, textNode));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, textNode));
     },
 
     _startEditing: function()
index 8a6a1b5..2d906f2 100644 (file)
@@ -1001,20 +1001,22 @@ WebInspector.NetworkPanel.prototype = {
         var resource = gridNode && gridNode._resource;
 
         if (resource) {
-            contextMenu.appendItem(WebInspector.UIString("Copy location"), this._copyLocation.bind(this, 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));
             if (resource.requestHeadersText)
-                contextMenu.appendItem(WebInspector.UIString("Copy request headers"), this._copyRequestHeaders.bind(this, resource));
+                contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy request headers" : "Copy Request Headers"), this._copyRequestHeaders.bind(this, resource));
             if (resource.responseHeadersText)
-                contextMenu.appendItem(WebInspector.UIString("Copy response headers"), this._copyResponseHeaders.bind(this, resource));
-            contextMenu.appendItem(WebInspector.UIString("Copy entry as HAR"), this._copyResource.bind(this, resource));
+                contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy response headers" : "Copy Response Headers"), this._copyResponseHeaders.bind(this, resource));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy entry as HAR" : "Copy Entry as HAR"), this._copyResource.bind(this, resource));
         }
-        contextMenu.appendItem(WebInspector.UIString("Copy all as HAR"), this._copyAll.bind(this));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this));
 
         if (Preferences.saveAsAvailable) {
             contextMenu.appendSeparator();
             if (resource)
-                contextMenu.appendItem(WebInspector.UIString("Save entry as HAR"), this._exportResource.bind(this, resource));
-            contextMenu.appendItem(WebInspector.UIString("Save all as HAR"), this._exportAll.bind(this));
+                contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save entry as HAR" : "Save Entry as HAR"), this._exportResource.bind(this, resource));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save all as HAR" : "Save All as HAR"), this._exportAll.bind(this));
         }
 
         contextMenu.show(event);
index 01bce11..696d738 100644 (file)
@@ -1117,6 +1117,14 @@ WebInspector.FrameResourceTreeElement.prototype = {
 
     _handleContextMenuEvent: function(event)
     {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, this._resource.url, false));
+        this._appendSaveAsAction(contextMenu, event);
+        contextMenu.show(event);
+    },
+
+    _appendSaveAsAction: function(contextMenu, event)
+    {
         if (!Preferences.saveAsAvailable)
             return;
 
@@ -1130,9 +1138,9 @@ WebInspector.FrameResourceTreeElement.prototype = {
             var fileName = this._resource.displayName;
             this._resource.requestContent(InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName));
         }
-        var contextMenu = new WebInspector.ContextMenu();
-        contextMenu.appendItem(WebInspector.UIString("Save as..."), save.bind(this));
-        contextMenu.show(event);
+
+        contextMenu.appendSeparator();
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this));
     },
     
     _setBubbleText: function(x)
@@ -1393,7 +1401,7 @@ WebInspector.ResourceRevisionTreeElement.prototype = {
                 this._revision.requestContent(InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName));
             }
             contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString("Save as..."), save.bind(this));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this));
         }
 
         contextMenu.show(event);
index aa5ad34..62bf84a 100644 (file)
@@ -50,7 +50,8 @@ var Preferences = {
     debugMode: false,
     heapProfilerPresent: false,
     detailedHeapProfiles: false,
-    saveAsAvailable: false
+    saveAsAvailable: false,
+    useLowerCaseMenuTitlesOnWindows: false
 }
 
 WebInspector.Settings = function()
index e088374..b2fe51f 100644 (file)
@@ -606,12 +606,12 @@ WebInspector.SourceFrame.prototype = {
 
     populateLineGutterContextMenu: function(lineNumber, contextMenu)
     {
-        contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._delegate.continueToLine.bind(this._delegate, lineNumber));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Continue to here" : "Continue to Here"), this._delegate.continueToLine.bind(this._delegate, lineNumber));
 
         var breakpoint = this._delegate.findBreakpoint(lineNumber);
         if (!breakpoint) {
             // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint.
-            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._delegate.setBreakpoint.bind(this._delegate, lineNumber, "", true));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add breakpoint" : "Add Breakpoint"), this._delegate.setBreakpoint.bind(this._delegate, lineNumber, "", true));
 
             function addConditionalBreakpoint()
             {
@@ -624,10 +624,10 @@ WebInspector.SourceFrame.prototype = {
                 }
                 this._editBreakpointCondition(lineNumber, "", didEditBreakpointCondition.bind(this));
             }
-            contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add conditional breakpoint…" : "Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
         } else {
             // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
-            contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._delegate.removeBreakpoint.bind(this._delegate, lineNumber));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), this._delegate.removeBreakpoint.bind(this._delegate, lineNumber));
             function editBreakpointCondition()
             {
                 function didEditBreakpointCondition(committed, condition)
@@ -637,15 +637,15 @@ WebInspector.SourceFrame.prototype = {
                 }
                 this._editBreakpointCondition(lineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this));
             }
-            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Edit breakpoint…" : "Edit Breakpoint…"), editBreakpointCondition.bind(this));
             function setBreakpointEnabled(enabled)
             {
                 this._delegate.updateBreakpoint(lineNumber, breakpoint.condition, enabled);
             }
             if (breakpoint.enabled)
-                contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), setBreakpointEnabled.bind(this, false));
+                contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Disable breakpoint" : "Disable Breakpoint"), setBreakpointEnabled.bind(this, false));
             else
-                contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"), setBreakpointEnabled.bind(this, true));
+                contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Enable breakpoint" : "Enable Breakpoint"), setBreakpointEnabled.bind(this, true));
         }
     },
 
index 8178726..ab0cd3f 100644 (file)
@@ -291,7 +291,7 @@ WebInspector.TextViewer.prototype = {
 
         var fileName = this._delegate.suggestedFileName();
         if (fileName)
-            contextMenu.appendItem(WebInspector.UIString("Save as..."), InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName, this._textModel.text));
+            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName, this._textModel.text));
 
         contextMenu.show(event);
     },
index be589d0..c37c28b 100644 (file)
@@ -363,7 +363,7 @@ var WebInspector = {
 
     openLinkExternallyLabel: function()
     {
-        return WebInspector.UIString("Open Link in New Window");
+        return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in new tab" : "Open Link in New Tab");
     }
 }
 
@@ -661,7 +661,7 @@ WebInspector.openResource = function(resourceURL, inResourcesPanel)
         WebInspector.panels.resources.showResource(resource);
         WebInspector.showPanel("resources");
     } else
-        PageAgent.open(resource ? resource.url : resourceURL, true);
+        PageAgent.open(resourceURL, true);
 }
 
 WebInspector._registerShortcuts = function()
@@ -1408,6 +1408,11 @@ WebInspector.isMac = function()
     return this._isMac;
 }
 
+WebInspector.useLowerCaseMenuTitles = function()
+{
+    return WebInspector.platform === "windows" && Preferences.useLowerCaseMenuTitlesOnWindows;
+}
+
 WebInspector.isBeingEdited = function(element)
 {
     return element.__editing;
index e146209..8f7d5fb 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-29  Pavel Feldman  <pfeldman@google.com>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: add "open link in new tab" action into the network and resources panels.
+        https://bugs.webkit.org/show_bug.cgi?id=59788
+
+        This change also distinguishes context menu items case between platforms.
+
+        * src/js/DevTools.js:
+
 2011-04-28  Nat Duca  <nduca@chromium.org>
 
         Reviewed by Kenneth Russell.
index f2b2c4a..ee54f0c 100644 (file)
@@ -51,6 +51,7 @@ var context = {};  // Used by WebCore's inspector routines.
     Preferences.showTimingTab = true;
     Preferences.showCookiesTab = true;
     Preferences.saveAsAvailable = true;
+    Preferences.useLowerCaseMenuTitlesOnWindows = true;
 })();
 
 // Recognize WebP as a valid image mime type.
@@ -92,18 +93,6 @@ WebInspector.UIString = function(string)
 };
 
 
-/*
- * This label must be kept consistent with that in English.lproj/localizedStrings.js
- *
- * http://code.google.com/p/chromium/issues/detail?id=61302 requires a custom label for Chromium,
- * since its behavior is different.
- */
-WebInspector.openLinkExternallyLabel = function()
-{
-    return WebInspector.UIString("Open Link in New Tab");
-};
-
-
 /** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */
 (function()
 {