Bug 1042152 - Add gaia settings that can disable low-precision/progressive painting and low-opacity behavior. r=vingtetun
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 24 Jul 2014 06:35:00 -0400
changeset 218169 7a19287696465e3a8429bbb3d2f1958543511cd9
parent 218168 447914859ecd0122876c476c38813fd82d9bd081
child 218170 e0abbf59e1e8ffa925f033353424ad0191be4b54
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs1042152
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1042152 - Add gaia settings that can disable low-precision/progressive painting and low-opacity behavior. r=vingtetun
b2g/chrome/content/settings.js
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -666,16 +666,54 @@ SettingsListener.observe("accessibility.
       // Pref not set; use default value.
     }
     let setting = {};
     setting[gaiaSettingName] = prefValue;
     window.navigator.mozSettings.createLock().set(setting);
   });
 })();
 
+// =================== Low-precision buffer ======================
+(function setupLowPrecisionSettings() {
+  // The gaia setting layers.low-precision maps to two gecko prefs
+  SettingsListener.observe('layers.low-precision', null, function(value) {
+    if (value !== null) {
+      // Update gecko from the new Gaia setting
+      Services.prefs.setBoolPref('layers.low-precision-buffer', value);
+      Services.prefs.setBoolPref('layers.progressive-paint', value);
+    } else {
+      // Update gaia setting from gecko value
+      try {
+        let prefValue = Services.prefs.getBoolPref('layers.low-precision-buffer');
+        let setting = { 'layers.low-precision': prefValue };
+        window.navigator.mozSettings.createLock().set(setting);
+      } catch (e) {
+        console.log('Unable to read pref layers.low-precision-buffer: ' + e);
+      }
+    }
+  });
+
+  // The gaia setting layers.low-opacity maps to a string gecko pref (0.5/1.0)
+  SettingsListener.observe('layers.low-opacity', null, function(value) {
+    if (value !== null) {
+      // Update gecko from the new Gaia setting
+      Services.prefs.setCharPref('layers.low-precision-opacity', value ? '0.5' : '1.0');
+    } else {
+      // Update gaia setting from gecko value
+      try {
+        let prefValue = Services.prefs.getCharPref('layers.low-precision-opacity');
+        let setting = { 'layers.low-opacity': (prefValue == '0.5') };
+        window.navigator.mozSettings.createLock().set(setting);
+      } catch (e) {
+        console.log('Unable to read pref layers.low-precision-opacity: ' + e);
+      }
+    }
+  });
+})();
+
 // =================== Various simple mapping  ======================
 let settingsToObserve = {
   'app.update.channel': {
     resetToPref: true
   },
   'app.update.interval': 86400,
   'app.update.url': {
     resetToPref: true