Modified: trunk/LayoutTests/inspector-protocol/dom-request-child-nodes-depth.html (144056 => 144057)
--- trunk/LayoutTests/inspector-protocol/dom-request-child-nodes-depth.html 2013-02-26 15:53:23 UTC (rev 144056)
+++ trunk/LayoutTests/inspector-protocol/dom-request-child-nodes-depth.html 2013-02-26 15:57:50 UTC (rev 144057)
@@ -5,7 +5,7 @@
function test()
{
-
+ var firstDiv;
var eventsCount = 0;
getDocument();
@@ -17,7 +17,11 @@
if (eventsCount === 1)
gotImmediateChildren(messageObject);
else if (eventsCount === 2)
+ gotAdditionalChildren(messageObject);
+ else if (eventsCount === 3)
gotAllChildren(messageObject);
+ else
+ InspectorTest.log(JSON.stringify(messageObject, null, " "));
};
function getDocument()
@@ -43,16 +47,35 @@
function gotImmediateChildren(messageObject)
{
+ firstDiv = messageObject.params.nodes[0];
+ assert("First child is a div", firstDiv.localName, "div");
+ assert("First child is div#depth-1", firstDiv.attributes[1], "depth-1");
+ assert("First child has one child", firstDiv.childNodeCount, 1);
+ assert("First child has no .children property", firstDiv.children, undefined);
+
+ step({
+ name: "Get children of div#depth-1 three levels deep",
+ command: "DOM.requestChildNodes",
+ parameters: {"nodeId": firstDiv.nodeId, "depth": 3}
+ });
+ };
+
+ function gotAdditionalChildren(messageObject)
+ {
+ var depth = 1;
var firstChild = messageObject.params.nodes[0];
- assert("First child is a div", firstChild.localName, "div");
- assert("First child is div#depth-1", firstChild.attributes[1], "depth-1");
- assert("First child has one child", firstChild.childNodeCount, 1);
- assert("First child has no .children property", firstChild.children, undefined);
+ var node = firstChild;
+ while (node && node.children) {
+ depth++;
+ node = node.children[0];
+ }
+ assert("div#depth-1 has nodes 3 levels deep", depth, 3);
+
step({
- name: "Get all children of div#depth-1",
+ name: "Get all children of body",
command: "DOM.requestChildNodes",
- parameters: {"nodeId": firstChild.nodeId, "depth": -1}
+ parameters: {"nodeId": firstDiv.nodeId, "depth": -1}
});
};
@@ -66,19 +89,21 @@
node = node.children[0];
}
- assert("div#depth-1 has nodes 9 levels deep", depth, 9);
+ // We have requested nodes 3-level deep so far, so
+ // we should have gotten an additional 6 levels of depth.
+ assert("div#depth-1 has nodes 9 levels deep", depth, 6);
step({
name: "Pass an invalid depth",
command: "DOM.requestChildNodes",
- parameters: {"nodeId": firstChild.nodeId, "depth": 0},
+ parameters: {"nodeId": firstDiv.nodeId, "depth": 0},
callback: finishTest
});
};
function finishTest()
{
- assert("Expected number of setChildNodes events", eventsCount, 2);
+ assert("Expected number of setChildNodes events", eventsCount, 3);
InspectorTest.completeTest();
};
Modified: trunk/Source/WebCore/ChangeLog (144056 => 144057)
--- trunk/Source/WebCore/ChangeLog 2013-02-26 15:53:23 UTC (rev 144056)
+++ trunk/Source/WebCore/ChangeLog 2013-02-26 15:57:50 UTC (rev 144057)
@@ -1,3 +1,16 @@
+2013-02-26 Antoine Quint <[email protected]>
+
+ Web Inspector: Cannot deep expand an element that has previously been partially expanded
+ https://bugs.webkit.org/show_bug.cgi?id=110424
+
+ In the case where the children from the provided node have already been pushed, traverse
+ children at the depth provided until we find children that have not been pushed yet.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::pushChildNodesToFrontend):
+
2013-02-26 Andrey Kosyakov <[email protected]>
Unreviewed, rolling out r144041, r144044, and r144048.
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (144056 => 144057)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2013-02-26 15:53:23 UTC (rev 144056)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2013-02-26 15:57:50 UTC (rev 144057)
@@ -443,10 +443,24 @@
Node* node = nodeForId(nodeId);
if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE))
return;
- if (m_childrenRequested.contains(nodeId))
+
+ NodeToIdMap* nodeMap = m_idToNodesMap.get(nodeId);
+
+ if (m_childrenRequested.contains(nodeId)) {
+ if (depth <= 1)
+ return;
+
+ depth--;
+
+ for (node = innerFirstChild(node); node; node = innerNextSibling(node)) {
+ int childNodeId = nodeMap->get(node);
+ ASSERT(childNodeId);
+ pushChildNodesToFrontend(childNodeId, depth);
+ }
+
return;
+ }
- NodeToIdMap* nodeMap = m_idToNodesMap.get(nodeId);
RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = buildArrayForContainerChildren(node, depth, nodeMap);
m_frontend->setChildNodes(nodeId, children.release());
}