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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 function stylesCallback(targetNode) | 164 function stylesCallback(targetNode) |
165 { | 165 { |
166 InspectorTest.addSniffer(WebInspector.ComputedStyleSidebarPane.prototype
, "onContentReady", callback); | 166 InspectorTest.addSniffer(WebInspector.ComputedStyleSidebarPane.prototype
, "onContentReady", callback); |
167 WebInspector.panels.elements.sidebarPanes.computedStyle.expand(); | 167 WebInspector.panels.elements.sidebarPanes.computedStyle.expand(); |
168 } | 168 } |
169 | 169 |
170 InspectorTest.selectNodeAndWaitForStyles(idValue, stylesCallback); | 170 InspectorTest.selectNodeAndWaitForStyles(idValue, stylesCallback); |
171 } | 171 } |
172 | 172 |
| 173 InspectorTest.firstElementsTreeOutline = function() |
| 174 { |
| 175 return WebInspector.panels.elements._treeOutlines[0]; |
| 176 } |
| 177 |
173 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch
ed, omitLonghands, includeSelectorGroupMarks) | 178 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch
ed, omitLonghands, includeSelectorGroupMarks) |
174 { | 179 { |
175 function extractText(element) | 180 function extractText(element) |
176 { | 181 { |
177 var text = element.textContent; | 182 var text = element.textContent; |
178 if (text) | 183 if (text) |
179 return text; | 184 return text; |
180 var anchor = element.querySelector("[data-uncopyable]"); | 185 var anchor = element.querySelector("[data-uncopyable]"); |
181 if (!anchor) | 186 if (!anchor) |
182 return ""; | 187 return ""; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 var children = treeItem.children; | 486 var children = treeItem.children; |
482 var newPrefix = treeItem === treeItem.treeOutline ? "" : prefix + " "
; | 487 var newPrefix = treeItem === treeItem.treeOutline ? "" : prefix + " "
; |
483 for (var i = 0; depth && children && i < children.length; ++i) { | 488 for (var i = 0; depth && children && i < children.length; ++i) { |
484 if (!children[i]._elementCloseTag) | 489 if (!children[i]._elementCloseTag) |
485 print(children[i], newPrefix, depth - 1); | 490 print(children[i], newPrefix, depth - 1); |
486 else | 491 else |
487 print(children[i], prefix, depth); | 492 print(children[i], prefix, depth); |
488 } | 493 } |
489 } | 494 } |
490 | 495 |
491 var treeOutline = WebInspector.panels.elements.treeOutline; | 496 var treeOutline = InspectorTest.firstElementsTreeOutline(); |
492 treeOutline._updateModifiedNodes(); | 497 treeOutline._updateModifiedNodes(); |
493 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de
pth || 10000); | 498 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de
pth || 10000); |
494 }; | 499 }; |
495 | 500 |
496 InspectorTest.expandElementsTree = function(callback) | 501 InspectorTest.expandElementsTree = function(callback) |
497 { | 502 { |
498 callback = InspectorTest.safeWrap(callback); | 503 callback = InspectorTest.safeWrap(callback); |
499 | 504 |
500 function expand(treeItem) | 505 function expand(treeItem) |
501 { | 506 { |
502 var children = treeItem.children; | 507 var children = treeItem.children; |
503 for (var i = 0; children && i < children.length; ++i) { | 508 for (var i = 0; children && i < children.length; ++i) { |
504 children[i].expand(); | 509 children[i].expand(); |
505 expand(children[i]); | 510 expand(children[i]); |
506 } | 511 } |
507 } | 512 } |
508 | 513 |
509 function onAllNodesAvailable() | 514 function onAllNodesAvailable() |
510 { | 515 { |
511 WebInspector.panels.elements.treeOutline._updateModifiedNodes(); | 516 InspectorTest.firstElementsTreeOutline()._updateModifiedNodes(); |
512 expand(WebInspector.panels.elements.treeOutline); | 517 expand(InspectorTest.firstElementsTreeOutline()); |
513 callback(); | 518 callback(); |
514 } | 519 } |
515 WebInspector.inspectorView.showPanel("elements"); | 520 WebInspector.inspectorView.showPanel("elements"); |
516 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); | 521 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); |
517 }; | 522 }; |
518 | 523 |
519 InspectorTest.dumpDOMAgentTree = function(node) | 524 InspectorTest.dumpDOMAgentTree = function(node) |
520 { | 525 { |
521 if (!WebInspector.domModel._document) | 526 if (!WebInspector.domModel._document) |
522 return; | 527 return; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 { | 737 { |
733 var rectNames = ["margin", "border", "padding", "content"]; | 738 var rectNames = ["margin", "border", "padding", "content"]; |
734 var rects = window.internals.inspectorHighlightRects(document); | 739 var rects = window.internals.inspectorHighlightRects(document); |
735 for (var i = 0; i < rects.length; i++) | 740 for (var i = 0; i < rects.length; i++) |
736 { | 741 { |
737 var rectName = (i < rectNames.length ? rectNames[i] : "untitled"); | 742 var rectName = (i < rectNames.length ? rectNames[i] : "untitled"); |
738 var rect = rects.item(i); | 743 var rect = rects.item(i); |
739 output(rectName + " rect is " + rect.width + " x " + rect.height + " at
(" + rect.left + ", " + rect.top + ")"); | 744 output(rectName + " rect is " + rect.width + " x " + rect.height + " at
(" + rect.left + ", " + rect.top + ")"); |
740 } | 745 } |
741 } | 746 } |
OLD | NEW |