Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1443)

Side by Side Diff: LayoutTests/http/tests/inspector/elements-test.js

Issue 701153002: DevTools: [Elements] Highlight DOM updates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refactored UpdateInfo fill-in and their use when building titles Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function getInspectorHighlightJSON(nodeId, opt_frameId) 1 function getInspectorHighlightJSON(nodeId, opt_frameId)
2 { 2 {
3 var doc = document; 3 var doc = document;
4 if (opt_frameId) 4 if (opt_frameId)
5 doc = document.getElementById(opt_frameId).contentDocument; 5 doc = document.getElementById(opt_frameId).contentDocument;
6 return window.internals.inspectorHighlightJSON(doc.getElementById(nodeId)); 6 return window.internals.inspectorHighlightJSON(doc.getElementById(nodeId));
7 } 7 }
8 8
9 var initialize_ElementTest = function() { 9 var initialize_ElementTest = function() {
10 10
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 else 500 else
501 print(children[i], prefix, depth); 501 print(children[i], prefix, depth);
502 } 502 }
503 } 503 }
504 504
505 var treeOutline = InspectorTest.firstElementsTreeOutline(); 505 var treeOutline = InspectorTest.firstElementsTreeOutline();
506 treeOutline._updateModifiedNodes(); 506 treeOutline._updateModifiedNodes();
507 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de pth || 10000); 507 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de pth || 10000);
508 }; 508 };
509 509
510 InspectorTest.dumpDOMUpdateHighlights = function(rootNode, depth)
511 {
512 var treeOutline = InspectorTest.firstElementsTreeOutline();
513 treeOutline._updateModifiedNodes();
514 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de pth || 10000);
515
516 function print(treeItem, prefix, depth)
517 {
518 if (treeItem.listItemElement) {
519 var elementXPath = WebInspector.DOMPresentationUtils.xPath(treeItem. _node, true);
520 var highlightedElements = treeItem.listItemElement.querySelectorAll( ".dom-update-highlight");
521 for (var i = 0; i < highlightedElements.length; ++i) {
522 var element = highlightedElements[i];
523 var classList = element.classList;
524 var xpath = elementXPath;
525 if (classList.contains("webkit-html-attribute-name")) {
526 xpath += "/@" + element.textContent + " (empty)";
527 } else if (classList.contains("webkit-html-attribute-value")) {
528 name = element.parentElement.querySelector(".webkit-html-att ribute-name").textContent;
529 xpath += "/@" + name + " " + element.textContent;
530 } else if (classList.contains("webkit-html-text-node")) {
531 xpath += "/text() \"" + element.textContent + "\"";
532 }
533 InspectorTest.addResult(prefix + xpath);
534 }
535 }
536
537 if (!treeItem.expanded)
538 return;
539
540 var children = treeItem.children;
541 var newPrefix = treeItem === treeItem.treeOutline ? "" : prefix + " " ;
542 for (var i = 0; depth && children && i < children.length; ++i) {
543 if (!children[i]._elementCloseTag)
544 print(children[i], newPrefix, depth - 1);
545 }
546 }
547 }
548
510 InspectorTest.expandElementsTree = function(callback) 549 InspectorTest.expandElementsTree = function(callback)
511 { 550 {
512 var expandedSomething = false; 551 var expandedSomething = false;
513 callback = InspectorTest.safeWrap(callback); 552 callback = InspectorTest.safeWrap(callback);
514 553
515 function expand(treeItem) 554 function expand(treeItem)
516 { 555 {
517 var children = treeItem.children; 556 var children = treeItem.children;
518 for (var i = 0; children && i < children.length; ++i) { 557 for (var i = 0; children && i < children.length; ++i) {
519 var child = children[i]; 558 var child = children[i];
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 function innerCallback(result) 827 function innerCallback(result)
789 { 828 {
790 InspectorTest.addResult(nodeId + ": " + result.description); 829 InspectorTest.addResult(nodeId + ": " + result.description);
791 callback(); 830 callback();
792 } 831 }
793 opt_frameId = opt_frameId || ""; 832 opt_frameId = opt_frameId || "";
794 InspectorTest.evaluateInPage("getInspectorHighlightJSON(\"" + nodeId + "\", \"" + opt_frameId + "\")", innerCallback); 833 InspectorTest.evaluateInPage("getInspectorHighlightJSON(\"" + nodeId + "\", \"" + opt_frameId + "\")", innerCallback);
795 } 834 }
796 835
797 }; 836 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698