Title: [105679] trunk/Source/WebCore
Revision
105679
Author
[email protected]
Date
2012-01-23 18:39:00 -0800 (Mon, 23 Jan 2012)

Log Message

Web Inspector: Make "Copy as HTML" use the same copy functions as other copy methods.
https://bugs.webkit.org/show_bug.cgi?id=76706

Patch by Konrad Piascik <[email protected]> on 2012-01-23
Reviewed by Pavel Feldman.

Changed DOMAgent.copyNode to call getOuterHTML and use the callback function to
return the text to InspectorFrontendHost.copyText.  This will make all copy
functions use the same code path.

Not testable.

* inspector/Inspector.json:
* inspector/InspectorDOMAgent.cpp:
* inspector/InspectorDOMAgent.h:
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode.prototype.copyNode.copy):
(WebInspector.DOMNode.prototype.copyNode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105678 => 105679)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 02:36:19 UTC (rev 105678)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 02:39:00 UTC (rev 105679)
@@ -1,3 +1,23 @@
+2012-01-23  Konrad Piascik  <[email protected]>
+
+        Web Inspector: Make "Copy as HTML" use the same copy functions as other copy methods.
+        https://bugs.webkit.org/show_bug.cgi?id=76706
+
+        Reviewed by Pavel Feldman.
+
+        Changed DOMAgent.copyNode to call getOuterHTML and use the callback function to
+        return the text to InspectorFrontendHost.copyText.  This will make all copy
+        functions use the same code path.
+
+        Not testable.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorDOMAgent.cpp:
+        * inspector/InspectorDOMAgent.h:
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype.copyNode.copy):
+        (WebInspector.DOMNode.prototype.copyNode):
+
 2012-01-23  Luke Macpherson   <[email protected]>
 
         Make zoom multiplier float instead of double to match RenderStyle::effectiveZoom etc. and thus avoid unnecessary precision conversions.

Modified: trunk/Source/WebCore/inspector/Inspector.json (105678 => 105679)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-01-24 02:36:19 UTC (rev 105678)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-01-24 02:39:00 UTC (rev 105679)
@@ -1315,14 +1315,6 @@
                 "hidden": true
             },
             {
-                "name": "copyNode",
-                "parameters": [
-                    { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to copy." }
-                ],
-                "description": "Copies node's HTML markup into the clipboard.",
-                "hidden": true
-            },
-            {
                 "name": "getOuterHTML",
                 "parameters": [
                     { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get markup for." }

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (105678 => 105679)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-01-24 02:36:19 UTC (rev 105678)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-01-24 02:39:00 UTC (rev 105679)
@@ -1441,15 +1441,6 @@
     return node;
 }
 
-void InspectorDOMAgent::copyNode(ErrorString*, int nodeId)
-{
-    Node* node = nodeForId(nodeId);
-    if (!node)
-        return;
-    String markup = createMarkup(node);
-    Pasteboard::generalPasteboard()->writePlainText(markup);
-}
-
 void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId)
 {
     if (Node* node = nodeForPath(path))

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (105678 => 105679)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-01-24 02:36:19 UTC (rev 105678)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-01-24 02:39:00 UTC (rev 105679)
@@ -162,7 +162,6 @@
 
     Node* nodeForId(int nodeId);
     int boundNodeId(Node*);
-    void copyNode(ErrorString*, int nodeId);
     void setDOMListener(DOMListener*);
 
     static String documentURLString(Document*);

Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (105678 => 105679)


--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-01-24 02:36:19 UTC (rev 105678)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-01-24 02:39:00 UTC (rev 105679)
@@ -269,12 +269,14 @@
         DOMAgent.removeNode(this.id, WebInspector.domAgent._markRevision(this, callback));
     },
 
-    /**
-     * @param {function(?Protocol.Error)=} callback
-     */
-    copyNode: function(callback)
+    copyNode: function()
     {
-        DOMAgent.copyNode(this.id, callback);
+        function copy(error, text)
+        {
+            if (!error)
+                InspectorFrontendHost.copyText(text);
+        }
+        DOMAgent.getOuterHTML(this.id, copy);
     },
 
     /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to