2011-06-15 Pavel Feldman <pfeldman@google.com>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2011 16:00:34 +0000 (16:00 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2011 16:00:34 +0000 (16:00 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: introduce context menu on ImageView with Copy and Open in new tab actions.
        https://bugs.webkit.org/show_bug.cgi?id=62727

        * English.lproj/localizedStrings.js:
        * inspector/front-end/ImageView.js:
        (WebInspector.ImageView.prototype._base64ToSize):
        (WebInspector.ImageView.prototype._contextMenu):
        (WebInspector.ImageView.prototype._copyImageURL):
        (WebInspector.ImageView.prototype._openInNewTab):

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

Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/ImageView.js

index d833733..7a8c4b7 100644 (file)
@@ -1,3 +1,17 @@
+2011-06-15  Pavel Feldman  <pfeldman@google.com>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: introduce context menu on ImageView with Copy and Open in new tab actions.
+        https://bugs.webkit.org/show_bug.cgi?id=62727
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ImageView.js:
+        (WebInspector.ImageView.prototype._base64ToSize):
+        (WebInspector.ImageView.prototype._contextMenu):
+        (WebInspector.ImageView.prototype._copyImageURL):
+        (WebInspector.ImageView.prototype._openInNewTab):
+
 2011-06-15  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index d0b542c..2b729ce 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index a9042f2..68c7518 100644 (file)
@@ -57,6 +57,7 @@ WebInspector.ImageView.prototype = {
         var imagePreviewElement = document.createElement("img");
         imagePreviewElement.addStyleClass("resource-image-view");
         imageContainer.appendChild(imagePreviewElement);
+        imagePreviewElement.addEventListener("contextmenu", this._contextMenu.bind(this), true);
 
         this._container = document.createElement("div");
         this._container.className = "info";
@@ -118,6 +119,24 @@ WebInspector.ImageView.prototype = {
         if (content.length > 1 && content[content.length - 2] === "=")
             size--;
         return size;
+    },
+
+    _contextMenu: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy image URL" : "Copy Image URL"), this._copyImageURL.bind(this));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open image in new tab" : "Open Image in New Tab"), this._openInNewTab.bind(this));
+        contextMenu.show(event);
+    },
+
+    _copyImageURL: function(event)
+    {
+        InspectorFrontendHost.copyText(this.resource.url);
+    },
+
+    _openInNewTab: function(event)
+    {
+        WebInspector.openResource(this.resource.url, false);
     }
 }