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.loadAndDumpMatchingRules = function(nodeId, callback) | 123 InspectorTest.loadAndDumpMatchingRulesForNode = function(nodeId, callback) |
124 { | 124 { |
125 InspectorTest.requestNodeId(nodeId, nodeIdLoaded); | 125 InspectorTest.sendCommandOrDie("CSS.getMatchedStylesForNode", { "nodeId": no
deId }, matchingRulesLoaded); |
126 | |
127 function nodeIdLoaded(nodeId) | |
128 { | |
129 InspectorTest.sendCommandOrDie("CSS.getMatchedStylesForNode", { "nodeId"
: nodeId }, matchingRulesLoaded); | |
130 } | |
131 | 126 |
132 function matchingRulesLoaded(result) | 127 function matchingRulesLoaded(result) |
133 { | 128 { |
134 InspectorTest.log("Dumping matched rules: "); | 129 InspectorTest.log("Dumping matched rules: "); |
135 var ruleMatches = result.matchedCSSRules; | 130 var ruleMatches = result.matchedCSSRules; |
136 for (var i = 0; i < ruleMatches.length; ++i) { | 131 for (var i = 0; i < ruleMatches.length; ++i) { |
137 var ruleMatch = ruleMatches[i]; | 132 var ruleMatch = ruleMatches[i]; |
138 var origin = ruleMatch.rule.origin; | 133 var origin = ruleMatch.rule.origin; |
139 if (origin !== "inspector" && origin !== "regular") | 134 if (origin !== "inspector" && origin !== "regular") |
140 continue; | 135 continue; |
141 InspectorTest.dumpRuleMatch(ruleMatch); | 136 InspectorTest.dumpRuleMatch(ruleMatch); |
142 } | 137 } |
143 callback(); | 138 callback(); |
144 } | 139 } |
145 } | 140 } |
146 | 141 |
| 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 |
147 } | 152 } |
OLD | NEW |