Changeset 144057 in webkit
- Timestamp:
- Feb 26, 2013, 7:57:50 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector-protocol/dom-request-child-nodes-depth-expected.txt (modified) (1 diff)
-
LayoutTests/inspector-protocol/dom-request-child-nodes-depth.html (modified) (5 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/InspectorDOMAgent.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r144055 r144057 1 2013-02-25 Antoine Quint <graouts@apple.com> 2 3 Web Inspector: Cannot deep expand an element that has previously been partially expanded 4 https://bugs.webkit.org/show_bug.cgi?id=110424 5 6 Update existing test for InspectorDOMAgent::requestChildNodes to cover the case 7 where we want to request children for a node that already has had children pushed 8 but may not have pushed children at the depth requested. 9 10 Reviewed by Pavel Feldman. 11 12 * inspector-protocol/dom-request-child-nodes-depth-expected.txt: 13 * inspector-protocol/dom-request-child-nodes-depth.html: 14 1 15 2013-02-26 Martin Robinson <mrobinson@igalia.com> 2 16 -
trunk/LayoutTests/inspector-protocol/dom-request-child-nodes-depth-expected.txt
r139429 r144057 10 10 PASS: First child has no .children property 11 11 12 === Get all children of div#depth-1 === 12 === Get children of div#depth-1 three levels deep === 13 14 PASS: div#depth-1 has nodes 3 levels deep 15 16 === Get all children of body === 13 17 14 18 PASS: div#depth-1 has nodes 9 levels deep -
trunk/LayoutTests/inspector-protocol/dom-request-child-nodes-depth.html
r139429 r144057 6 6 function test() 7 7 { 8 8 var firstDiv; 9 9 var eventsCount = 0; 10 10 … … 18 18 gotImmediateChildren(messageObject); 19 19 else if (eventsCount === 2) 20 gotAdditionalChildren(messageObject); 21 else if (eventsCount === 3) 20 22 gotAllChildren(messageObject); 23 else 24 InspectorTest.log(JSON.stringify(messageObject, null, " ")); 21 25 }; 22 26 … … 44 48 function gotImmediateChildren(messageObject) 45 49 { 46 var firstChild= messageObject.params.nodes[0];47 assert("First child is a div", first Child.localName, "div");48 assert("First child is div#depth-1", first Child.attributes[1], "depth-1");49 assert("First child has one child", first Child.childNodeCount, 1);50 assert("First child has no .children property", first Child.children, undefined);50 firstDiv = messageObject.params.nodes[0]; 51 assert("First child is a div", firstDiv.localName, "div"); 52 assert("First child is div#depth-1", firstDiv.attributes[1], "depth-1"); 53 assert("First child has one child", firstDiv.childNodeCount, 1); 54 assert("First child has no .children property", firstDiv.children, undefined); 51 55 52 56 step({ 53 name: "Get all children of div#depth-1",57 name: "Get children of div#depth-1 three levels deep", 54 58 command: "DOM.requestChildNodes", 55 parameters: {"nodeId": firstChild.nodeId, "depth": -1} 59 parameters: {"nodeId": firstDiv.nodeId, "depth": 3} 60 }); 61 }; 62 63 function gotAdditionalChildren(messageObject) 64 { 65 var depth = 1; 66 var firstChild = messageObject.params.nodes[0]; 67 var node = firstChild; 68 while (node && node.children) { 69 depth++; 70 node = node.children[0]; 71 } 72 73 assert("div#depth-1 has nodes 3 levels deep", depth, 3); 74 75 step({ 76 name: "Get all children of body", 77 command: "DOM.requestChildNodes", 78 parameters: {"nodeId": firstDiv.nodeId, "depth": -1} 56 79 }); 57 80 }; … … 67 90 } 68 91 69 assert("div#depth-1 has nodes 9 levels deep", depth, 9); 92 // We have requested nodes 3-level deep so far, so 93 // we should have gotten an additional 6 levels of depth. 94 assert("div#depth-1 has nodes 9 levels deep", depth, 6); 70 95 71 96 step({ 72 97 name: "Pass an invalid depth", 73 98 command: "DOM.requestChildNodes", 74 parameters: {"nodeId": first Child.nodeId, "depth": 0},99 parameters: {"nodeId": firstDiv.nodeId, "depth": 0}, 75 100 callback: finishTest 76 101 }); … … 79 104 function finishTest() 80 105 { 81 assert("Expected number of setChildNodes events", eventsCount, 2);106 assert("Expected number of setChildNodes events", eventsCount, 3); 82 107 83 108 InspectorTest.completeTest(); -
trunk/Source/WebCore/ChangeLog
r144053 r144057 1 2013-02-26 Antoine Quint <graouts@apple.com> 2 3 Web Inspector: Cannot deep expand an element that has previously been partially expanded 4 https://bugs.webkit.org/show_bug.cgi?id=110424 5 6 In the case where the children from the provided node have already been pushed, traverse 7 children at the depth provided until we find children that have not been pushed yet. 8 9 Reviewed by Pavel Feldman. 10 11 * inspector/InspectorDOMAgent.cpp: 12 (WebCore::InspectorDOMAgent::pushChildNodesToFrontend): 13 1 14 2013-02-26 Andrey Kosyakov <caseq@chromium.org> 2 15 -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r143574 r144057 444 444 if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE)) 445 445 return; 446 if (m_childrenRequested.contains(nodeId))447 return;448 446 449 447 NodeToIdMap* nodeMap = m_idToNodesMap.get(nodeId); 448 449 if (m_childrenRequested.contains(nodeId)) { 450 if (depth <= 1) 451 return; 452 453 depth--; 454 455 for (node = innerFirstChild(node); node; node = innerNextSibling(node)) { 456 int childNodeId = nodeMap->get(node); 457 ASSERT(childNodeId); 458 pushChildNodesToFrontend(childNodeId, depth); 459 } 460 461 return; 462 } 463 450 464 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = buildArrayForContainerChildren(node, depth, nodeMap); 451 465 m_frontend->setChildNodes(nodeId, children.release());
Note:
See TracChangeset
for help on using the changeset viewer.