| Index: third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js
|
| index 6b8dfbff8285aba3e3cd90ea37a9f4c0e04faa43..5121602dbae47d81532e03c79c173dfeaf15ce24 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js
|
| @@ -27,80 +27,76 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| -
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.ThrottledWidget}
|
| - * @param {!WebInspector.ComputedStyleModel} sharedModel
|
| + * @unrestricted
|
| */
|
| -WebInspector.PlatformFontsWidget = function(sharedModel)
|
| -{
|
| - WebInspector.ThrottledWidget.call(this, true);
|
| - this.registerRequiredCSS("elements/platformFontsWidget.css");
|
| +WebInspector.PlatformFontsWidget = class extends WebInspector.ThrottledWidget {
|
| + /**
|
| + * @param {!WebInspector.ComputedStyleModel} sharedModel
|
| + */
|
| + constructor(sharedModel) {
|
| + super(true);
|
| + this.registerRequiredCSS('elements/platformFontsWidget.css');
|
|
|
| this._sharedModel = sharedModel;
|
| this._sharedModel.addEventListener(WebInspector.ComputedStyleModel.Events.ComputedStyleChanged, this.update, this);
|
|
|
| - this._sectionTitle = createElementWithClass("div", "title");
|
| - this.contentElement.classList.add("platform-fonts");
|
| + this._sectionTitle = createElementWithClass('div', 'title');
|
| + this.contentElement.classList.add('platform-fonts');
|
| this.contentElement.appendChild(this._sectionTitle);
|
| - this._sectionTitle.textContent = WebInspector.UIString("Rendered Fonts");
|
| - this._fontStatsSection = this.contentElement.createChild("div", "stats-section");
|
| -};
|
| -
|
| -WebInspector.PlatformFontsWidget.prototype = {
|
| - /**
|
| - * @override
|
| - * @protected
|
| - * @return {!Promise.<?>}
|
| - */
|
| - doUpdate: function()
|
| - {
|
| - var cssModel = this._sharedModel.cssModel();
|
| - var node = this._sharedModel.node();
|
| - if (!node || !cssModel)
|
| - return Promise.resolve();
|
| + this._sectionTitle.textContent = WebInspector.UIString('Rendered Fonts');
|
| + this._fontStatsSection = this.contentElement.createChild('div', 'stats-section');
|
| + }
|
|
|
| - return cssModel.platformFontsPromise(node.id)
|
| - .then(this._refreshUI.bind(this, node));
|
| - },
|
| + /**
|
| + * @override
|
| + * @protected
|
| + * @return {!Promise.<?>}
|
| + */
|
| + doUpdate() {
|
| + var cssModel = this._sharedModel.cssModel();
|
| + var node = this._sharedModel.node();
|
| + if (!node || !cssModel)
|
| + return Promise.resolve();
|
|
|
| - /**
|
| - * @param {!WebInspector.DOMNode} node
|
| - * @param {?Array.<!CSSAgent.PlatformFontUsage>} platformFonts
|
| - */
|
| - _refreshUI: function(node, platformFonts)
|
| - {
|
| - if (this._sharedModel.node() !== node)
|
| - return;
|
| + return cssModel.platformFontsPromise(node.id).then(this._refreshUI.bind(this, node));
|
| + }
|
|
|
| - this._fontStatsSection.removeChildren();
|
| + /**
|
| + * @param {!WebInspector.DOMNode} node
|
| + * @param {?Array.<!CSSAgent.PlatformFontUsage>} platformFonts
|
| + */
|
| + _refreshUI(node, platformFonts) {
|
| + if (this._sharedModel.node() !== node)
|
| + return;
|
|
|
| - var isEmptySection = !platformFonts || !platformFonts.length;
|
| - this._sectionTitle.classList.toggle("hidden", isEmptySection);
|
| - if (isEmptySection)
|
| - return;
|
| + this._fontStatsSection.removeChildren();
|
|
|
| - platformFonts.sort(function(a, b) {
|
| - return b.glyphCount - a.glyphCount;
|
| - });
|
| - for (var i = 0; i < platformFonts.length; ++i) {
|
| - var fontStatElement = this._fontStatsSection.createChild("div", "font-stats-item");
|
| + var isEmptySection = !platformFonts || !platformFonts.length;
|
| + this._sectionTitle.classList.toggle('hidden', isEmptySection);
|
| + if (isEmptySection)
|
| + return;
|
|
|
| - var fontNameElement = fontStatElement.createChild("span", "font-name");
|
| - fontNameElement.textContent = platformFonts[i].familyName;
|
| + platformFonts.sort(function(a, b) {
|
| + return b.glyphCount - a.glyphCount;
|
| + });
|
| + for (var i = 0; i < platformFonts.length; ++i) {
|
| + var fontStatElement = this._fontStatsSection.createChild('div', 'font-stats-item');
|
|
|
| - var fontDelimeterElement = fontStatElement.createChild("span", "font-delimeter");
|
| - fontDelimeterElement.textContent = "\u2014";
|
| + var fontNameElement = fontStatElement.createChild('span', 'font-name');
|
| + fontNameElement.textContent = platformFonts[i].familyName;
|
|
|
| - var fontOrigin = fontStatElement.createChild("span");
|
| - fontOrigin.textContent = platformFonts[i].isCustomFont ? WebInspector.UIString("Network resource") : WebInspector.UIString("Local file");
|
| + var fontDelimeterElement = fontStatElement.createChild('span', 'font-delimeter');
|
| + fontDelimeterElement.textContent = '\u2014';
|
|
|
| - var fontUsageElement = fontStatElement.createChild("span", "font-usage");
|
| - var usage = platformFonts[i].glyphCount;
|
| - fontUsageElement.textContent = usage === 1 ? WebInspector.UIString("(%d glyph)", usage) : WebInspector.UIString("(%d glyphs)", usage);
|
| - }
|
| - },
|
| + var fontOrigin = fontStatElement.createChild('span');
|
| + fontOrigin.textContent = platformFonts[i].isCustomFont ? WebInspector.UIString('Network resource') :
|
| + WebInspector.UIString('Local file');
|
|
|
| - __proto__: WebInspector.ThrottledWidget.prototype
|
| + var fontUsageElement = fontStatElement.createChild('span', 'font-usage');
|
| + var usage = platformFonts[i].glyphCount;
|
| + fontUsageElement.textContent =
|
| + usage === 1 ? WebInspector.UIString('(%d glyph)', usage) : WebInspector.UIString('(%d glyphs)', usage);
|
| + }
|
| + }
|
| };
|
|
|