[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

loislo at chromium.org loislo at chromium.org
Sun Feb 20 22:46:55 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 170e93b8362250788cc1a6e19e46e50d587729e8
Author: loislo at chromium.org <loislo at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 11 14:07:34 2011 +0000

    2011-01-11  Ilya Tikhonovsky  <loislo at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: innerFirstChild has a side effect which should be called explicitly.
    
            If a node is a frame's owner then innerFirstChild method
            subscribes DOMAgent instance to the frame's doc's events.
            I think this should be done explicitly when we meet with
            the node for the first time. As I understand it happens
            in buildArrayForContainerChildren method.
    
            https://bugs.webkit.org/show_bug.cgi?id=52204
    
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::startListeningFrameDoc):
            (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
            (WebCore::InspectorDOMAgent::innerFirstChild):
            * inspector/InspectorDOMAgent.h:
    
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 77776f0..6333340 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2011-01-11  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: innerFirstChild has a side effect which should be called explicitly.
+
+        If a node is a frame's owner then innerFirstChild method
+        subscribes DOMAgent instance to the frame's doc's events.
+        I think this should be done explicitly when we meet with
+        the node for the first time. As I understand it happens
+        in buildArrayForContainerChildren method.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52204
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::startListeningFrameDoc):
+        (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
+        (WebCore::InspectorDOMAgent::innerFirstChild):
+        * inspector/InspectorDOMAgent.h:
+
 2011-01-11  Adam Roben  <aroben at apple.com>
 
         Delete WKCACFLayer.{cpp,h}
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index e42bf2a..5d8f408 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -268,6 +268,15 @@ void InspectorDOMAgent::releaseDanglingNodes()
     m_danglingNodeToIdMaps.clear();
 }
 
+void InspectorDOMAgent::startListeningFrameDocument(Node* frameOwnerNode)
+{
+    ASSERT(frameOwnerNode->isFrameOwnerElement());
+    HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(frameOwnerNode);
+    Document* doc = frameOwner->contentDocument();
+    if (doc)
+        startListening(doc);
+}
+
 void InspectorDOMAgent::startListening(Document* doc)
 {
     if (m_documents.contains(doc))
@@ -947,20 +956,24 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForElementAttributes(Ele
 PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap)
 {
     RefPtr<InspectorArray> children = InspectorArray::create();
+    Node* child = innerFirstChild(container);
+
     if (depth == 0) {
         // Special case the_only text child.
-        if (innerChildNodeCount(container) == 1) {
-            Node *child = innerFirstChild(container);
-            if (child->nodeType() == Node::TEXT_NODE)
-                children->pushObject(buildObjectForNode(child, 0, nodesMap));
-        }
+        if (child && child->nodeType() == Node::TEXT_NODE && !innerNextSibling(child))
+            children->pushObject(buildObjectForNode(child, 0, nodesMap));
         return children.release();
     } else if (depth > 0) {
         depth--;
     }
 
-    for (Node *child = innerFirstChild(container); child; child = innerNextSibling(child))
+    if (container->isFrameOwnerElement())
+        startListeningFrameDocument(container);
+
+    while (child) {
         children->pushObject(buildObjectForNode(child, depth, nodesMap));
+        child = innerNextSibling(child);
+    }
     return children.release();
 }
 
@@ -987,10 +1000,8 @@ Node* InspectorDOMAgent::innerFirstChild(Node* node)
     if (node->isFrameOwnerElement()) {
         HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(node);
         Document* doc = frameOwner->contentDocument();
-        if (doc) {
-            startListening(doc);
+        if (doc)
             return doc->firstChild();
-        }
     }
     node = node->firstChild();
     while (isWhitespace(node))
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h
index 1611baa..36627f5 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.h
+++ b/Source/WebCore/inspector/InspectorDOMAgent.h
@@ -148,6 +148,7 @@ namespace WebCore {
         void removeDOMBreakpoint(long nodeId, long type);
 
     private:
+        void startListeningFrameDocument(Node* frameOwnerNode);
         void startListening(Document* document);
         void stopListening(Document* document);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list