Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: LayoutTests/inspector-protocol/css-get-platform-fonts.html

Issue 22923010: DevTools: Add CSS.getPlatformFontsForNode in protocol.json (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use HFONT instead of SKTypeface on Win Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css-get-platform-fonts-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/css-get-platform-fonts.html
diff --git a/LayoutTests/inspector-protocol/css-get-platform-fonts.html b/LayoutTests/inspector-protocol/css-get-platform-fonts.html
new file mode 100644
index 0000000000000000000000000000000000000000..a2e0758ecb12cf3531a1a9ef011d0035d5bb6097
--- /dev/null
+++ b/LayoutTests/inspector-protocol/css-get-platform-fonts.html
@@ -0,0 +1,77 @@
+<html>
+<head>
+<script type="text/javascript" src="../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ function sendCommand(command, properties, callback) {
+ InspectorTest.sendCommand(command, properties || {}, commandCallback);
+ function commandCallback(msg)
+ {
+ if (msg.error) {
+ InspectorTest.log(msg.error.message);
+ InspectorTest.completeTest();
+ return;
+ }
+ callback(msg.result);
+ }
+ }
+ sendCommand("DOM.getDocument", {}, onGotDocument);
+
+ function onGotDocument(result)
+ {
+ var root = result.root;
+ sendCommand("DOM.querySelector", { "nodeId": root.nodeId , "selector": "#fancy" }, onGotNode);
+ }
+
+ function onGotNode(node)
+ {
+ sendCommand("CSS.getPlatformFontsForNode", { "nodeId": node.nodeId }, onGotComputedFonts);
+ }
+
+ function onGotComputedFonts(response)
+ {
+ var fonts = response.fonts;
+ fonts.sort(function(a, b) {
+ return b.glyphCount - a.glyphCount;
+ });
+ for (var i = 0; i < fonts.length; ++i)
+ fonts[i].familyName = "<Some-family-name-" + i + ">";
+ InspectorTest.log(JSON.stringify(fonts));
+ InspectorTest.completeTest();
+ }
+};
+
+window.addEventListener("DOMContentLoaded", function () {
+ runTest();
+}, false);
+
+</script>
+<style>
+ #fancy {
+ font-family: 'Arial';
+ background-color: gray;
+ }
+ #fancy:first-letter {
+ font-family: 'Times New Roman';
+ font-size: 400%;
+ background-color: blue;
+ }
+
+ #fancy:first-line {
+ font-family: 'Courier New';
+ background-color: yellow;
+ }
+</style>
+</head>
+<body>
+
+<div id="fancy">
+First line.
+<br>
+Second line.
+</div>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css-get-platform-fonts-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698