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 23 matching lines...) Expand all Loading... |
34 */ | 34 */ |
35 WebInspector.FontView = function(mimeType, contentProvider) | 35 WebInspector.FontView = function(mimeType, contentProvider) |
36 { | 36 { |
37 WebInspector.SimpleView.call(this, WebInspector.UIString("Font")); | 37 WebInspector.SimpleView.call(this, WebInspector.UIString("Font")); |
38 this.registerRequiredCSS("source_frame/fontView.css"); | 38 this.registerRequiredCSS("source_frame/fontView.css"); |
39 this.element.classList.add("font-view"); | 39 this.element.classList.add("font-view"); |
40 this._url = contentProvider.contentURL(); | 40 this._url = contentProvider.contentURL(); |
41 this._mimeType = mimeType; | 41 this._mimeType = mimeType; |
42 this._contentProvider = contentProvider; | 42 this._contentProvider = contentProvider; |
43 this._mimeTypeLabel = new WebInspector.ToolbarText(mimeType); | 43 this._mimeTypeLabel = new WebInspector.ToolbarText(mimeType); |
44 } | 44 }; |
45 | 45 |
46 WebInspector.FontView._fontPreviewLines = [ "ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "a
bcdefghijklm", "nopqrstuvwxyz", "1234567890" ]; | 46 WebInspector.FontView._fontPreviewLines = [ "ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "a
bcdefghijklm", "nopqrstuvwxyz", "1234567890" ]; |
47 | 47 |
48 WebInspector.FontView._fontId = 0; | 48 WebInspector.FontView._fontId = 0; |
49 | 49 |
50 WebInspector.FontView._measureFontSize = 50; | 50 WebInspector.FontView._measureFontSize = 50; |
51 | 51 |
52 WebInspector.FontView.prototype = { | 52 WebInspector.FontView.prototype = { |
53 /** | 53 /** |
54 * @override | 54 * @override |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
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.SimpleView.prototype | 160 __proto__: WebInspector.SimpleView.prototype |
161 } | 161 }; |
OLD | NEW |