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

Side by Side Diff: chrome/browser/resources/options/font_settings.js

Issue 8118003: Changing fixed-width font size along with default when user changes in UI. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 37
groby-ooo-7-16 2011/10/04 01:48:07 Add prefChanged callback to set fixed font size
38 var minimumFontRange = $('minimum-font-size'); 38 var minimumFontRange = $('minimum-font-size');
39 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 39 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
40 18, 20, 22, 24]; 40 18, 20, 22, 24];
41 minimumFontRange.continuous = false; 41 minimumFontRange.continuous = false;
42 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this); 42 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this);
43 minimumFontRange.notifyPrefChange = 43 minimumFontRange.notifyPrefChange =
44 this.minimumFontSizeChanged_.bind(this); 44 this.minimumFontSizeChanged_.bind(this);
45 45
46 var placeholder = localStrings.getString('fontSettingsPlaceholder'); 46 var placeholder = localStrings.getString('fontSettingsPlaceholder');
47 var elements = [$('standard-font-family'), $('serif-font-family'), 47 var elements = [$('standard-font-family'), $('serif-font-family'),
(...skipping 20 matching lines...) Expand all
68 }, 68 },
69 69
70 /** 70 /**
71 * Called as the user changes the standard font size. This allows for 71 * Called as the user changes the standard font size. This allows for
72 * reflecting the change in the UI before the preference has been changed. 72 * reflecting the change in the UI before the preference has been changed.
73 * @param {Element} el The slider input element. 73 * @param {Element} el The slider input element.
74 * @param {number} value The mapped value currently set by the slider. 74 * @param {number} value The mapped value currently set by the slider.
75 * @private 75 * @private
76 */ 76 */
77 standardRangeChanged_: function(el, value) { 77 standardRangeChanged_: function(el, value) {
78 Preferences.setIntegerPref('webkit.webprefs.default_fixed_font_size',
groby-ooo-7-16 2011/10/04 01:48:07 Please call this in a prefChanged callback - as th
79 value, '');
80
78 var fontSampleEl = $('standard-font-sample'); 81 var fontSampleEl = $('standard-font-sample');
79 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, 82 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily,
80 true); 83 true);
81 84
82 fontSampleEl = $('serif-font-sample'); 85 fontSampleEl = $('serif-font-sample');
83 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, 86 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily,
84 true); 87 true);
85 88
86 fontSampleEl = $('sans-serif-font-sample'); 89 fontSampleEl = $('sans-serif-font-sample');
87 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily, 90 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily,
88 true); 91 true);
92
93 fontSampleEl = $('fixed-font-sample');
94 this.setUpFontSample_(fontSampleEl, value, fontSampleEl.style.fontFamily,
95 true);
89 }, 96 },
90 97
91 /** 98 /**
92 * Called as the user changes the miniumum font size. This allows for 99 * 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. 100 * reflecting the change in the UI before the preference has been changed.
94 * @param {Element} el The slider input element. 101 * @param {Element} el The slider input element.
95 * @param {number} value The mapped value currently set by the slider. 102 * @param {number} value The mapped value currently set by the slider.
96 * @private 103 * @private
97 */ 104 */
98 minimumRangeChanged_: function(el, value) { 105 minimumRangeChanged_: function(el, value) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size, 207 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size,
201 null, true); 208 null, true);
202 }; 209 };
203 210
204 // Export 211 // Export
205 return { 212 return {
206 FontSettings: FontSettings 213 FontSettings: FontSettings
207 }; 214 };
208 }); 215 });
209 216
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698