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

Unified Diff: chrome/browser/resources/settings/appearance_page/appearance_page.js

Issue 2817243003: [MD settings] observe changes to default font size in Appearance (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/appearance_page/appearance_page.js
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_page/appearance_page.js
index 9039741b3736e81b204bfe2cd4a79ab3e86168c7..de1520abc79a477db6ddfbcf9dfa33597ce5f4f6 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -2,6 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+/**
+ * This is the absolute difference maintained between standard and
+ * fixed-width font sizes. http://crbug.com/91922.
+ * @const @private {number}
+ */
+var SIZE_DIFFERENCE_FIXED_STANDARD_ = 3;
+
+
/**
* 'settings-appearance-page' is the settings page containing appearance
* settings.
@@ -110,12 +119,13 @@ Polymer({
themeUrl_: '',
observers: [
+ 'onDefaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)',
michaelpg 2017/04/17 20:06:28 nit: consistency w/ other observers: defaultFontSi
dschuyler 2017/04/17 21:26:11 Done.
'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
-// <if expr="is_linux and not chromeos">
+ // <if expr="is_linux and not chromeos">
dschuyler 2017/04/15 01:27:57 This indention (here and below) is done by git cl
// NOTE: this pref only exists on Linux.
'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
-// </if>
+ // </if>
],
created: function() {
@@ -165,6 +175,21 @@ Polymer({
this.fire('refresh-pref', 'homepage');
},
+ /**
+ * @param {number} value The changed font size slider value.
+ * @private
+ */
+ onDefaultFontSizeChanged_: function(value) {
+ // This is unusual but there is a pref that is dependent upon another.
michaelpg 2017/04/17 20:06:28 as a *minor* nit, could you try to condense this c
dschuyler 2017/04/17 21:26:11 Done.
+ // Whenever the |default_font_size| is changed, this will update the
+ // |default_fixed_font_size| as well. They can (and are) handled separately
+ // in extensions. In the built-in settings (here), they are tied together to
+ // simplify the UI.
+ this.set(
+ 'prefs.webkit.webprefs.default_fixed_font_size.value',
+ value - SIZE_DIFFERENCE_FIXED_STANDARD_);
+ },
+
/** @private */
onThemesTap_: function() {
window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'));
@@ -250,12 +275,12 @@ Polymer({
}
var i18nId;
-// <if expr="is_linux and not chromeos">
+ // <if expr="is_linux and not chromeos">
i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme';
-// </if>
-// <if expr="not is_linux or chromeos">
+ // </if>
+ // <if expr="not is_linux or chromeos">
i18nId = 'chooseFromWebStore';
-// </if>
+ // </if>
this.themeSublabel_ = this.i18n(i18nId);
this.themeUrl_ = '';
},

Powered by Google App Engine
This is Rietveld 408576698