OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 /** | 9 /** |
10 * FontSettings class | 10 * FontSettings class |
(...skipping 16 matching lines...) Expand all Loading... |
27 * Initialize the page. | 27 * Initialize the page. |
28 */ | 28 */ |
29 initializePage: function() { | 29 initializePage: function() { |
30 OptionsPage.prototype.initializePage.call(this); | 30 OptionsPage.prototype.initializePage.call(this); |
31 | 31 |
32 var standardFontRange = $('standard-font-size'); | 32 var standardFontRange = $('standard-font-size'); |
33 standardFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, | 33 standardFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, |
34 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72]; | 34 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72]; |
35 standardFontRange.continuous = false; | 35 standardFontRange.continuous = false; |
36 standardFontRange.notifyChange = this.standardRangeChanged_.bind(this); | 36 standardFontRange.notifyChange = this.standardRangeChanged_.bind(this); |
| 37 standardFontRange.notifyPrefChange = |
| 38 this.standardFontSizeChanged_.bind(this); |
37 | 39 |
38 var minimumFontRange = $('minimum-font-size'); | 40 var minimumFontRange = $('minimum-font-size'); |
39 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | 41 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
40 18, 20, 22, 24]; | 42 18, 20, 22, 24]; |
41 minimumFontRange.continuous = false; | 43 minimumFontRange.continuous = false; |
42 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this); | 44 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this); |
43 minimumFontRange.notifyPrefChange = | 45 minimumFontRange.notifyPrefChange = |
44 this.minimumFontSizeChanged_.bind(this); | 46 this.minimumFontSizeChanged_.bind(this); |
45 | 47 |
46 var placeholder = localStrings.getString('fontSettingsPlaceholder'); | 48 var placeholder = localStrings.getString('fontSettingsPlaceholder'); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, | 81 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, |
80 true); | 82 true); |
81 | 83 |
82 fontSampleEl = $('serif-font-sample'); | 84 fontSampleEl = $('serif-font-sample'); |
83 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, | 85 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, |
84 true); | 86 true); |
85 | 87 |
86 fontSampleEl = $('sans-serif-font-sample'); | 88 fontSampleEl = $('sans-serif-font-sample'); |
87 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, | 89 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, |
88 true); | 90 true); |
| 91 |
| 92 fontSampleEl = $('fixed-font-sample'); |
| 93 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, |
| 94 true); |
89 }, | 95 }, |
90 | 96 |
91 /** | 97 /** |
| 98 * Sets the 'default_fixed_font_size' preference when the standard font |
| 99 * size has been changed by the user. |
| 100 * @param {Element} el The slider input element. |
| 101 * @param {number} value The mapped value that has been saved. |
| 102 * @private |
| 103 */ |
| 104 standardFontSizeChanged_: function(el, value) { |
| 105 Preferences.setIntegerPref('webkit.webprefs.default_fixed_font_size', |
| 106 value, ''); |
| 107 }, |
| 108 |
| 109 /** |
92 * Called as the user changes the miniumum font size. This allows for | 110 * Called as the user changes the miniumum font size. This allows for |
93 * reflecting the change in the UI before the preference has been changed. | 111 * reflecting the change in the UI before the preference has been changed. |
94 * @param {Element} el The slider input element. | 112 * @param {Element} el The slider input element. |
95 * @param {number} value The mapped value currently set by the slider. | 113 * @param {number} value The mapped value currently set by the slider. |
96 * @private | 114 * @private |
97 */ | 115 */ |
98 minimumRangeChanged_: function(el, value) { | 116 minimumRangeChanged_: function(el, value) { |
99 var fontSampleEl = $('minimum-font-sample'); | 117 var fontSampleEl = $('minimum-font-sample'); |
100 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, | 118 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, |
101 true); | 119 true); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size, | 218 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size, |
201 null, true); | 219 null, true); |
202 }; | 220 }; |
203 | 221 |
204 // Export | 222 // Export |
205 return { | 223 return { |
206 FontSettings: FontSettings | 224 FontSettings: FontSettings |
207 }; | 225 }; |
208 }); | 226 }); |
209 | 227 |
OLD | NEW |