Chromium Code Reviews| 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 (function() { | 5 (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * This is the absolute difference maintained between standard and | 9 * This is the absolute difference maintained between standard and |
| 10 * fixed-width font sizes. http://crbug.com/91922. | 10 * fixed-width font sizes. http://crbug.com/91922. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 */ | 149 */ |
| 150 fontSizeChanged_: function(value) { | 150 fontSizeChanged_: function(value) { |
| 151 // TODO(michaelpg): Whitelist this pref in prefs_utils.cc so it is | 151 // TODO(michaelpg): Whitelist this pref in prefs_utils.cc so it is |
| 152 // included in the <settings-prefs> getAllPrefs call, otherwise this path | 152 // included in the <settings-prefs> getAllPrefs call, otherwise this path |
| 153 // is invalid and nothing happens. See crbug.com/612535. | 153 // is invalid and nothing happens. See crbug.com/612535. |
| 154 this.set('prefs.webkit.webprefs.default_fixed_font_size.value', | 154 this.set('prefs.webkit.webprefs.default_fixed_font_size.value', |
| 155 value - SIZE_DIFFERENCE_FIXED_STANDARD_); | 155 value - SIZE_DIFFERENCE_FIXED_STANDARD_); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Creates an html style value. | 159 * Get the minimum font size, accounting for unset prefs. |
| 160 * @return {string} | |
| 161 * @private | |
| 162 */ | |
| 163 computeMinimumFontSize_: function() { | |
| 164 var value = this.get('prefs.webkit.webprefs.minimum_font_size.value'); | |
| 165 return (value ? value : MINIMUM_FONT_SIZE_RANGE_[0]).toString(); | |
|
Dan Beam
2017/03/14 03:27:19
(value || MINIMUM_FONT_SIZE_RANGE_[0])
why toStri
dschuyler
2017/03/14 18:55:31
Done.
| |
| 166 }, | |
| 167 | |
| 168 /** | |
| 169 * Creates an html style value for the minimum font size. | |
| 160 * @param {number} fontSize The font size to use. | 170 * @param {number} fontSize The font size to use. |
| 161 * @param {string} fontFamily The name of the font family use. | 171 * @param {string} fontFamily The name of the font family use. |
| 162 * @return {string} | 172 * @return {string} |
| 173 * @private | |
| 174 */ | |
| 175 computeMinimumStyle_: function(fontSize, fontFamily) { | |
| 176 return 'font-size: ' + this.computeMinimumFontSize_() + | |
| 177 "px; font-family: '" + fontFamily + "';"; | |
| 178 }, | |
| 179 | |
| 180 /** | |
| 181 * Creates an html style value for the default font size. | |
| 182 * @param {number} fontSize The font size to use. | |
| 183 * @param {string} fontFamily The name of the font family use. | |
| 184 * @return {string} | |
| 163 * @private | 185 * @private |
| 164 */ | 186 */ |
| 165 computeStyle_: function(fontSize, fontFamily) { | 187 computeStyle_: function(fontSize, fontFamily) { |
| 166 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + | 188 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + |
| 167 "';"; | 189 "';"; |
| 168 }, | 190 }, |
| 169 }); | 191 }); |
| 170 })(); | 192 })(); |
| OLD | NEW |