[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 13:38:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b5fb9d43f10d1c30722af5edae8eba16daababa9
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 13:02:58 2010 +0000

    2010-09-22  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: Elements panel does not reflect changes to the text node values.
            https://bugs.webkit.org/show_bug.cgi?id=46166
    
            * dom/CharacterData.cpp:
            (WebCore::CharacterData::dispatchModifiedEvent):
            * inspector/Inspector.idl:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::characterDataModifiedImpl):
            * inspector/InspectorController.h:
            (WebCore::InspectorController::characterDataModified):
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::characterDataModified):
            * inspector/InspectorDOMAgent.h:
            (WebCore::EventListenerInfo::EventListenerInfo):
            (WebCore::InspectorDOMAgent::create):
            (WebCore::InspectorDOMAgent::cast):
            (WebCore::InspectorDOMAgent::cssStore):
            * inspector/front-end/DOMAgent.js:
            (WebInspector.DOMAgent.prototype._characterDataModified):
            (WebInspector.characterDataModified):
            * inspector/front-end/ElementsPanel.js:
            (WebInspector.ElementsPanel.prototype._characterDataModified):
            * inspector/front-end/ElementsTreeOutline.js:
            (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68036 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a1e717f..842d5d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-09-22  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Elements panel does not reflect changes to the text node values.
+        https://bugs.webkit.org/show_bug.cgi?id=46166
+
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::dispatchModifiedEvent):
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::characterDataModifiedImpl):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::characterDataModified):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::characterDataModified):
+        * inspector/InspectorDOMAgent.h:
+        (WebCore::EventListenerInfo::EventListenerInfo):
+        (WebCore::InspectorDOMAgent::create):
+        (WebCore::InspectorDOMAgent::cast):
+        (WebCore::InspectorDOMAgent::cssStore):
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMAgent.prototype._characterDataModified):
+        (WebInspector.characterDataModified):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._characterDataModified):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted):
+
 2010-09-21  Ragner Magalhaes  <ragner.magalhaes at openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp
index 7accbfb..bc9ec56 100644
--- a/WebCore/dom/CharacterData.cpp
+++ b/WebCore/dom/CharacterData.cpp
@@ -24,6 +24,7 @@
 
 #include "EventNames.h"
 #include "ExceptionCode.h"
+#include "InspectorController.h"
 #include "MutationEvent.h"
 #include "RenderText.h"
 
@@ -197,6 +198,9 @@ void CharacterData::dispatchModifiedEvent(StringImpl* prevValue)
     if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER))
         dispatchEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data));
     dispatchSubtreeModifiedEvent();
+#if ENABLE(INSPECTOR)
+    InspectorController::characterDataModified(this);
+#endif
 }
 
 void CharacterData::checkCharDataOperation(unsigned offset, ExceptionCode& ec)
diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp
index 2dd50bb..e18f6fe 100644
--- a/WebCore/dom/ContainerNode.cpp
+++ b/WebCore/dom/ContainerNode.cpp
@@ -154,7 +154,9 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce
         if (child->parentNode())
             break;
 
+#if ENABLE(INSPECTOR)
         InspectorController::willInsertDOMNode(child, this);
+#endif
 
         insertBeforeCommon(next.get(), child);
 
@@ -223,7 +225,9 @@ void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChil
     for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) {
         Node* child = it->get();
 
+#if ENABLE(INSPECTOR)
         InspectorController::willInsertDOMNode(child, this);
+#endif
 
         insertBeforeCommon(next.get(), child);
 
@@ -298,7 +302,9 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
         ASSERT(!child->nextSibling());
         ASSERT(!child->previousSibling());
 
+#if ENABLE(INSPECTOR)
         InspectorController::willInsertDOMNode(child.get(), this);
+#endif
 
         // Add child after "prev".
         forbidEventDispatch();
@@ -577,7 +583,9 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo
                 break;
         }
 
+#if ENABLE(INSPECTOR)
         InspectorController::willInsertDOMNode(child, this);
+#endif
 
         // Append child to the end of the list
         forbidEventDispatch();
@@ -617,7 +625,9 @@ void ContainerNode::parserAddChild(PassRefPtr<Node> newChild)
     ASSERT(newChild);
     ASSERT(!newChild->parent()); // Use appendChild if you need to handle reparenting (and want DOM mutation events).
 
+#if ENABLE(INSPECTOR)
     InspectorController::willInsertDOMNode(newChild.get(), this);
+#endif
 
     forbidEventDispatch();
     Node* last = m_lastChild;
@@ -990,7 +1000,9 @@ static void notifyChildInserted(Node* child)
 {
     ASSERT(!eventDispatchForbidden());
 
+#if ENABLE(INSPECTOR)
     InspectorController::didInsertDOMNode(child);
+#endif
 
     RefPtr<Node> c = child;
     RefPtr<Document> document = child->document();
@@ -1024,7 +1036,9 @@ static void dispatchChildRemovalEvents(Node* child)
 {
     ASSERT(!eventDispatchForbidden());
 
+#if ENABLE(INSPECTOR)
     InspectorController::willRemoveDOMNode(child);
+#endif
 
     RefPtr<Node> c = child;
     RefPtr<Document> document = child->document();
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index ae136b2..1fe1dd2 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -37,9 +37,11 @@ module core {
         [notify] void addNodesToSearchResult(out Array nodeIds);
         [notify] void attributesUpdated(out long id, out Array attributes);
         [notify] void bringToFront();
+        [notify] void characterDataModified(out long id, out String newValue);
         [notify] void childNodeCountUpdated(out long id, out int newValue);
         [notify] void childNodeInserted(out long parentId, out long prevId, out Object node);
         [notify] void childNodeRemoved(out long parentId, out long id);
+        [notify] void consoleMessagesCleared();
         [notify] void didCommitLoad();
         [notify] void evaluateForTestInFrontend(out long testCallId, out String script);
         [notify] void disconnectFromBackend();
@@ -59,7 +61,6 @@ module core {
         [notify] void updateConsoleMessageRepeatCount(out unsigned long count);
         [notify] void updateFocusedNode(out long nodeId);
         [notify] void updateResource(out Value resource);
-        [notify] void consoleMessagesCleared();
 
 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
         [notify] void addProfileHeader(out Object header);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 5f8f190..64ea4bc 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -2131,6 +2131,11 @@ void InspectorController::didModifyDOMAttrImpl(Element* element)
         m_domAgent->didModifyDOMAttr(element);
 }
 
+void InspectorController::characterDataModifiedImpl(CharacterData* characterData)
+{
+    if (m_domAgent)
+        m_domAgent->characterDataModified(characterData);
+}
 
 } // namespace WebCore
 
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 6752044..f17f1d3 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -29,6 +29,7 @@
 #ifndef InspectorController_h
 #define InspectorController_h
 
+#include "CharacterData.h"
 #include "Console.h"
 #include "Cookie.h"
 #include "Element.h"
@@ -45,6 +46,7 @@
 namespace WebCore {
 
 class CachedResource;
+class CharacterData;
 class ConsoleMessage;
 class Database;
 class Document;
@@ -201,6 +203,7 @@ public:
     static void willRemoveDOMNode(Node*);
     static void willModifyDOMAttr(Element*);
     static void didModifyDOMAttr(Element*);
+    static void characterDataModified(CharacterData*);
 
 #if ENABLE(WORKERS)
     enum WorkerAction { WorkerCreated, WorkerDestroyed };
@@ -338,6 +341,7 @@ private:
     void didRemoveDOMNodeImpl(Node*);
     void willModifyDOMAttrImpl(Element*);
     void didModifyDOMAttrImpl(Element*);
+    void characterDataModifiedImpl(CharacterData*);
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     friend class InspectorDebuggerAgent;
@@ -451,6 +455,14 @@ inline void InspectorController::didModifyDOMAttr(Element* element)
 #endif
 }
 
+inline void InspectorController::characterDataModified(CharacterData* characterData)
+{
+#if ENABLE(INSPECTOR)
+    if (InspectorController* inspectorController = inspectorControllerForNode(characterData))
+        inspectorController->characterDataModifiedImpl(characterData);
+#endif
+}
+
 inline InspectorController* InspectorController::inspectorControllerForNode(Node* node)
 {
 #if ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index f1df5b0..f51da73 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -43,6 +43,7 @@
 #include "CSSStyleRule.h"
 #include "CSSStyleSelector.h"
 #include "CSSStyleSheet.h"
+#include "CharacterData.h"
 #include "ContainerNode.h"
 #include "Cookie.h"
 #include "CookieJar.h"
@@ -1120,6 +1121,14 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
     m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element));
 }
 
+void InspectorDOMAgent::characterDataModified(CharacterData* characterData)
+{
+    long id = m_documentNodeToIdMap.get(characterData);
+    if (!id)
+        return;
+    m_frontend->characterDataModified(id, characterData->data());
+}
+
 bool InspectorDOMAgent::hasBreakpoint(Node* node, long type)
 {
     uint32_t rootBit = 1 << type;
diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h
index 7d86997..89c6fd0 100644
--- a/WebCore/inspector/InspectorDOMAgent.h
+++ b/WebCore/inspector/InspectorDOMAgent.h
@@ -53,6 +53,7 @@ namespace WebCore {
     class CSSStyleDeclaration;
     class CSSStyleRule;
     class CSSStyleSheet;
+    class CharacterData;
     class Element;
     class Event;
     class InspectorDOMAgent;
@@ -139,6 +140,7 @@ namespace WebCore {
         void didInsertDOMNode(Node*);
         void didRemoveDOMNode(Node*);
         void didModifyDOMAttr(Element*);
+        void characterDataModified(CharacterData*);
 
         Node* nodeForId(long nodeId);
         long pushNodePathToFrontend(Node* node);
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 9b386c3..ceaa708 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -98,13 +98,7 @@ WebInspector.DOMNode.prototype = {
     set nodeValue(value) {
         if (this.nodeType != Node.TEXT_NODE)
             return;
-        var self = this;
-        var callback = function()
-        {
-            self._nodeValue = value;
-            self.textContent = value;
-        };
-        this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, callback);
+        this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, function() {});
     },
 
     getAttribute: function(name)
@@ -384,6 +378,15 @@ WebInspector.DOMAgent.prototype = {
         this.document._fireDomEvent("DOMAttrModified", event);
     },
 
+    _characterDataModified: function(nodeId, newValue)
+    {
+        var node = this._idToDOMNode[nodeId];
+        node._nodeValue = newValue;
+        node.textContent = newValue;
+        var event = { target : node };
+        this.document._fireDomEvent("DOMCharacterDataModified", event);
+    },
+
     nodeForId: function(nodeId)
     {
         return this._idToDOMNode[nodeId];
@@ -691,6 +694,11 @@ WebInspector.attributesUpdated = function()
     this.domAgent._attributesUpdated.apply(this.domAgent, arguments);
 }
 
+WebInspector.characterDataModified = function()
+{
+    this.domAgent._characterDataModified.apply(this.domAgent, arguments);
+}
+
 WebInspector.setDocument = function()
 {
     this.domAgent._setDocument.apply(this.domAgent, arguments);
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index 72b23e1..9f4dbf2 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -186,6 +186,7 @@ WebInspector.ElementsPanel.prototype = {
         inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this));
         inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this));
         inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this));
+        inspectedRootDocument.addEventListener("DOMCharacterDataModified", this._characterDataModified.bind(this));
 
         this.rootDOMNode = inspectedRootDocument;
 
@@ -491,6 +492,13 @@ WebInspector.ElementsPanel.prototype = {
             this._updateModifiedNodesSoon();
     },
 
+    _characterDataModified: function(event)
+    {
+        this.recentlyModifiedNodes.push({node: event.target, updated: true});
+        if (this.visible)
+            this._updateModifiedNodesSoon();
+    },
+
     _nodeInserted: function(event)
     {
         this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true});
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index e261234..2571a15 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -1125,7 +1125,7 @@ WebInspector.ElementsTreeElement.prototype = {
         delete this._editing;
 
         var textNode;
-        if (this.representedObject.nodeType == Node.ELEMENT_NODE) {
+        if (this.representedObject.nodeType === Node.ELEMENT_NODE) {
             // We only show text nodes inline in elements if the element only
             // has a single child, and that child is a text node.
             textNode = this.representedObject.firstChild;
@@ -1133,9 +1133,6 @@ WebInspector.ElementsTreeElement.prototype = {
             textNode = this.representedObject;
 
         textNode.nodeValue = newText;
-
-        // Need to restore attributes / node structure.
-        this.updateTitle();
     },
 
     _editingCancelled: function(element, context)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list