OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../http/tests/inspector-protocol/resources/p
rotocol-test.js"></script> |
| 4 <script type="text/javascript"> |
| 5 |
| 6 function test() |
| 7 { |
| 8 function sendCommand(command, properties, callback) { |
| 9 InspectorTest.sendCommand(command, properties || {}, commandCallback); |
| 10 function commandCallback(msg) |
| 11 { |
| 12 if (msg.error) { |
| 13 InspectorTest.log(msg.error.message); |
| 14 InspectorTest.completeTest(); |
| 15 return; |
| 16 } |
| 17 callback(msg.result); |
| 18 } |
| 19 } |
| 20 sendCommand("DOM.getDocument", {}, onGotDocument); |
| 21 |
| 22 function onGotDocument(result) |
| 23 { |
| 24 var root = result.root; |
| 25 sendCommand("DOM.querySelector", { "nodeId": root.nodeId , "selector": "
#fancy" }, onGotNode); |
| 26 } |
| 27 |
| 28 function onGotNode(node) |
| 29 { |
| 30 sendCommand("CSS.getPlatformFontsForNode", { "nodeId": node.nodeId }, on
GotComputedFonts); |
| 31 } |
| 32 |
| 33 function onGotComputedFonts(response) |
| 34 { |
| 35 var fonts = response.fonts; |
| 36 fonts.sort(function(a, b) { |
| 37 return b.glyphCount - a.glyphCount; |
| 38 }); |
| 39 for (var i = 0; i < fonts.length; ++i) |
| 40 fonts[i].familyName = "<Some-family-name-" + i + ">"; |
| 41 InspectorTest.log(JSON.stringify(fonts)); |
| 42 InspectorTest.completeTest(); |
| 43 } |
| 44 }; |
| 45 |
| 46 window.addEventListener("DOMContentLoaded", function () { |
| 47 runTest(); |
| 48 }, false); |
| 49 |
| 50 </script> |
| 51 <style> |
| 52 #fancy { |
| 53 font-family: 'Arial'; |
| 54 background-color: gray; |
| 55 } |
| 56 #fancy:first-letter { |
| 57 font-family: 'Times New Roman'; |
| 58 font-size: 400%; |
| 59 background-color: blue; |
| 60 } |
| 61 |
| 62 #fancy:first-line { |
| 63 font-family: 'Courier New'; |
| 64 background-color: yellow; |
| 65 } |
| 66 </style> |
| 67 </head> |
| 68 <body> |
| 69 |
| 70 <div id="fancy"> |
| 71 First line. |
| 72 <br> |
| 73 Second line. |
| 74 </div> |
| 75 |
| 76 </body> |
| 77 </html> |
OLD | NEW |