[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

bweinstein at apple.com bweinstein at apple.com
Thu Oct 29 20:43:52 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit cbe97396a599c313afafd3ab585c3e7d0d1ae5a6
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 13 19:01:02 2009 +0000

    Fixes <https://bugs.webkit.org/show_bug.cgi?id=30337>.
    Web Inspector: Should be able to delete nodes from the Elements Tree.
    
    Reviewed by Timothy Hatcher.
    
    When the delete key is pressed and a element is selected in the tree,
    the element should be deleted from the Elements Tree and the DOM.
    
    * inspector/InspectorBackend.cpp:
    (WebCore::InspectorBackend::removeNode):
    * inspector/InspectorBackend.h:
    * inspector/InspectorBackend.idl:
    * inspector/InspectorFrontend.cpp:
    (WebCore::InspectorFrontend::didRemoveNode):
    * inspector/InspectorFrontend.h:
    * inspector/front-end/ElementsPanel.js:
    (WebInspector.ElementsPanel.prototype._updateModifiedNodes):
    * inspector/front-end/ElementsTreeOutline.js:
    (WebInspector.ElementsTreeOutline.prototype.handleKeyEvent):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49505 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 33292e9..826db40 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,28 @@
 
         Reviewed by Timothy Hatcher.
 
+        Fixes <https://bugs.webkit.org/show_bug.cgi?id=30337>.
+        Web Inspector: Should be able to delete nodes from the Elements Tree.
+        
+        When the delete key is pressed and a element is selected in the tree,
+        the element should be deleted from the Elements Tree and the DOM.
+
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::removeNode):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorBackend.idl:
+        * inspector/InspectorFrontend.cpp:
+        (WebCore::InspectorFrontend::didRemoveNode):
+        * inspector/InspectorFrontend.h:
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._updateModifiedNodes):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline.prototype.handleKeyEvent):
+
+2009-10-13  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Timothy Hatcher.
+
         Fix REGRESSION(49479): Mouseover on resources graph doesn't show timings.
         
         Set pointer-events: none on the new overlay so mouseover events are passed
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 1273512..43379f6 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -455,6 +455,26 @@ void InspectorBackend::copyNode(long nodeId)
     String markup = createMarkup(node);
     Pasteboard::generalPasteboard()->writePlainText(markup);
 }
+    
+void InspectorBackend::removeNode(long callId, long nodeId)
+{    
+    Node* node = nodeForId(nodeId);
+    if (!node)
+        return;
+
+    Node* parentNode = node->parentNode();
+    if (!parentNode)
+        return;
+
+    ExceptionCode code;
+    parentNode->removeChild(node, code);
+    
+    if (code)
+        return;
+    
+    if (InspectorFrontend* frontend = inspectorFrontend())
+        frontend->didRemoveNode(callId, nodeId);
+}
 
 void InspectorBackend::getCookies(long callId, const String& domain)
 {
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index d7eea8c..86ee6f9 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -137,6 +137,7 @@ public:
     void setTextNodeValue(long callId, long nodeId, const String& value);
     void getEventListenersForNode(long callId, long nodeId);
     void copyNode(long nodeId);
+    void removeNode(long callId, long nodeId);
 
     void getCookies(long callId, const String& domain);
     void deleteCookie(const String& cookieName, const String& domain);
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 8803765..ab147ec 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -109,6 +109,7 @@ module core {
         void setTextNodeValue(in long callId, in long nodeId, in DOMString value);
         void getEventListenersForNode(in long callId, in long nodeId);
         void copyNode(in long nodeId);
+        void removeNode(in long callId, in long nodeId);
 
         void getCookies(in long callId, in DOMString domain);
         void deleteCookie(in DOMString cookieName, in DOMString domain);
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index ad935a8..bdb622d 100644
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -343,6 +343,14 @@ void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
     function->call();
 }
 
+void InspectorFrontend::didRemoveNode(int callId, int nodeId)
+{
+    OwnPtr<ScriptFunctionCall> function(newFunctionCall("didRemoveNode"));
+    function->appendArgument(callId);
+    function->appendArgument(nodeId);
+    function->call();
+}
+
 void InspectorFrontend::didGetChildNodes(int callId)
 {
     OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetChildNodes"));
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index f7055bd..1d7adf0 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -120,6 +120,7 @@ namespace WebCore {
         void didGetChildNodes(int callId);
         void didApplyDomChange(int callId, bool success);
         void didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray);
+        void didRemoveNode(int callId, int nodeId);
 
         void timelineWasEnabled();
         void timelineWasDisabled();
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index fd0874a..5d0e6d7 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -479,7 +479,7 @@ WebInspector.ElementsPanel.prototype = {
                 updatedParentTreeElements.push(parentNodeItem);
             }
 
-            if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestor(this.focusedDOMNode, parent)))
+            if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorNode(this.focusedDOMNode, parent)))
                 updateBreadcrumbs = true;
         }
 
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index cf8caee..22edee1 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -184,6 +184,22 @@ WebInspector.ElementsTreeOutline.prototype = {
 
         return element;
     },
+    
+    handleKeyEvent: function(event)
+    {
+        var selectedElement = this.selectedTreeElement;
+
+        if (!selectedElement)
+            return;
+        
+        if (event.keyCode == 8 || event.keyCode == 46) {
+            // Delete or backspace pressed, delete the node.
+            selectedElement.remove();
+            return;
+        }
+        
+        TreeOutline.prototype.handleKeyEvent.call(this, event);
+    },
 
     _onmousedown: function(event)
     {
@@ -827,7 +843,25 @@ WebInspector.ElementsTreeElement.prototype = {
                 return true;
         }
         return false;
+    },
+    
+    remove: function()
+    {
+        var parentElement = this.parent;
+        if (!parentElement)
+            return;
+
+        var self = this;
+        function removeNodeCallback(removedNodeId)
+        {
+            parentElement.removeChild(self);
+        }
+
+        var callId = WebInspector.Callback.wrap(removeNodeCallback);
+        InspectorController.removeNode(callId, this.representedObject.id);
     }
 }
 
 WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype;
+
+WebInspector.didRemoveNode = WebInspector.Callback.processCallback;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list