Support Copy ... actions for the Web Inspector remote debugging mode.
authormnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:38:37 +0000 (19:38 +0000)
committermnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:38:37 +0000 (19:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86621

Reviewed by Pavel Feldman.

Source/WebCore:

* English.lproj/localizedStrings.js:
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub):
(.WebInspector.InspectorFrontendHostStub.prototype.documentCopy):
(.WebInspector.InspectorFrontendHostStub.prototype.copyText):
(.WebInspector.clipboardAccessDeniedMessage):
(.WebInspector.ClipboardAccessDeniedScreen):
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector.documentCopy):
(WebInspector.documentCopyEventFired):

Source/WebKit/chromium:

* src/js/DevTools.js:
(WebInspector.clipboardAccessDeniedMessage):

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

Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/js/DevTools.js

index 15bab21..81cc67f 100644 (file)
@@ -1,3 +1,22 @@
+2012-05-17  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Support Copy ... actions for the Web Inspector remote debugging mode.
+        https://bugs.webkit.org/show_bug.cgi?id=86621
+
+        Reviewed by Pavel Feldman.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/InspectorFrontendHostStub.js:
+        (.WebInspector.InspectorFrontendHostStub):
+        (.WebInspector.InspectorFrontendHostStub.prototype.documentCopy):
+        (.WebInspector.InspectorFrontendHostStub.prototype.copyText):
+        (.WebInspector.clipboardAccessDeniedMessage):
+        (.WebInspector.ClipboardAccessDeniedScreen):
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+        (WebInspector.documentCopy):
+        (WebInspector.documentCopyEventFired):
+
 2012-05-02  Robert Hogan  <robert@webkit.org>
 
         CSS 2.1 failure: table-height-algorithm-023 and -024 fail
index 3269c8e..104c6d0 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index 34855cc..a6f98b2 100644 (file)
@@ -37,6 +37,7 @@ WebInspector.InspectorFrontendHostStub = function()
 {
     this._attachedWindowHeight = 0;
     this.isStub = true;
+    WebInspector.documentCopyEventFired = this.documentCopy.bind(this);
 }
 
 WebInspector.InspectorFrontendHostStub.prototype = {
@@ -109,8 +110,22 @@ WebInspector.InspectorFrontendHostStub.prototype = {
         document.title = WebInspector.UIString(Preferences.applicationTitle, url);
     },
 
-    copyText: function()
+    documentCopy: function(event)
     {
+        if (!this._textToCopy)
+            return;
+        event.clipboardData.setData("text", this._textToCopy);
+        event.preventDefault();
+        delete this._textToCopy;
+    },
+
+    copyText: function(text)
+    {
+        this._textToCopy = text;
+        if (!document.execCommand("copy")) {
+            var screen = new WebInspector.ClipboardAccessDeniedScreen();
+            screen.showModal();
+        }
     },
 
     openInNewTab: function(url)
@@ -175,5 +190,27 @@ WebInspector.InspectorFrontendHostStub.prototype = {
 var InspectorFrontendHost = new WebInspector.InspectorFrontendHostStub();
 Preferences.localizeUI = false;
 
+// Default implementation; platforms will override.
+WebInspector.clipboardAccessDeniedMessage = function()
+{
+    return "";
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.HelpScreen}
+ */
+WebInspector.ClipboardAccessDeniedScreen = function()
+{
+    WebInspector.HelpScreen.call(this, WebInspector.UIString("Clipboard access is denied"));
+    var platformMessage = WebInspector.clipboardAccessDeniedMessage();
+    if (platformMessage) {
+        var p = this.contentElement.createChild("p");
+        p.addStyleClass("help-section");
+        p.textContent = platformMessage;
+    }
 }
 
+WebInspector.ClipboardAccessDeniedScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype;
+
+}
index e5cec09..5251b9e 100644 (file)
@@ -45,6 +45,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="InspectorFrontendAPI.js"></script>
     <script type="text/javascript" src="Object.js"></script>
     <script type="text/javascript" src="Settings.js"></script>
+    <script type="text/javascript" src="View.js"></script>
+    <script type="text/javascript" src="HelpScreen.js"></script>
     <script type="text/javascript" src="InspectorFrontendHostStub.js"></script>
     <script type="text/javascript" src="FileManager.js"></script>
     <script type="text/javascript" src="Checkbox.js"></script>
@@ -54,7 +56,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="TextPrompt.js"></script>
     <script type="text/javascript" src="Popover.js"></script>
     <script type="text/javascript" src="Placard.js"></script>
-    <script type="text/javascript" src="View.js"></script>
     <script type="text/javascript" src="TabbedPane.js"></script>
     <script type="text/javascript" src="Drawer.js"></script>
     <script type="text/javascript" src="ConsoleModel.js"></script>
@@ -195,7 +196,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="TimelineOverviewPane.js"></script>
     <script type="text/javascript" src="TimelineFrameController.js"></script>
     <script type="text/javascript" src="TestController.js"></script>
-    <script type="text/javascript" src="HelpScreen.js"></script>
     <script type="text/javascript" src="Dialog.js"></script>
     <script type="text/javascript" src="GoToLineDialog.js"></script>
     <script type="text/javascript" src="FilteredItemSelectionDialog.js"></script>
index f10e478..ccfd957 100644 (file)
@@ -769,6 +769,11 @@ WebInspector.documentCopy = function(event)
 {
     if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel().handleCopyEvent)
         WebInspector.inspectorView.currentPanel().handleCopyEvent(event);
+    WebInspector.documentCopyEventFired(event);
+}
+
+WebInspector.documentCopyEventFired = function(event)
+{
 }
 
 WebInspector.contextMenuEventFired = function(event)
index f433e47..9c4f0ec 100644 (file)
@@ -1,3 +1,13 @@
+2012-05-17  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Support Copy ... actions for the Web Inspector remote debugging mode.
+        https://bugs.webkit.org/show_bug.cgi?id=86621
+
+        Reviewed by Pavel Feldman.
+
+        * src/js/DevTools.js:
+        (WebInspector.clipboardAccessDeniedMessage):
+
 2012-05-17  Hironori Bono  <hbono@chromium.org>
 
         [Refactoring] Move platform-specific code in Editor::respondToChangedSelection to the WebKit layer
index 499b604..c4d5423 100644 (file)
@@ -54,3 +54,8 @@ WebInspector.setInspectedTabId = function(tabId)
 {
     WebInspector._inspectedTabId = tabId;
 }
+
+WebInspector.clipboardAccessDeniedMessage = function()
+{
+    return "You need to install a Chrome extension that grants clipboard access to Developer Tools.";
+}