Bug 1351783 part 20 - Report async keyboard scrolling to telemetry. r?botond
MozReview-Commit-ID: IwLL2xg3BgY
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1656,19 +1656,53 @@ AsyncPanZoomController::GetScrollWheelDe
delta.y = (delta.y >= 0)
? pageScrollSize.height
: -pageScrollSize.height;
}
return delta;
}
+static
+void ReportKeyboardScrollAction(const KeyboardScrollAction& aAction)
+{
+ ScrollInputMethod scrollMethod;
+
+ switch (aAction.mType) {
+ case KeyboardScrollAction::eScrollLine: {
+ scrollMethod = ScrollInputMethod::ApzScrollLine;
+ break;
+ }
+ case KeyboardScrollAction::eScrollCharacter: {
+ scrollMethod = ScrollInputMethod::ApzScrollCharacter;
+ break;
+ }
+ case KeyboardScrollAction::eScrollPage: {
+ scrollMethod = ScrollInputMethod::ApzScrollPage;
+ break;
+ }
+ case KeyboardScrollAction::eScrollComplete: {
+ scrollMethod = ScrollInputMethod::ApzCompleteScroll;
+ break;
+ }
+ case KeyboardScrollAction::eSentinel: {
+ MOZ_ASSERT_UNREACHABLE("Invalid KeyboardScrollAction.");
+ }
+ }
+
+ mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
+ (uint32_t)scrollMethod);
+}
+
nsEventStatus
AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent)
{
+ // Report the type of scroll action to telemetry
+ ReportKeyboardScrollAction(aEvent.mAction);
+
// Calculate the destination for this keyboard scroll action
nsPoint destination = CSSPoint::ToAppUnits(GetKeyboardDestination(aEvent.mAction));
// The lock must be held across the entire update operation, so the
// compositor doesn't end the animation before we get a chance to
// update it.
ReentrantMonitorAutoEnter lock(mMonitor);
--- a/gfx/layers/apz/util/ScrollInputMethods.h
+++ b/gfx/layers/apz/util/ScrollInputMethods.h
@@ -46,16 +46,26 @@ 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
+ // 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)
+
// 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