OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 }, | 70 }, |
71 | 71 |
72 _createContentIfNeeded: function() | 72 _createContentIfNeeded: function() |
73 { | 73 { |
74 if (this.fontPreviewElement) | 74 if (this.fontPreviewElement) |
75 return; | 75 return; |
76 | 76 |
77 var uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontVie
w._fontId); | 77 var uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontVie
w._fontId); |
78 | 78 |
79 this.fontStyleElement = createElement("style"); | 79 this.fontStyleElement = createElement("style"); |
80 this._contentProvider.requestContent(this._onFontContentLoaded.bind(this
, uniqueFontName)); | 80 this._contentProvider.requestContent().then(this._onFontContentLoaded.bi
nd(this, uniqueFontName)); |
81 this.element.appendChild(this.fontStyleElement); | 81 this.element.appendChild(this.fontStyleElement); |
82 | 82 |
83 var fontPreview = createElement("div"); | 83 var fontPreview = createElement("div"); |
84 for (var i = 0; i < WebInspector.FontView._fontPreviewLines.length; ++i)
{ | 84 for (var i = 0; i < WebInspector.FontView._fontPreviewLines.length; ++i)
{ |
85 if (i > 0) | 85 if (i > 0) |
86 fontPreview.createChild("br"); | 86 fontPreview.createChild("br"); |
87 fontPreview.createTextChild(WebInspector.FontView._fontPreviewLines[
i]); | 87 fontPreview.createTextChild(WebInspector.FontView._fontPreviewLines[
i]); |
88 } | 88 } |
89 this.fontPreviewElement = fontPreview.cloneNode(true); | 89 this.fontPreviewElement = fontPreview.cloneNode(true); |
90 this.fontPreviewElement.style.setProperty("font-family", uniqueFontName)
; | 90 this.fontPreviewElement.style.setProperty("font-family", uniqueFontName)
; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 var widthRatio = containerWidth / width; | 153 var widthRatio = containerWidth / width; |
154 var heightRatio = containerHeight / height; | 154 var heightRatio = containerHeight / height; |
155 var finalFontSize = Math.floor(WebInspector.FontView._measureFontSize *
Math.min(widthRatio, heightRatio)) - 2; | 155 var finalFontSize = Math.floor(WebInspector.FontView._measureFontSize *
Math.min(widthRatio, heightRatio)) - 2; |
156 | 156 |
157 this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "
px", null); | 157 this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "
px", null); |
158 }, | 158 }, |
159 | 159 |
160 __proto__: WebInspector.VBoxWithToolbarItems.prototype | 160 __proto__: WebInspector.VBoxWithToolbarItems.prototype |
161 } | 161 } |
OLD | NEW |