Bug 1105109 - ScrollInputMethod telemetry for APZ autoscrolling. r=kats
MozReview-Commit-ID: 5ICwYnZTcm9
--- a/gfx/layers/apz/src/AutoscrollAnimation.cpp
+++ b/gfx/layers/apz/src/AutoscrollAnimation.cpp
@@ -4,16 +4,18 @@
* 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 "AutoscrollAnimation.h"
#include <cmath> // for sqrtf()
#include "AsyncPanZoomController.h"
+#include "mozilla/Telemetry.h" // for Telemetry
+#include "mozilla/layers/ScrollInputMethods.h" // for ScrollInputMethod
namespace mozilla {
namespace layers {
// Helper function for AutoscrollAnimation::DoSample().
// Basically copied as-is from toolkit/content/browser-content.js.
static float
Accelerate(ScreenCoord curr, ScreenCoord start)
@@ -39,16 +41,19 @@ AutoscrollAnimation::AutoscrollAnimation
bool
AutoscrollAnimation::DoSample(FrameMetrics& aFrameMetrics, const TimeDuration& aDelta)
{
APZCTreeManager* treeManager = mApzc.GetApzcTreeManager();
if (!treeManager) {
return false;
}
+ Telemetry::Accumulate(Telemetry::SCROLL_INPUT_METHODS,
+ (uint32_t) ScrollInputMethod::ApzAutoscrolling);
+
ScreenPoint mouseLocation = treeManager->GetCurrentMousePosition();
// The implementation of this function closely mirrors that of its main-
// thread equivalent, the autoscrollLoop() function in
// toolkit/content/browser-content.js.
// Avoid long jumps when the browser hangs for more than |maxTimeDelta| ms.
static const TimeDuration maxTimeDelta = TimeDuration::FromMilliseconds(100);
--- a/gfx/layers/apz/util/ScrollInputMethods.h
+++ b/gfx/layers/apz/util/ScrollInputMethods.h
@@ -46,26 +46,31 @@ enum class ScrollInputMethod {
MainThreadScrollbarButtonClick, // clicking the buttons at the ends of the
// scrollback track
MainThreadScrollbarTrackClick, // clicking the scrollbar track above or
// below the thumb
// Autoscrolling
MainThreadAutoscrolling, // autoscrolling
+ // === Additional input methods implemented in APZ ===
+
// Async Keyboard
ApzScrollLine, // line scrolling
// (generally triggered by up/down arrow keys)
ApzScrollCharacter, // character scrolling
// (generally triggered by left/right arrow keys)
ApzScrollPage, // page scrolling
// (generally triggered by PageUp/PageDown keys)
ApzCompleteScroll, // scrolling to the end of the scroll range
// (generally triggered by Home/End keys)
+ // Autoscrolling
+ ApzAutoscrolling,
+
// New input methods can be added at the end, up to a maximum of 64.
// They should only be added at the end, to preserve the numerical values
// of the existing enumerators.
};
} // namespace layers
} // namespace mozilla