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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 var selectors = []; | 721 var selectors = []; |
722 for (var i = 0; i < rule.matchingSelectors.length; ++i) | 722 for (var i = 0; i < rule.matchingSelectors.length; ++i) |
723 selectors.push(rule.selectors[rule.matchingSelectors[i]].value); | 723 selectors.push(rule.selectors[rule.matchingSelectors[i]].value); |
724 return "[" + selectors.join(", ") + "]"; | 724 return "[" + selectors.join(", ") + "]"; |
725 } | 725 } |
726 | 726 |
727 InspectorTest.addNewRule = function(selector, callback) | 727 InspectorTest.addNewRule = function(selector, callback) |
728 { | 728 { |
729 // Click "Add new rule". | 729 // Click "Add new rule". |
730 document.getElementById("add-style-button-test-id").click(); | 730 document.getElementById("add-style-button-test-id").click(); |
731 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2
]; | 731 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlan
kSection", onBlankSection); |
732 if (typeof selector === "string") | 732 |
733 section._selectorElement.textContent = selector; | 733 function onBlankSection() |
734 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter")
); | 734 { |
735 InspectorTest.runAfterPendingDispatches(callback.bind(null, section)); | 735 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; |
| 736 if (typeof selector === "string") |
| 737 section._selectorElement.textContent = selector; |
| 738 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Ent
er")); |
| 739 InspectorTest.runAfterPendingDispatches(callback.bind(null, section)); |
| 740 } |
736 } | 741 } |
737 | 742 |
738 InspectorTest.dumpInspectorHighlight = function(node, callback) | 743 InspectorTest.dumpInspectorHighlight = function(node, callback) |
739 { | 744 { |
740 node.boxModel(function(boxModel) { | 745 node.boxModel(function(boxModel) { |
741 var rectNames = ["margin", "border", "padding", "content"]; | 746 var rectNames = ["margin", "border", "padding", "content"]; |
742 for (var i = 0; i < rectNames.length; i++) { | 747 for (var i = 0; i < rectNames.length; i++) { |
743 var rect = boxModel[rectNames[i]]; | 748 var rect = boxModel[rectNames[i]]; |
744 InspectorTest.addResult(rectNames[i] + " rect is " + (rect[4] - rect
[0]) + " x " + (rect[5] - rect[1]) + " at (" + rect[0] + ", " + rect[1] + ")"); | 749 InspectorTest.addResult(rectNames[i] + " rect is " + (rect[4] - rect
[0]) + " x " + (rect[5] - rect[1]) + " at (" + rect[0] + ", " + rect[1] + ")"); |
745 } | 750 } |
746 callback(); | 751 callback(); |
747 }); | 752 }); |
748 } | 753 } |
749 | 754 |
750 InspectorTest.dumpInspectorHighlightShape = function(node, callback) | 755 InspectorTest.dumpInspectorHighlightShape = function(node, callback) |
751 { | 756 { |
752 node.boxModel(function(shapes) { | 757 node.boxModel(function(shapes) { |
753 InspectorTest.addResult(JSON.stringify(shapes.shapeOutside.shape)); | 758 InspectorTest.addResult(JSON.stringify(shapes.shapeOutside.shape)); |
754 callback(); | 759 callback(); |
755 }); | 760 }); |
756 } | 761 } |
757 | 762 |
758 }; | 763 }; |
OLD | NEW |