| OLD | NEW |
| 1 function initialize_cssTest() | 1 function initialize_cssTest() |
| 2 { | 2 { |
| 3 | 3 |
| 4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) | 4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) |
| 5 { | 5 { |
| 6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl
eSheetId }, onStyleSheetText); | 6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl
eSheetId }, onStyleSheetText); |
| 7 function onStyleSheetText(result) | 7 function onStyleSheetText(result) |
| 8 { | 8 { |
| 9 InspectorTest.log("==== Style sheet text ===="); | 9 InspectorTest.log("==== Style sheet text ===="); |
| 10 InspectorTest.log(result.text); | 10 InspectorTest.log(result.text); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 log(4, propertyLine); | 113 log(4, propertyLine); |
| 114 } | 114 } |
| 115 log(0, "}"); | 115 log(0, "}"); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 InspectorTest.displayName = function(url) | 118 InspectorTest.displayName = function(url) |
| 119 { | 119 { |
| 120 return url.substr(url.lastIndexOf("/") + 1); | 120 return url.substr(url.lastIndexOf("/") + 1); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 InspectorTest.loadAndDumpMatchingRulesForNode = function(nodeId, callback) | 123 InspectorTest.loadAndDumpMatchingRules = function(nodeId, callback) |
| 124 { | 124 { |
| 125 InspectorTest.sendCommandOrDie("CSS.getMatchedStylesForNode", { "nodeId": no
deId }, matchingRulesLoaded); | 125 InspectorTest.requestNodeId(nodeId, nodeIdLoaded); |
| 126 |
| 127 function nodeIdLoaded(nodeId) |
| 128 { |
| 129 InspectorTest.sendCommandOrDie("CSS.getMatchedStylesForNode", { "nodeId"
: nodeId }, matchingRulesLoaded); |
| 130 } |
| 126 | 131 |
| 127 function matchingRulesLoaded(result) | 132 function matchingRulesLoaded(result) |
| 128 { | 133 { |
| 129 InspectorTest.log("Dumping matched rules: "); | 134 InspectorTest.log("Dumping matched rules: "); |
| 130 var ruleMatches = result.matchedCSSRules; | 135 var ruleMatches = result.matchedCSSRules; |
| 131 for (var i = 0; i < ruleMatches.length; ++i) { | 136 for (var i = 0; i < ruleMatches.length; ++i) { |
| 132 var ruleMatch = ruleMatches[i]; | 137 var ruleMatch = ruleMatches[i]; |
| 133 var origin = ruleMatch.rule.origin; | 138 var origin = ruleMatch.rule.origin; |
| 134 if (origin !== "inspector" && origin !== "regular") | 139 if (origin !== "inspector" && origin !== "regular") |
| 135 continue; | 140 continue; |
| 136 InspectorTest.dumpRuleMatch(ruleMatch); | 141 InspectorTest.dumpRuleMatch(ruleMatch); |
| 137 } | 142 } |
| 138 callback(); | 143 callback(); |
| 139 } | 144 } |
| 140 } | 145 } |
| 141 | 146 |
| 142 InspectorTest.loadAndDumpMatchingRules = function(selector, callback) | |
| 143 { | |
| 144 InspectorTest.requestNodeId(selector, nodeIdLoaded); | |
| 145 | |
| 146 function nodeIdLoaded(nodeId) | |
| 147 { | |
| 148 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback); | |
| 149 } | |
| 150 } | |
| 151 | |
| 152 } | 147 } |
| OLD | NEW |