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

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

Issue 6602021: web-ui settings: Standard font setting now correlates to WebKit's standard fo... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: rebase Created 9 years, 9 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 // 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 11 matching lines...) Expand all
22 22
23 FontSettings.prototype = { 23 FontSettings.prototype = {
24 __proto__: OptionsPage.prototype, 24 __proto__: OptionsPage.prototype,
25 25
26 /** 26 /**
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 serifFontRange = $('serif-font-size'); 32 var standardFontRange = $('standard-font-size');
33 serifFontRange.valueMap = $('fixed-font-size').valueMap = [9, 10, 11, 12, 33 standardFontRange.valueMap = $('fixed-font-size').valueMap = [9, 10, 11,
34 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 34 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40,
35 48, 56, 64, 72]; 35 44, 48, 56, 64, 72];
36 serifFontRange.continuous = false; 36 standardFontRange.continuous = false;
37 serifFontRange.fontSampleEl = $('serif-font-sample'); 37 standardFontRange.fontSampleEl = $('standard-font-sample');
38 serifFontRange.notifyChange = this.rangeChanged_.bind(this); 38 standardFontRange.notifyChange = this.rangeChanged_.bind(this);
39 39
40 var minimumFontRange = $('minimum-font-size'); 40 var minimumFontRange = $('minimum-font-size');
41 minimumFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 41 minimumFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20,
42 22, 24]; 42 22, 24];
43 minimumFontRange.continuous = false; 43 minimumFontRange.continuous = false;
44 minimumFontRange.fontSampleEl = $('minimum-font-sample'); 44 minimumFontRange.fontSampleEl = $('minimum-font-sample');
45 minimumFontRange.notifyChange = this.rangeChanged_.bind(this); 45 minimumFontRange.notifyChange = this.rangeChanged_.bind(this);
46 minimumFontRange.notifyPrefChange = 46 minimumFontRange.notifyPrefChange =
47 this.minimumFontSizeChanged_.bind(this); 47 this.minimumFontSizeChanged_.bind(this);
48 48
49 var placeholder = localStrings.getString('fontSettingsPlaceholder'); 49 var placeholder = localStrings.getString('fontSettingsPlaceholder');
50 $('serif-font-family').appendChild(new Option(placeholder)); 50 $('standard-font-family').appendChild(new Option(placeholder));
51 $('fixed-font-family').appendChild(new Option(placeholder)); 51 $('fixed-font-family').appendChild(new Option(placeholder));
52 $('font-encoding').appendChild(new Option(placeholder)); 52 $('font-encoding').appendChild(new Option(placeholder));
53
54 // Add an additional listener to the font select menu for the
55 // 'sansserif_font_family' preference.
56 $('serif-font-family').addEventListener('change',
57 function(e) {
58 Preferences.setStringPref('webkit.webprefs.sansserif_font_family',
59 this.options[this.selectedIndex].value, '');
60 });
61 }, 53 },
62 54
63 /** 55 /**
64 * Called by the options page when this page has been shown. 56 * Called by the options page when this page has been shown.
65 */ 57 */
66 didShowPage: function() { 58 didShowPage: function() {
67 // The fonts list may be large so we only load it when this page is 59 // The fonts list may be large so we only load it when this page is
68 // loaded for the first time. This makes opening the options window 60 // loaded for the first time. This makes opening the options window
69 // faster and consume less memory if the user never opens the fonts 61 // faster and consume less memory if the user never opens the fonts
70 // dialog. 62 // dialog.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 130 }
139 131
140 // Enable if not a managed pref. 132 // Enable if not a managed pref.
141 if (!element.managed) 133 if (!element.managed)
142 element.disabled = false; 134 element.disabled = false;
143 } 135 }
144 }; 136 };
145 137
146 // Chrome callbacks 138 // Chrome callbacks
147 FontSettings.setFontsData = function(fonts, encodings, selectedValues) { 139 FontSettings.setFontsData = function(fonts, encodings, selectedValues) {
148 FontSettings.getInstance().populateSelect_($('serif-font-family'), fonts, 140 FontSettings.getInstance().populateSelect_($('standard-font-family'), fonts,
149 selectedValues[0]); 141 selectedValues[0]);
150 FontSettings.getInstance().populateSelect_($('fixed-font-family'), fonts, 142 FontSettings.getInstance().populateSelect_($('fixed-font-family'), fonts,
151 selectedValues[1]); 143 selectedValues[1]);
152 FontSettings.getInstance().populateSelect_($('font-encoding'), encodings, 144 FontSettings.getInstance().populateSelect_($('font-encoding'), encodings,
153 selectedValues[2]); 145 selectedValues[2]);
154 }; 146 };
155 147
156 FontSettings.setupSerifFontSample = function(font, size) { 148 FontSettings.setupStandardFontSample = function(font, size) {
157 FontSettings.getInstance().setupFontSample_($('serif-font-sample'), size, 149 FontSettings.getInstance().setupFontSample_($('standard-font-sample'), size,
158 font); 150 font);
159 }; 151 };
160 152
161 FontSettings.setupFixedFontSample = function(font, size) { 153 FontSettings.setupFixedFontSample = function(font, size) {
162 FontSettings.getInstance().setupFontSample_($('fixed-font-sample'), size, 154 FontSettings.getInstance().setupFontSample_($('fixed-font-sample'), size,
163 font); 155 font);
164 }; 156 };
165 157
166 FontSettings.setupMinimumFontSample = function(size) { 158 FontSettings.setupMinimumFontSample = function(size) {
167 FontSettings.getInstance().setupFontSample_($('minimum-font-sample'), size); 159 FontSettings.getInstance().setupFontSample_($('minimum-font-sample'), size);
168 }; 160 };
169 161
170 // Export 162 // Export
171 return { 163 return {
172 FontSettings: FontSettings 164 FontSettings: FontSettings
173 }; 165 };
174 }); 166 });
175 167
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/font_settings.html ('k') | chrome/browser/tab_contents/render_view_host_delegate_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698