diff options
author | nqk836@motorola.com <nqk836@motorola.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 16:56:09 +0000 |
---|---|---|
committer | nqk836@motorola.com <nqk836@motorola.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 16:56:09 +0000 |
commit | 32632d1e929a255272ece4dc7acfc148ea235082 (patch) | |
tree | 8bafd8a5aad1f372f82a6f418ab26755ae7d0a35 | |
parent | 85dd6093d800d645a3a8db3a5029c8e952d3fc6d (diff) | |
download | chromium_src-32632d1e929a255272ece4dc7acfc148ea235082.zip chromium_src-32632d1e929a255272ece4dc7acfc148ea235082.tar.gz chromium_src-32632d1e929a255272ece4dc7acfc148ea235082.tar.bz2 |
Changing fixed-width font size along with default when user selects preset font sizes.
BUG=91922
TEST=When a preset font size is selected in advanced options page, fixed-width font size should change along with default font size.
Contributed by rosen.dash@motorola.com
Review URL: http://codereview.chromium.org/9429051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123657 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 27 insertions, 21 deletions
diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js index 846202d..fc0a2ee 100644 --- a/chrome/browser/resources/options/advanced_options.js +++ b/chrome/browser/resources/options/advanced_options.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -60,8 +60,11 @@ var OptionsPage = options.OptionsPage; chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); }; $('defaultFontSize').onchange = function(event) { - chrome.send('defaultFontSizeAction', - [String(event.target.options[event.target.selectedIndex].value)]); + var value = event.target.options[event.target.selectedIndex].value; + Preferences.setIntegerPref( + 'webkit.webprefs.global.default_fixed_font_size', + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, ''); + chrome.send('defaultFontSizeAction', [String(value)]); }; $('defaultZoomFactor').onchange = function(event) { chrome.send('defaultZoomFactorAction', diff --git a/chrome/browser/resources/options/font_settings.js b/chrome/browser/resources/options/font_settings.js index cd45510..66014e7 100644 --- a/chrome/browser/resources/options/font_settings.js +++ b/chrome/browser/resources/options/font_settings.js @@ -7,12 +7,6 @@ cr.define('options', function() { var OptionsPage = options.OptionsPage; /** - * This is the absolute difference maintained between standard and - * fixed-width font sizes. Refer http://crbug.com/91922. - */ - const SIZE_DIFFERENCE_FIXED_STANDARD = 3; - - /** * FontSettings class * Encapsulated handling of the 'Fonts and Encoding' page. * @class @@ -97,7 +91,7 @@ cr.define('options', function() { fontSampleEl = $('fixed-font-sample'); this.setUpFontSample_(fontSampleEl, - value - SIZE_DIFFERENCE_FIXED_STANDARD, + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, fontSampleEl.style.fontFamily, false); }, @@ -111,7 +105,7 @@ cr.define('options', function() { standardFontSizeChanged_: function(el, value) { Preferences.setIntegerPref( 'webkit.webprefs.global.default_fixed_font_size', - value - SIZE_DIFFERENCE_FIXED_STANDARD, ''); + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, ''); }, /** diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index 9143968..23eae45 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -26,6 +26,12 @@ cr.define('options', function() { const SUBPAGE_SHEET_COUNT = 2; /** + * This is the absolute difference maintained between standard and + * fixed-width font sizes. Refer http://crbug.com/91922. + */ + OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD = 3; + + /** * Main level option pages. Maps lower-case page names to the respective page * object. * @protected diff --git a/chrome/browser/resources/options2/advanced_options.js b/chrome/browser/resources/options2/advanced_options.js index 00dbebf..d3e712a 100644 --- a/chrome/browser/resources/options2/advanced_options.js +++ b/chrome/browser/resources/options2/advanced_options.js @@ -141,8 +141,11 @@ cr.define('options', function() { chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); }; $('defaultFontSize').onchange = function(event) { - chrome.send('defaultFontSizeAction', - [String(event.target.options[event.target.selectedIndex].value)]); + var value = event.target.options[event.target.selectedIndex].value; + Preferences.setIntegerPref( + 'webkit.webprefs.global.default_fixed_font_size', + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, ''); + chrome.send('defaultFontSizeAction', [String(value)]); }; $('defaultZoomFactor').onchange = function(event) { chrome.send('defaultZoomFactorAction', diff --git a/chrome/browser/resources/options2/font_settings.js b/chrome/browser/resources/options2/font_settings.js index b623d27..19d4cf6 100644 --- a/chrome/browser/resources/options2/font_settings.js +++ b/chrome/browser/resources/options2/font_settings.js @@ -7,12 +7,6 @@ cr.define('options', function() { var OptionsPage = options.OptionsPage; /** - * This is the absolute difference maintained between standard and - * fixed-width font sizes. Refer http://crbug.com/91922. - */ - const SIZE_DIFFERENCE_FIXED_STANDARD = 3; - - /** * FontSettings class * Encapsulated handling of the 'Fonts and Encoding' page. * @class @@ -101,7 +95,7 @@ cr.define('options', function() { fontSampleEl = $('fixed-font-sample'); this.setUpFontSample_(fontSampleEl, - value - SIZE_DIFFERENCE_FIXED_STANDARD, + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, fontSampleEl.style.fontFamily, false); }, @@ -115,7 +109,7 @@ cr.define('options', function() { standardFontSizeChanged_: function(el, value) { Preferences.setIntegerPref( 'webkit.webprefs.global.default_fixed_font_size', - value - SIZE_DIFFERENCE_FIXED_STANDARD, ''); + value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, ''); }, /** diff --git a/chrome/browser/resources/options2/options_page.js b/chrome/browser/resources/options2/options_page.js index 96e2151..d84de73 100644 --- a/chrome/browser/resources/options2/options_page.js +++ b/chrome/browser/resources/options2/options_page.js @@ -26,6 +26,12 @@ cr.define('options', function() { const HORIZONTAL_OFFSET = 155; /** + * This is the absolute difference maintained between standard and + * fixed-width font sizes. Refer http://crbug.com/91922. + */ + OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD = 3; + + /** * Main level option pages. Maps lower-case page names to the respective page * object. * @protected |