OLD | NEW |
1 var initialize_ElementTest = function() { | 1 var initialize_ElementTest = function() { |
2 | 2 |
3 InspectorTest.findNode = function(matchFunction, callback) | 3 InspectorTest.findNode = function(matchFunction, callback) |
4 { | 4 { |
5 callback = InspectorTest.safeWrap(callback); | 5 callback = InspectorTest.safeWrap(callback); |
6 var result = null; | 6 var result = null; |
7 var pendingRequests = 0; | 7 var pendingRequests = 0; |
8 function processChildren(node) | 8 function processChildren(node) |
9 { | 9 { |
10 try { | 10 try { |
(...skipping 17 matching lines...) Expand all Loading... |
28 childNode.getChildNodes(processChildren.bind(null, childNode)); | 28 childNode.getChildNodes(processChildren.bind(null, childNode)); |
29 } | 29 } |
30 } finally { | 30 } finally { |
31 pendingRequests--; | 31 pendingRequests--; |
32 } | 32 } |
33 | 33 |
34 if (!result && !pendingRequests) | 34 if (!result && !pendingRequests) |
35 callback(null); | 35 callback(null); |
36 } | 36 } |
37 | 37 |
38 WebInspector.domAgent.requestDocument(documentRequested.bind(this)); | 38 WebInspector.domModel.requestDocument(documentRequested.bind(this)); |
39 function documentRequested(doc) | 39 function documentRequested(doc) |
40 { | 40 { |
41 pendingRequests++; | 41 pendingRequests++; |
42 doc.getChildNodes(processChildren.bind(null, doc)); | 42 doc.getChildNodes(processChildren.bind(null, doc)); |
43 } | 43 } |
44 }; | 44 }; |
45 | 45 |
46 InspectorTest.nodeWithId = function(idValue, callback) | 46 InspectorTest.nodeWithId = function(idValue, callback) |
47 { | 47 { |
48 function nodeIdMatches(node) | 48 function nodeIdMatches(node) |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 WebInspector.panels.elements.treeOutline._updateModifiedNodes(); | 511 WebInspector.panels.elements.treeOutline._updateModifiedNodes(); |
512 expand(WebInspector.panels.elements.treeOutline); | 512 expand(WebInspector.panels.elements.treeOutline); |
513 callback(); | 513 callback(); |
514 } | 514 } |
515 WebInspector.inspectorView.showPanel("elements"); | 515 WebInspector.inspectorView.showPanel("elements"); |
516 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); | 516 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); |
517 }; | 517 }; |
518 | 518 |
519 InspectorTest.dumpDOMAgentTree = function(node) | 519 InspectorTest.dumpDOMAgentTree = function(node) |
520 { | 520 { |
521 if (!WebInspector.domAgent._document) | 521 if (!WebInspector.domModel._document) |
522 return; | 522 return; |
523 | 523 |
524 function dump(node, prefix) | 524 function dump(node, prefix) |
525 { | 525 { |
526 InspectorTest.addResult(prefix + node.nodeName()); | 526 InspectorTest.addResult(prefix + node.nodeName()); |
527 prefix = prefix + " "; | 527 prefix = prefix + " "; |
528 | 528 |
529 if (node.templateContent()) | 529 if (node.templateContent()) |
530 dump(node.templateContent(), prefix); | 530 dump(node.templateContent(), prefix); |
531 if (node.importedDocument()) | 531 if (node.importedDocument()) |
(...skipping 23 matching lines...) Expand all Loading... |
555 var testNode = InspectorTest.expandedNodeWithId(/function\s([^(]*)/.exec
(testBody)[1]); | 555 var testNode = InspectorTest.expandedNodeWithId(/function\s([^(]*)/.exec
(testBody)[1]); |
556 InspectorTest.addResult("Initial:"); | 556 InspectorTest.addResult("Initial:"); |
557 InspectorTest.dumpElementsTree(testNode); | 557 InspectorTest.dumpElementsTree(testNode); |
558 | 558 |
559 testBody(undo); | 559 testBody(undo); |
560 | 560 |
561 function undo() | 561 function undo() |
562 { | 562 { |
563 InspectorTest.addResult("Post-action:"); | 563 InspectorTest.addResult("Post-action:"); |
564 InspectorTest.dumpElementsTree(testNode); | 564 InspectorTest.dumpElementsTree(testNode); |
565 WebInspector.domAgent.undo(redo); | 565 WebInspector.domModel.undo(redo); |
566 } | 566 } |
567 | 567 |
568 function redo() | 568 function redo() |
569 { | 569 { |
570 InspectorTest.addResult("Post-undo (initial):"); | 570 InspectorTest.addResult("Post-undo (initial):"); |
571 InspectorTest.dumpElementsTree(testNode); | 571 InspectorTest.dumpElementsTree(testNode); |
572 WebInspector.domAgent.redo(done); | 572 WebInspector.domModel.redo(done); |
573 } | 573 } |
574 | 574 |
575 function done() | 575 function done() |
576 { | 576 { |
577 InspectorTest.addResult("Post-redo (action):"); | 577 InspectorTest.addResult("Post-redo (action):"); |
578 InspectorTest.dumpElementsTree(testNode); | 578 InspectorTest.dumpElementsTree(testNode); |
579 next(); | 579 next(); |
580 } | 580 } |
581 } | 581 } |
582 result.toString = function() | 582 result.toString = function() |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 { | 732 { |
733 var rectNames = ["margin", "border", "padding", "content"]; | 733 var rectNames = ["margin", "border", "padding", "content"]; |
734 var rects = window.internals.inspectorHighlightRects(document); | 734 var rects = window.internals.inspectorHighlightRects(document); |
735 for (var i = 0; i < rects.length; i++) | 735 for (var i = 0; i < rects.length; i++) |
736 { | 736 { |
737 var rectName = (i < rectNames.length ? rectNames[i] : "untitled"); | 737 var rectName = (i < rectNames.length ? rectNames[i] : "untitled"); |
738 var rect = rects.item(i); | 738 var rect = rects.item(i); |
739 output(rectName + " rect is " + rect.width + " x " + rect.height + " at
(" + rect.left + ", " + rect.top + ")"); | 739 output(rectName + " rect is " + rect.width + " x " + rect.height + " at
(" + rect.left + ", " + rect.top + ")"); |
740 } | 740 } |
741 } | 741 } |
OLD | NEW |