Title: [117481] trunk/Source
Revision
117481
Author
mnaga...@chromium.org
Date
2012-05-17 12:38:37 -0700 (Thu, 17 May 2012)

Log Message

Support Copy ... actions for the Web Inspector remote debugging mode.
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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117480 => 117481)


--- trunk/Source/WebCore/ChangeLog	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebCore/ChangeLog	2012-05-17 19:38:37 UTC (rev 117481)
@@ -1,3 +1,22 @@
+2012-05-17  Mikhail Naganov  <mnaga...@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  <rob...@webkit.org>
 
         CSS 2.1 failure: table-height-algorithm-023 and -024 fail

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


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js (117480 => 117481)


--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js	2012-05-17 19:38:37 UTC (rev 117481)
@@ -37,6 +37,7 @@
 {
     this._attachedWindowHeight = 0;
     this.isStub = true;
+    WebInspector.documentCopyEventFired = this.documentCopy.bind(this);
 }
 
 WebInspector.InspectorFrontendHostStub.prototype = {
@@ -109,10 +110,24 @@
         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)
     {
         window.open(url, "_blank");
@@ -175,5 +190,27 @@
 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;
+
+}

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (117480 => 117481)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-05-17 19:38:37 UTC (rev 117481)
@@ -45,6 +45,8 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
@@ -54,7 +56,6 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
@@ -195,7 +196,6 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""

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


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-05-17 19:38:37 UTC (rev 117481)
@@ -769,8 +769,13 @@
 {
     if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel().handleCopyEvent)
         WebInspector.inspectorView.currentPanel().handleCopyEvent(event);
+    WebInspector.documentCopyEventFired(event);
 }
 
+WebInspector.documentCopyEventFired = function(event)
+{
+}
+
 WebInspector.contextMenuEventFired = function(event)
 {
     if (event.handled || event.target.hasStyleClass("popup-glasspane"))

Modified: trunk/Source/WebKit/chromium/ChangeLog (117480 => 117481)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-17 19:38:37 UTC (rev 117481)
@@ -1,3 +1,13 @@
+2012-05-17  Mikhail Naganov  <mnaga...@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  <hb...@chromium.org>
 
         [Refactoring] Move platform-specific code in Editor::respondToChangedSelection to the WebKit layer

Modified: trunk/Source/WebKit/chromium/src/js/DevTools.js (117480 => 117481)


--- trunk/Source/WebKit/chromium/src/js/DevTools.js	2012-05-17 19:36:25 UTC (rev 117480)
+++ trunk/Source/WebKit/chromium/src/js/DevTools.js	2012-05-17 19:38:37 UTC (rev 117481)
@@ -54,3 +54,8 @@
 {
     WebInspector._inspectedTabId = tabId;
 }
+
+WebInspector.clipboardAccessDeniedMessage = function()
+{
+    return "You need to install a Chrome extension that grants clipboard access to Developer Tools.";
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to