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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js

Issue 2157713002: DevTools: introduce View: a named widget with the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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.ThrottledView}
34 * @param {!WebInspector.ComputedStyleModel} sharedModel 34 * @param {!WebInspector.ComputedStyleModel} sharedModel
35 */ 35 */
36 WebInspector.PlatformFontsWidget = function(sharedModel) 36 WebInspector.PlatformFontsWidget = function(sharedModel)
37 { 37 {
38 WebInspector.ThrottledWidget.call(this, true); 38 WebInspector.ThrottledView.call(this, WebInspector.UIString("Fonts"), true);
39 this.registerRequiredCSS("elements/platformFontsWidget.css"); 39 this.registerRequiredCSS("elements/platformFontsWidget.css");
40 40
41 this._sharedModel = sharedModel; 41 this._sharedModel = sharedModel;
42 this._sharedModel.addEventListener(WebInspector.ComputedStyleModel.Events.Co mputedStyleChanged, this.update, this); 42 this._sharedModel.addEventListener(WebInspector.ComputedStyleModel.Events.Co mputedStyleChanged, this.update, this);
43 43
44 this._sectionTitle = createElementWithClass("div", "title"); 44 this._sectionTitle = createElementWithClass("div", "title");
45 this.contentElement.appendChild(this._sectionTitle); 45 this.contentElement.appendChild(this._sectionTitle);
46 this._sectionTitle.textContent = WebInspector.UIString("Rendered Fonts"); 46 this._sectionTitle.textContent = WebInspector.UIString("Rendered Fonts");
47 this._fontStatsSection = this.contentElement.createChild("div", "stats-secti on"); 47 this._fontStatsSection = this.contentElement.createChild("div", "stats-secti on");
48 } 48 }
49 49
50 /**
51 * @param {!WebInspector.ComputedStyleModel} sharedModel
52 * @return {!WebInspector.ElementsSidebarViewWrapperPane}
53 */
54 WebInspector.PlatformFontsWidget.createSidebarWrapper = function(sharedModel)
55 {
56 var widget = new WebInspector.PlatformFontsWidget(sharedModel);
57 return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString ("Fonts"), widget)
58 }
59
60 WebInspector.PlatformFontsWidget.prototype = { 50 WebInspector.PlatformFontsWidget.prototype = {
61 /** 51 /**
62 * @override 52 * @override
63 * @protected 53 * @protected
64 * @return {!Promise.<?>} 54 * @return {!Promise.<?>}
65 */ 55 */
66 doUpdate: function() 56 doUpdate: function()
67 { 57 {
68 var cssModel = this._sharedModel.cssModel(); 58 var cssModel = this._sharedModel.cssModel();
69 var node = this._sharedModel.node(); 59 var node = this._sharedModel.node();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 94
105 var fontOrigin = fontStatElement.createChild("span"); 95 var fontOrigin = fontStatElement.createChild("span");
106 fontOrigin.textContent = platformFonts[i].isCustomFont ? WebInspecto r.UIString("Network resource") : WebInspector.UIString("Local file"); 96 fontOrigin.textContent = platformFonts[i].isCustomFont ? WebInspecto r.UIString("Network resource") : WebInspector.UIString("Local file");
107 97
108 var fontUsageElement = fontStatElement.createChild("span", "font-usa ge"); 98 var fontUsageElement = fontStatElement.createChild("span", "font-usa ge");
109 var usage = platformFonts[i].glyphCount; 99 var usage = platformFonts[i].glyphCount;
110 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString(" (%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage); 100 fontUsageElement.textContent = usage === 1 ? WebInspector.UIString(" (%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage);
111 } 101 }
112 }, 102 },
113 103
114 __proto__: WebInspector.ThrottledWidget.prototype 104 __proto__: WebInspector.ThrottledView.prototype
115 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698