Bug 1249434 - Add a "Show web fonts" pref in advanced settings. r=jchen

MozReview-Commit-ID: EJl4qh0mOr4
This commit is contained in:
Margaret Leibovic 2016-02-22 16:37:48 -08:00
parent 5321bf4faa
commit 63f40cfd0f
4 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@ public final class PrefsHelper {
// Map pref name to ArrayList for multiple observers or PrefHandler for single observer.
private static final SimpleArrayMap<String, Object> OBSERVERS = new SimpleArrayMap<>();
private static final HashSet<String> INT_TO_STRING_PREFS = new HashSet<>(8);
private static final HashSet<String> INT_TO_BOOL_PREFS = new HashSet<>(2);
static {
INT_TO_STRING_PREFS.add("browser.chrome.titlebarMode");
@ -33,6 +34,7 @@ public final class PrefsHelper {
INT_TO_STRING_PREFS.add("font.size.inflation.minTwips");
INT_TO_STRING_PREFS.add("home.sync.updateMode");
INT_TO_STRING_PREFS.add("browser.image_blocking");
INT_TO_BOOL_PREFS.add("browser.display.use_document_fonts");
}
@WrapForJNI
@ -89,6 +91,9 @@ public final class PrefsHelper {
// actual types so we can store them.
type = PREF_INT;
intVal = Integer.parseInt(String.valueOf(value));
} else if (INT_TO_BOOL_PREFS.contains(pref)) {
type = PREF_INT;
intVal = (Boolean) value ? 1 : 0;
} else if (value instanceof Boolean) {
type = PREF_BOOL;
boolVal = (Boolean) value;
@ -214,6 +219,9 @@ public final class PrefsHelper {
if (INT_TO_STRING_PREFS.contains(pref)) {
type = PREF_STRING;
strVal = String.valueOf(intVal);
} else if (INT_TO_BOOL_PREFS.contains(pref)) {
type = PREF_BOOL;
boolVal = intVal == 1;
}
switch (type) {

View File

@ -230,6 +230,8 @@
<!ENTITY pref_tap_to_load_images_data "Only over Wi-Fi">
<!ENTITY pref_tap_to_load_images_disabled2 "Blocked">
<!ENTITY pref_show_web_fonts "Show web fonts">
<!ENTITY pref_tracking_protection_title "Tracking protection">
<!ENTITY pref_tracking_protection_summary3 "Enabled in Private Browsing">
<!ENTITY pref_donottrack_title "Do not track">

View File

@ -38,6 +38,9 @@
android:entryValues="@array/pref_browser_image_blocking_values"
android:persistent="false" />
<CheckBoxPreference android:key="browser.display.use_document_fonts"
android:title="@string/pref_show_web_fonts" />
<ListPreference android:key="plugin.enable"
android:title="@string/pref_plugins"
android:entries="@array/pref_plugins_entries"

View File

@ -214,6 +214,8 @@
<string name="pref_tap_to_load_images_data">&pref_tap_to_load_images_data;</string>
<string name="pref_tap_to_load_images_disabled2">&pref_tap_to_load_images_disabled2;</string>
<string name="pref_show_web_fonts">&pref_show_web_fonts;</string>
<string name="pref_tracking_protection_title">&pref_tracking_protection_title;</string>
<string name="pref_tracking_protection_summary">&pref_tracking_protection_summary3;</string>
<string name="pref_donottrack_title">&pref_donottrack_title;</string>