Improve bad APZ wheel pref detection in about:support. (bug 1147223 part 2, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Wed, 25 Mar 2015 18:37:33 -0700
changeset 264631 1b0655f6b1104139061a1c332a724469befd6e0a
parent 264630 e122d0043843fab038021b53b29775ea8f580472
child 264632 07dc430fc6a0fefc4d400be0eecd379549f79cf6
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1147223
milestone39.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
Improve bad APZ wheel pref detection in about:support. (bug 1147223 part 2, r=kats)
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2325,42 +2325,53 @@ gfxPlatform::IsInLayoutAsapMode()
   // There are 2 modes of ASAP mode.
   // 1 is that the refresh driver and compositor are in lock step
   // the second is that the compositor goes ASAP and the refresh driver
   // goes at whatever the configurated rate is. This only checks the version
   // talos uses, which is the refresh driver and compositor are in lockstep.
   return Preferences::GetInt("layout.frame_rate", -1) == 0;
 }
 
+static nsString
+DetectBadApzWheelInputPrefs()
+{
+  static const char *sBadMultiplierPrefs[] = {
+    "mousewheel.default.delta_multiplier_x",
+    "mousewheel.with_alt.delta_multiplier_x",
+    "mousewheel.with_control.delta_multiplier_x",
+    "mousewheel.with_meta.delta_multiplier_x",
+    "mousewheel.with_shift.delta_multiplier_x",
+    "mousewheel.with_win.delta_multiplier_x",
+    "mousewheel.with_alt.delta_multiplier_y",
+    "mousewheel.with_control.delta_multiplier_y",
+    "mousewheel.with_meta.delta_multiplier_y",
+    "mousewheel.with_shift.delta_multiplier_y",
+    "mousewheel.with_win.delta_multiplier_y",
+  };
+
+  nsString badPref;
+  for (size_t i = 0; i < MOZ_ARRAY_LENGTH(sBadMultiplierPrefs); i++) {
+    if (Preferences::GetInt(sBadMultiplierPrefs[i], 100) != 100) {
+      badPref.AssignASCII(sBadMultiplierPrefs[i]);
+      break;
+    }
+  }
+
+  return badPref;
+}
+
 void
 gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj)
 {
+  if (!gfxPrefs::AsyncPanZoomEnabled()) {
+    return;
+  }
+
   if (SupportsApzWheelInput()) {
-    static const char *sBadPrefs[] = {
-      "mousewheel.default.delta_multiplier_x",
-      "mousewheel.with_alt.delta_multiplier_x",
-      "mousewheel.with_alt.delta_multiplier_x",
-      "mousewheel.with_control.delta_multiplier_x",
-      "mousewheel.with_meta.delta_multiplier_x",
-      "mousewheel.with_shift.delta_multiplier_x",
-      "mousewheel.with_win.delta_multiplier_x",
-      "mousewheel.with_alt.delta_multiplier_y",
-      "mousewheel.with_control.delta_multiplier_y",
-      "mousewheel.with_meta.delta_multiplier_y",
-      "mousewheel.with_shift.delta_multiplier_y",
-      "mousewheel.with_win.delta_multiplier_y",
-    };
-
-    nsString badPref;
-    for (size_t i = 0; i < MOZ_ARRAY_LENGTH(sBadPrefs); i++) {
-      if (Preferences::HasUserValue(sBadPrefs[i])) {
-        badPref.AssignASCII(sBadPrefs[i]);
-        break;
-      }
-    }
+    nsString badPref = DetectBadApzWheelInputPrefs();
 
     aObj.DefineProperty("ApzWheelInput", 1);
     if (badPref.Length()) {
       aObj.DefineProperty("ApzWheelInputWarning", badPref);
     }
   }
 
   if (SupportsApzTouchInput()) {