| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 <link rel="stylesheet" href="../styles/resources/styles-source-offsets.css"> | 4 <link rel="stylesheet" href="../styles/resources/styles-source-offsets.css"> |
| 5 | 5 |
| 6 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 6 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 7 <script src="../../../http/tests/inspector/elements-test.js"></script> | 7 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 function test() | 10 function test() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 InspectorTest.addResult(header + " " + InspectorTest.rangeText(style.ran
ge)); | 31 InspectorTest.addResult(header + " " + InspectorTest.rangeText(style.ran
ge)); |
| 32 var allProperties = style.cssProperties; | 32 var allProperties = style.cssProperties; |
| 33 for (var i = 0; i < allProperties.length; ++i) { | 33 for (var i = 0; i < allProperties.length; ++i) { |
| 34 var property = allProperties[i]; | 34 var property = allProperties[i]; |
| 35 if (!property.range) | 35 if (!property.range) |
| 36 continue; | 36 continue; |
| 37 InspectorTest.addResult("['" + property.name + "':'" + property.valu
e + "'" + (property.important ? " !important" : "") + (("parsedOk" in property)
? " non-parsed" : "") +"] @" + InspectorTest.rangeText(property.range)); | 37 InspectorTest.addResult("['" + property.name + "':'" + property.valu
e + "'" + (property.important ? " !important" : "") + (("parsedOk" in property)
? " non-parsed" : "") +"] @" + InspectorTest.rangeText(property.range)); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 InspectorTest.selectNodeWithId("mainBody", step1); | 41 InspectorTest.selectNodeWithId("mainBody", step1); |
| 42 | 42 |
| 43 var resultStyles = {}; | |
| 44 | |
| 45 function inlineCallback(error, inlineStyle) | |
| 46 { | |
| 47 if (error) { | |
| 48 InspectorTest.addResult("error: " + error); | |
| 49 InspectorTest.completeTest(); | |
| 50 return; | |
| 51 } | |
| 52 | |
| 53 resultStyles.inlineStyle = inlineStyle; | |
| 54 } | |
| 55 | |
| 56 function matchedCallback(error, matchedCSSRules) | |
| 57 { | |
| 58 if (error) { | |
| 59 InspectorTest.addResult("error: " + error); | |
| 60 InspectorTest.completeTest(); | |
| 61 return; | |
| 62 } | |
| 63 resultStyles.matchedCSSRules = matchedCSSRules; | |
| 64 } | |
| 65 | |
| 66 function step1(node) | 43 function step1(node) |
| 67 { | 44 { |
| 68 var promises = [ | 45 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, onMatchedStyles) |
| 69 InspectorTest.CSSAgent.getInlineStylesForNode(node.id, inlineCallbac
k), | |
| 70 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, matchedCallb
ack) | |
| 71 ]; | |
| 72 Promise.all(promises).then(step2); | |
| 73 } | 46 } |
| 74 | 47 |
| 75 function step2() | 48 function onMatchedStyles(error, inlineStyle, attributeStyle, matchedCSSRules
) |
| 76 { | 49 { |
| 77 var matchedCSSRules = resultStyles.matchedCSSRules; | |
| 78 for (var i = 0; i < matchedCSSRules.length; ++i) | 50 for (var i = 0; i < matchedCSSRules.length; ++i) |
| 79 dumpStyleData(matchedCSSRules[i].rule); | 51 dumpStyleData(matchedCSSRules[i].rule); |
| 80 dumpStyleData(resultStyles.inlineStyle); | 52 dumpStyleData(inlineStyle); |
| 81 InspectorTest.completeTest(); | 53 InspectorTest.completeTest(); |
| 82 } | 54 } |
| 83 } | 55 } |
| 84 | 56 |
| 85 </script> | 57 </script> |
| 86 | 58 |
| 87 <style> | 59 <style> |
| 88 | 60 |
| 89 body.mainpage { | 61 body.mainpage { |
| 90 text-decoration: none; /* at least one valid property is necessary for WebCo
re to match a rule */ | 62 text-decoration: none; /* at least one valid property is necessary for WebCo
re to match a rule */ |
| 91 badproperty: 1badvalue1; | 63 badproperty: 1badvalue1; |
| 92 } | 64 } |
| 93 | 65 |
| 94 </style> | 66 </style> |
| 95 </head> | 67 </head> |
| 96 | 68 |
| 97 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 80%"> | 69 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 80%"> |
| 98 <p> | 70 <p> |
| 99 Tests that proper data and start/end offset positions are reported for CSS style
declarations and properties. | 71 Tests that proper data and start/end offset positions are reported for CSS style
declarations and properties. |
| 100 </p> | 72 </p> |
| 101 | 73 |
| 102 </body> | 74 </body> |
| 103 </html> | 75 </html> |
| OLD | NEW |