OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (this._sharedModel.node() !== node) | 83 if (this._sharedModel.node() !== node) |
84 return; | 84 return; |
85 | 85 |
86 this._fontStatsSection.removeChildren(); | 86 this._fontStatsSection.removeChildren(); |
87 | 87 |
88 var isEmptySection = !platformFonts || !platformFonts.length; | 88 var isEmptySection = !platformFonts || !platformFonts.length; |
89 this._sectionTitle.classList.toggle("hidden", isEmptySection); | 89 this._sectionTitle.classList.toggle("hidden", isEmptySection); |
90 if (isEmptySection) | 90 if (isEmptySection) |
91 return; | 91 return; |
92 | 92 |
93 platformFonts.sort(function (a, b) { | 93 platformFonts.sort(function(a, b) { |
94 return b.glyphCount - a.glyphCount; | 94 return b.glyphCount - a.glyphCount; |
95 }); | 95 }); |
96 for (var i = 0; i < platformFonts.length; ++i) { | 96 for (var i = 0; i < platformFonts.length; ++i) { |
97 var fontStatElement = this._fontStatsSection.createChild("div", "fon
t-stats-item"); | 97 var fontStatElement = this._fontStatsSection.createChild("div", "fon
t-stats-item"); |
98 | 98 |
99 var fontNameElement = fontStatElement.createChild("span", "font-name
"); | 99 var fontNameElement = fontStatElement.createChild("span", "font-name
"); |
100 fontNameElement.textContent = platformFonts[i].familyName; | 100 fontNameElement.textContent = platformFonts[i].familyName; |
101 | 101 |
102 var fontDelimeterElement = fontStatElement.createChild("span", "font
-delimeter"); | 102 var fontDelimeterElement = fontStatElement.createChild("span", "font
-delimeter"); |
103 fontDelimeterElement.textContent = "\u2014"; | 103 fontDelimeterElement.textContent = "\u2014"; |
104 | 104 |
105 var fontOrigin = fontStatElement.createChild("span"); | 105 var fontOrigin = fontStatElement.createChild("span"); |
106 fontOrigin.textContent = platformFonts[i].isCustomFont? WebInspector
.UIString("Network resource") : WebInspector.UIString("Local file"); | 106 fontOrigin.textContent = platformFonts[i].isCustomFont ? WebInspecto
r.UIString("Network resource") : WebInspector.UIString("Local file"); |
107 | 107 |
108 var fontUsageElement = fontStatElement.createChild("span", "font-usa
ge"); | 108 var fontUsageElement = fontStatElement.createChild("span", "font-usa
ge"); |
109 var usage = platformFonts[i].glyphCount; | 109 var usage = platformFonts[i].glyphCount; |
110 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString("
(%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage); | 110 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString("
(%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage); |
111 } | 111 } |
112 }, | 112 }, |
113 | 113 |
114 __proto__: WebInspector.ThrottledWidget.prototype | 114 __proto__: WebInspector.ThrottledWidget.prototype |
115 } | 115 } |
OLD | NEW |