[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

knorton at google.com knorton at google.com
Thu Apr 8 01:04:55 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit affe54ee4e5b43c5512001933e0f143a8e18db0b
Author: knorton at google.com <knorton at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 03:47:59 2010 +0000

    2010-01-13  Kelly Norton  <knorton at google.com>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector does not update the DOM tree when attributes change.
            https://bugs.webkit.org/show_bug.cgi?id=20162
    
            * dom/Element.cpp: Moves callbacks to InspectorController directly into setAttribute
            and removeAttribute and removes the existing call sites. This makes it possible to
            see attribute modifications.
            (WebCore::Element::setAttribute):
            (WebCore::Element::dispatchAttrRemovalEvent):
            (WebCore::Element::dispatchAttrAdditionEvent):
            (WebCore::Element::removeAttribute):
            * inspector/front-end/DOMAgent.js:
            (WebInspector.DOMNode.prototype._setAttributesPayload): Clear existing attributes.
            (WebInspector.DOMAgent.prototype._didApplyDomChange): Updated call site and fixed style.
            (WebInspector.DOMAgent.prototype._attributesUpdated): Added.
            * inspector/front-end/ElementsPanel.js:
            (WebInspector.ElementsPanel.prototype._attributesUpdated): Added.
            (WebInspector.ElementsPanel.prototype.updateModifiedNodes): Updated call site.
            * inspector/front-end/ElementsTreeOutline.js: Renamed _updateTitle to updateTitle.
            (WebInspector.ElementsTreeElement.prototype.onattach): Updated updateTitle call site.
            (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted): Ditto.
            (WebInspector.ElementsTreeElement.prototype._editingCancelled): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53232 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e4e3014..c91e70c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-01-13  Kelly Norton  <knorton at google.com>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector does not update the DOM tree when attributes change.
+        https://bugs.webkit.org/show_bug.cgi?id=20162
+
+        * dom/Element.cpp: Moves callbacks to InspectorController directly into setAttribute
+        and removeAttribute and removes the existing call sites. This makes it possible to
+        see attribute modifications.
+        (WebCore::Element::setAttribute):
+        (WebCore::Element::dispatchAttrRemovalEvent):
+        (WebCore::Element::dispatchAttrAdditionEvent):
+        (WebCore::Element::removeAttribute):
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype._setAttributesPayload): Clear existing attributes.
+        (WebInspector.DOMAgent.prototype._didApplyDomChange): Updated call site and fixed style.
+        (WebInspector.DOMAgent.prototype._attributesUpdated): Added.
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._attributesUpdated): Added.
+        (WebInspector.ElementsPanel.prototype.updateModifiedNodes): Updated call site.
+        * inspector/front-end/ElementsTreeOutline.js: Renamed _updateTitle to updateTitle.
+        (WebInspector.ElementsTreeElement.prototype.onattach): Updated updateTitle call site.
+        (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted): Ditto.
+        (WebInspector.ElementsTreeElement.prototype._editingCancelled): Ditto.
+
 2010-01-13  Carol Szabo <carol.szabo at nokia.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index c3b15f5..62f8d4c 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -535,7 +535,7 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value,
 
     if (localName == idAttributeName().localName())
         updateId(old ? old->value() : nullAtom, value);
-    
+
     if (old && value.isNull())
         namedAttrMap->removeAttribute(old->name());
     else if (!old && !value.isNull())
@@ -544,6 +544,13 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value,
         old->setValue(value);
         attributeChanged(old);
     }
+
+#if ENABLE(INSPECTOR)
+    if (Page* page = document()->page()) {
+        if (InspectorController* inspectorController = page->inspectorController())
+            inspectorController->didModifyDOMAttr(this);
+    }
+#endif
 }
 
 void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&)
@@ -555,7 +562,7 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value,
 
     if (name == idAttributeName())
         updateId(old ? old->value() : nullAtom, value);
-    
+
     if (old && value.isNull())
         namedAttrMap->removeAttribute(name);
     else if (!old && !value.isNull())
@@ -564,6 +571,13 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value,
         old->setValue(value);
         attributeChanged(old);
     }
+
+#if ENABLE(INSPECTOR)
+    if (Page* page = document()->page()) {
+        if (InspectorController* inspectorController = page->inspectorController())
+            inspectorController->didModifyDOMAttr(this);
+    }
+#endif
 }
 
 PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const AtomicString& value)
@@ -1007,13 +1021,6 @@ void Element::dispatchAttrRemovalEvent(Attribute*)
 {
     ASSERT(!eventDispatchForbidden());
 
-#if ENABLE(INSPECTOR)
-    if (Page* page = document()->page()) {
-      if (InspectorController* inspectorController = page->inspectorController())
-          inspectorController->didModifyDOMAttr(this);
-    }
-#endif
-
 #if 0
     if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
         return;
@@ -1027,13 +1034,6 @@ void Element::dispatchAttrAdditionEvent(Attribute*)
 {
     ASSERT(!eventDispatchForbidden());
 
-#if ENABLE(INSPECTOR)
-    if (Page* page = document()->page()) {
-      if (InspectorController* inspectorController = page->inspectorController())
-          inspectorController->didModifyDOMAttr(this);
-    }
-#endif
-
 #if 0
     if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
         return;
@@ -1173,6 +1173,14 @@ void Element::removeAttribute(const String& name, ExceptionCode& ec)
         if (ec == NOT_FOUND_ERR)
             ec = 0;
     }
+    
+#if ENABLE(INSPECTOR)
+    if (Page* page = document()->page()) {
+        if (InspectorController* inspectorController = page->inspectorController())
+            inspectorController->didModifyDOMAttr(this);
+    }
+#endif
+    
 }
 
 void Element::removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode& ec)
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 480a43e..c072d8a 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -140,6 +140,8 @@ WebInspector.DOMNode.prototype = {
 
     _setAttributesPayload: function(attrs)
     {
+        this.attributes = [];
+        this._attributesMap = {};
         for (var i = 0; i < attrs.length; i += 2)
             this._addAttribute(attrs[i], attrs[i + 1]);
     },
@@ -363,15 +365,16 @@ WebInspector.DOMAgent.prototype = {
         callback();
         // TODO(pfeldman): Fix this hack.
         var elem = WebInspector.panels.elements.treeOutline.findTreeElement(node);
-        if (elem) {
-            elem._updateTitle();
-        }
+        if (elem)
+            elem.updateTitle();
     },
 
     _attributesUpdated: function(nodeId, attrsArray)
     {
         var node = this._idToDOMNode[nodeId];
         node._setAttributesPayload(attrsArray);
+        var event = {target: node};
+        this.document._fireDomEvent("DOMAttrModified", event);
     },
 
     nodeForId: function(nodeId) {
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index a8e72ca..93dd700 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -205,6 +205,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));
 
         this.treeOutline.suppressSelectHighlight = true;
         this.rootDOMNode = inspectedRootDocument;
@@ -477,6 +478,13 @@ WebInspector.ElementsPanel.prototype = {
         this.treeOutline.focusedDOMNode = x;
     },
 
+    _attributesUpdated: 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});
@@ -511,6 +519,14 @@ WebInspector.ElementsPanel.prototype = {
         for (var i = 0; i < this.recentlyModifiedNodes.length; ++i) {
             var replaced = this.recentlyModifiedNodes[i].replaced;
             var parent = this.recentlyModifiedNodes[i].parent;
+            var node = this.recentlyModifiedNodes[i].node;
+
+            if (this.recentlyModifiedNodes[i].updated) {
+                var nodeItem = this.treeOutline.findTreeElement(node);
+                nodeItem.updateTitle();
+                continue;
+            }
+            
             if (!parent)
                 continue;
 
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index 12cd1aa..dfed7ff 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -394,7 +394,7 @@ WebInspector.ElementsTreeElement.prototype = {
             this.listItemElement.addStyleClass("hovered");
         }
 
-        this._updateTitle();
+        this.updateTitle();
 
         this._preventFollowingLinksOnDoubleClick();
     },
@@ -858,7 +858,7 @@ WebInspector.ElementsTreeElement.prototype = {
         textNode.nodeValue = newText;
 
         // Need to restore attributes / node structure.
-        this._updateTitle();
+        this.updateTitle();
     },
 
     _editingCancelled: function(element, context)
@@ -866,13 +866,13 @@ WebInspector.ElementsTreeElement.prototype = {
         delete this._editing;
 
         // Need to restore attributes structure.
-        this._updateTitle();
+        this.updateTitle();
     },
 
-    _updateTitle: function()
+    updateTitle: function()
     {
         // If we are editing, return early to prevent canceling the edit.
-        // After editing is committed _updateTitle will be called.
+        // After editing is committed updateTitle will be called.
         if (this._editing)
             return;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list