OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * This is the absolute difference maintained between standard and | 6 * This is the absolute difference maintained between standard and |
7 * fixed-width font sizes. http://crbug.com/91922. | 7 * fixed-width font sizes. http://crbug.com/91922. |
8 * @const | 8 * @const |
9 */ | 9 */ |
10 var SIZE_DIFFERENCE_FIXED_STANDARD = 3; | 10 var SIZE_DIFFERENCE_FIXED_STANDARD = 3; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 }, | 178 }, |
179 | 179 |
180 /** | 180 /** |
181 * @param {!Array<{0: string, 1: (string|undefined), 2: (string|undefined)}>} | 181 * @param {!Array<{0: string, 1: (string|undefined), 2: (string|undefined)}>} |
182 * fontList The font menu options. | 182 * fontList The font menu options. |
183 * @param {!Array<{0: string, 1: string}>} encodingList The encoding menu | 183 * @param {!Array<{0: string, 1: string}>} encodingList The encoding menu |
184 * options. | 184 * options. |
185 * @private | 185 * @private |
186 */ | 186 */ |
187 setFontsData_: function(fontList, encodingList) { | 187 setFontsData_: function(fontList, encodingList) { |
188 this.$.standardFont.menuOptions = fontList; | 188 var fontMenuOptions = []; |
189 this.$.serifFont.menuOptions = fontList; | 189 for (var i = 0; i < fontList.length; ++i) |
190 this.$.sansSerifFont.menuOptions = fontList; | 190 fontMenuOptions.push({value: fontList[i][0], name: fontList[i][1]}); |
191 this.$.fixedFont.menuOptions = fontList; | 191 this.$.standardFont.menuOptions = fontMenuOptions; |
192 this.$.encoding.menuOptions = encodingList; | 192 this.$.serifFont.menuOptions = fontMenuOptions; |
| 193 this.$.sansSerifFont.menuOptions = fontMenuOptions; |
| 194 this.$.fixedFont.menuOptions = fontMenuOptions; |
| 195 |
| 196 var encodingMenuOptions = []; |
| 197 for (var i = 0; i < encodingList.length; ++i) { |
| 198 encodingMenuOptions.push({ |
| 199 value: encodingList[i][0], name: encodingList[i][1]}); |
| 200 } |
| 201 this.$.encoding.menuOptions = encodingMenuOptions; |
193 }, | 202 }, |
194 | 203 |
195 /** | 204 /** |
196 * @param {number} value The changed font size slider value. | 205 * @param {number} value The changed font size slider value. |
197 * @private | 206 * @private |
198 */ | 207 */ |
199 fontSizeChanged_: function(value) { | 208 fontSizeChanged_: function(value) { |
200 this.defaultFontSize_ = value; | 209 this.defaultFontSize_ = value; |
201 if (!this.$.sizeSlider.dragging) { | 210 if (!this.$.sizeSlider.dragging) { |
202 this.fontSizeIndex_ = this.fontSizeRange_.indexOf(value); | 211 this.fontSizeIndex_ = this.fontSizeRange_.indexOf(value); |
(...skipping 15 matching lines...) Expand all Loading... |
218 /** | 227 /** |
219 * Creates an html style value. | 228 * Creates an html style value. |
220 * @param {number} fontSize The font size to use. | 229 * @param {number} fontSize The font size to use. |
221 * @param {string} fontFamily The name of the font family use. | 230 * @param {string} fontFamily The name of the font family use. |
222 * @private | 231 * @private |
223 */ | 232 */ |
224 computeStyle_: function(fontSize, fontFamily) { | 233 computeStyle_: function(fontSize, fontFamily) { |
225 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + "';"; | 234 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + "';"; |
226 }, | 235 }, |
227 }); | 236 }); |
OLD | NEW |