Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.ThrottledWidget} | 33 * @extends {WebInspector.ThrottledWidget} |
| 34 * @param {!WebInspector.SharedSidebarModel} sharedModel | 34 * @param {!WebInspector.SharedSidebarModel} sharedModel |
| 35 */ | 35 */ |
| 36 WebInspector.PlatformFontsWidget = function(sharedModel) | 36 WebInspector.PlatformFontsWidget = function(sharedModel) |
| 37 { | 37 { |
| 38 WebInspector.ThrottledWidget.call(this); | 38 WebInspector.ThrottledWidget.call(this); |
|
dgozman
2016/03/16 18:59:07
Can we make it a web component as well (pass true
lushnikov
2016/03/16 20:18:19
Done.
| |
| 39 this.element.classList.add("platform-fonts"); | 39 this.element.classList.add("platform-fonts"); |
|
dgozman
2016/03/16 18:59:07
Perhaps, you don't need this class anymore and cou
lushnikov
2016/03/16 20:18:19
Done.
| |
| 40 | 40 |
| 41 this._sharedModel = sharedModel; | 41 this._sharedModel = sharedModel; |
| 42 this._sharedModel.addEventListener(WebInspector.SharedSidebarModel.Events.Co mputedStyleChanged, this.update, this); | 42 this._sharedModel.addEventListener(WebInspector.SharedSidebarModel.Events.Co mputedStyleChanged, this.update, this); |
| 43 | 43 |
| 44 this._sectionTitle = createElementWithClass("div", "sidebar-separator"); | 44 this._sectionTitle = createElementWithClass("div", "sidebar-separator"); |
| 45 this.element.appendChild(this._sectionTitle); | 45 this.element.appendChild(this._sectionTitle); |
| 46 this._sectionTitle.textContent = WebInspector.UIString("Rendered Fonts"); | 46 this._sectionTitle.textContent = WebInspector.UIString("Rendered Fonts"); |
| 47 this._fontStatsSection = this.element.createChild("div", "stats-section"); | 47 this._fontStatsSection = this.element.createChild("div", "stats-section"); |
| 48 this.registerRequiredCSS("elements/platformFontsWidget.css"); | |
|
dgozman
2016/03/16 18:59:07
nit: usually do that in a second line of construct
lushnikov
2016/03/16 20:18:19
Done.
| |
| 48 } | 49 } |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * @param {!WebInspector.SharedSidebarModel} sharedModel | 52 * @param {!WebInspector.SharedSidebarModel} sharedModel |
| 52 * @return {!WebInspector.ElementsSidebarViewWrapperPane} | 53 * @return {!WebInspector.ElementsSidebarViewWrapperPane} |
| 53 */ | 54 */ |
| 54 WebInspector.PlatformFontsWidget.createSidebarWrapper = function(sharedModel) | 55 WebInspector.PlatformFontsWidget.createSidebarWrapper = function(sharedModel) |
| 55 { | 56 { |
| 56 var widget = new WebInspector.PlatformFontsWidget(sharedModel); | 57 var widget = new WebInspector.PlatformFontsWidget(sharedModel); |
| 57 return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString ("Fonts"), widget) | 58 return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString ("Fonts"), widget) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 fontOrigin.textContent = platformFonts[i].isCustomFont? WebInspector .UIString("Network resource") : WebInspector.UIString("Local file"); | 107 fontOrigin.textContent = platformFonts[i].isCustomFont? WebInspector .UIString("Network resource") : WebInspector.UIString("Local file"); |
| 107 | 108 |
| 108 var fontUsageElement = fontStatElement.createChild("span", "font-usa ge"); | 109 var fontUsageElement = fontStatElement.createChild("span", "font-usa ge"); |
| 109 var usage = platformFonts[i].glyphCount; | 110 var usage = platformFonts[i].glyphCount; |
| 110 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString(" (%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage); | 111 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString(" (%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage); |
| 111 } | 112 } |
| 112 }, | 113 }, |
| 113 | 114 |
| 114 __proto__: WebInspector.ThrottledWidget.prototype | 115 __proto__: WebInspector.ThrottledWidget.prototype |
| 115 } | 116 } |
| OLD | NEW |