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

Side by Side Diff: Source/devtools/front_end/source_frame/FontView.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 WebInspector.FontView._measureFontSize = 50; 46 WebInspector.FontView._measureFontSize = 50;
47 47
48 WebInspector.FontView.prototype = { 48 WebInspector.FontView.prototype = {
49 _createContentIfNeeded: function() 49 _createContentIfNeeded: function()
50 { 50 {
51 if (this.fontPreviewElement) 51 if (this.fontPreviewElement)
52 return; 52 return;
53 53
54 var uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontVie w._fontId); 54 var uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontVie w._fontId);
55 55
56 this.fontStyleElement = document.createElement("style"); 56 this.fontStyleElement = createElement("style");
57 this.fontStyleElement.textContent = "@font-face { font-family: \"" + uni queFontName + "\"; src: url(" + this._url + "); }"; 57 this.fontStyleElement.textContent = "@font-face { font-family: \"" + uni queFontName + "\"; src: url(" + this._url + "); }";
58 document.head.appendChild(this.fontStyleElement); 58 document.head.appendChild(this.fontStyleElement);
59 59
60 var fontPreview = document.createElement("div"); 60 var fontPreview = createElement("div");
61 for (var i = 0; i < WebInspector.FontView._fontPreviewLines.length; ++i) { 61 for (var i = 0; i < WebInspector.FontView._fontPreviewLines.length; ++i) {
62 if (i > 0) 62 if (i > 0)
63 fontPreview.createChild("br"); 63 fontPreview.createChild("br");
64 fontPreview.createTextChild(WebInspector.FontView._fontPreviewLines[ i]); 64 fontPreview.createTextChild(WebInspector.FontView._fontPreviewLines[ i]);
65 } 65 }
66 this.fontPreviewElement = fontPreview.cloneNode(true); 66 this.fontPreviewElement = fontPreview.cloneNode(true);
67 this.fontPreviewElement.style.setProperty("font-family", uniqueFontName) ; 67 this.fontPreviewElement.style.setProperty("font-family", uniqueFontName) ;
68 this.fontPreviewElement.style.setProperty("visibility", "hidden"); 68 this.fontPreviewElement.style.setProperty("visibility", "hidden");
69 69
70 this._dummyElement = fontPreview; 70 this._dummyElement = fontPreview;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 var widthRatio = containerWidth / width; 130 var widthRatio = containerWidth / width;
131 var heightRatio = containerHeight / height; 131 var heightRatio = containerHeight / height;
132 var finalFontSize = Math.floor(WebInspector.FontView._measureFontSize * Math.min(widthRatio, heightRatio)) - 2; 132 var finalFontSize = Math.floor(WebInspector.FontView._measureFontSize * Math.min(widthRatio, heightRatio)) - 2;
133 133
134 this.fontPreviewElement.style.setProperty("font-size", finalFontSize + " px", null); 134 this.fontPreviewElement.style.setProperty("font-size", finalFontSize + " px", null);
135 }, 135 },
136 136
137 __proto__: WebInspector.VBox.prototype 137 __proto__: WebInspector.VBox.prototype
138 } 138 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/source_frame/CodeMirrorUtils.js ('k') | Source/devtools/front_end/source_frame/GoToLineDialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698