Bug 1573720 - Convert ui.touch_activation.delay_ms to a static pref. r=botond
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 15 Aug 2019 05:30:09 +0000
changeset 488187 b4681ecf1fbcf34425db3438339f0ba0f0b71c52
parent 488186 c468c61b502549d11efbc0d09fb8ea542eeecdf5
child 488188 e3ec23ebfc2d1065967a7b45a89b700c94cfb31f
push id113904
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:41:00 +0000
treeherdermozilla-inbound@b283a7ef186c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1573720
milestone70.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 1573720 - Convert ui.touch_activation.delay_ms to a static pref. r=botond Differential Revision: https://phabricator.services.mozilla.com/D41914
gfx/layers/apz/util/ActiveElementManager.cpp
modules/libpref/init/StaticPrefList.yaml
modules/libpref/init/all.js
--- a/gfx/layers/apz/util/ActiveElementManager.cpp
+++ b/gfx/layers/apz/util/ActiveElementManager.cpp
@@ -2,40 +2,31 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ActiveElementManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
-#include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
+#include "mozilla/StaticPrefs_ui.h"
 #include "base/message_loop.h"
 #include "base/task.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Document.h"
 
 #define AEM_LOG(...)
 // #define AEM_LOG(...) printf_stderr("AEM: " __VA_ARGS__)
 
 namespace mozilla {
 namespace layers {
 
-static int32_t sActivationDelayMs = 100;
-static bool sActivationDelayMsSet = false;
-
 ActiveElementManager::ActiveElementManager()
     : mCanBePan(false), mCanBePanSet(false), mSetActiveTask(nullptr) {
-  if (!sActivationDelayMsSet) {
-    Preferences::AddIntVarCache(&sActivationDelayMs,
-                                "ui.touch_activation.delay_ms",
-                                sActivationDelayMs);
-    sActivationDelayMsSet = true;
-  }
 }
 
 ActiveElementManager::~ActiveElementManager() {}
 
 void ActiveElementManager::SetTargetElement(dom::EventTarget* aTarget) {
   if (mTarget) {
     // Multiple fingers on screen (since HandleTouchEnd clears mTarget).
     AEM_LOG("Multiple fingers on-screen, clearing target element\n");
@@ -83,17 +74,18 @@ void ActiveElementManager::TriggerElemen
                    // bug properly should make this unnecessary.
     MOZ_ASSERT(mSetActiveTask == nullptr);
 
     RefPtr<CancelableRunnable> task =
         NewCancelableRunnableMethod<nsCOMPtr<dom::Element>>(
             "layers::ActiveElementManager::SetActiveTask", this,
             &ActiveElementManager::SetActiveTask, mTarget);
     mSetActiveTask = task;
-    MessageLoop::current()->PostDelayedTask(task.forget(), sActivationDelayMs);
+    MessageLoop::current()->PostDelayedTask(
+        task.forget(), StaticPrefs::ui_touch_activation_delay_ms());
     AEM_LOG("Scheduling mSetActiveTask %p\n", mSetActiveTask);
   }
 }
 
 void ActiveElementManager::ClearActivation() {
   AEM_LOG("Clearing element activation\n");
   CancelTask();
   ResetActive();
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -6471,16 +6471,24 @@
   type: RelaxedAtomicBool
   value: false
   mirror: always
 
 #---------------------------------------------------------------------------
 # Prefs starting with "ui."
 #---------------------------------------------------------------------------
 
+# If the user puts a finger down on an element and we think the user might be
+# executing a pan gesture, how long do we wait before tentatively deciding the
+# gesture is actually a tap and activating the target element?
+- name: ui.touch_activation.delay_ms
+  type: int32_t
+  value: 100
+  mirror: always
+
 # Prevent system colors from being exposed to CSS or canvas.
 - name: ui.use_standins_for_native_colors
   type: RelaxedAtomicBool
   value: false
   mirror: always
 
 # Disable page loading activity cursor by default.
 - name: ui.use_activity_cursor
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4960,22 +4960,16 @@ pref("gfx.vr.osvr.utilLibPath", "");
 pref("gfx.vr.osvr.commonLibPath", "");
 pref("gfx.vr.osvr.clientLibPath", "");
 pref("gfx.vr.osvr.clientKitLibPath", "");
 // The number of milliseconds since last frame start before triggering a new frame.
 // When content is failing to submit frames on time or the lower level VR platform API's
 // are rejecting frames, it determines the rate at which RAF callbacks will be called.
 pref("dom.vr.display.rafMaxDuration", 50);
 
-// If the user puts a finger down on an element and we think the user
-// might be executing a pan gesture, how long do we wait before
-// tentatively deciding the gesture is actually a tap and activating
-// the target element?
-pref("ui.touch_activation.delay_ms", 100);
-
 // If the user has clicked an element, how long do we keep the
 // :active state before it is cleared by the mouse sequences
 // fired after a touchstart/touchend.
 pref("ui.touch_activation.duration_ms", 10);
 
 // nsMemoryInfoDumper can watch a fifo in the temp directory and take various
 // actions when the fifo is written to.  Disable this in general.
 pref("memory_info_dumper.watch_fifo.enabled", false);