Bug 1670003 - Move some of the SCROLL_INPUT_METHODS recording. r=botond

In particular, for "continuous" scrolling methods - autoscroll, scrollbar
dragging, trackpad panning, and touch panning, this patch records the *start*
of the gesture rather than on every frame or input event *during* the gesture.
This conceptually changes the metric from being implementation-centric to being
more user-centric, in that each conceptual "user gesture" counts towards one
SCROLL_INPUT_METHOD record. This is more useful for the purposes of recording
user intent with respect to scroll input methods for experiments.

Depends on D92995

Differential Revision: https://phabricator.services.mozilla.com/D92996
This commit is contained in:
Kartikaya Gupta 2020-10-10 17:41:50 +00:00
Родитель 264e82488a
Коммит ccfa0015b9
4 изменённых файлов: 31 добавлений и 21 удалений

Просмотреть файл

@ -931,6 +931,10 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(
if (aEvent.mType == MouseInput::MouseType::MOUSE_DOWN) {
APZC_LOG("%p starting scrollbar drag\n", this);
SetState(SCROLLBAR_DRAG);
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzScrollbarDrag);
}
if (aEvent.mType != MouseInput::MouseType::MOUSE_MOVE) {
@ -944,9 +948,6 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(
MOZ_ASSERT(scrollbarData.mDirection.isSome());
ScrollDirection direction = *scrollbarData.mDirection;
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzScrollbarDrag);
bool isMouseAwayFromThumb = false;
if (int snapMultiplier = StaticPrefs::slider_snapMultiplier_AtStartup()) {
// It's fine to ignore the async component of the thumb's transform,
@ -1207,6 +1208,9 @@ void AsyncPanZoomController::StartAutoscroll(const ScreenPoint& aPoint) {
// Cancel any existing animation.
CancelAnimation();
Telemetry::Accumulate(Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzAutoscrolling);
SetState(AUTOSCROLL);
StartAnimation(new AutoscrollAnimation(*this, aPoint));
}
@ -2441,6 +2445,9 @@ nsEventStatus AsyncPanZoomController::OnPanBegin(
StartTouch(aEvent.mLocalPanStartPoint, aEvent.mTimeStamp);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzPanGesture);
if (GetAxisLockMode() == FREE) {
SetState(PANNING);
return nsEventStatus_eConsumeNoDefault;
@ -2573,9 +2580,6 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent,
HandlePanningUpdate(physicalPanDisplacement);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzPanGesture);
ScreenPoint panDistance(fabs(physicalPanDisplacement.x),
fabs(physicalPanDisplacement.y));
OverscrollHandoffState handoffState(
@ -3105,6 +3109,9 @@ nsEventStatus AsyncPanZoomController::StartPanning(
}
if (IsInPanningState()) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzTouch);
if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) {
controller->NotifyAPZStateChange(GetGuid(),
@ -3563,8 +3570,6 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
UpdateWithTouchAtDevicePoint(aEvent);
if (prevTouchPoint != touchPoint) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::ApzTouch);
MOZ_ASSERT(GetCurrentTouchBlock());
OverscrollHandoffState handoffState(
*GetCurrentTouchBlock()->GetOverscrollHandoffChain(), panVector,

Просмотреть файл

@ -12,7 +12,6 @@
#include "APZCTreeManager.h"
#include "FrameMetrics.h"
#include "mozilla/Telemetry.h" // for Telemetry
#include "mozilla/layers/ScrollInputMethods.h" // for ScrollInputMethod
namespace mozilla {
namespace layers {
@ -42,9 +41,6 @@ bool AutoscrollAnimation::DoSample(FrameMetrics& aFrameMetrics,
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-

Просмотреть файл

@ -523,10 +523,6 @@ nsresult nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadScrollbarDrag);
// take our current position and subtract the start location
pos -= mDragStart;
bool isMouseOutsideThumb = false;
@ -1121,6 +1117,19 @@ nsresult nsSliderFrame::StopDrag() {
AddListener();
DragThumb(false);
if (!mScrollingWithAPZ) {
// We record this one at the end of the drag rather than at the beginning
// because at the point that the main thread starts the drag (in StartDrag)
// it may not know for sure whether APZ or the main thread will end up
// handling the drag. Even if mScrollingWithAPZ is true initially, it
// may get set to false if APZ rejects the drag. But by the end of the drag
// the mScrollingWithAPZ flag should be correct and so we can use it here
// to determine if APZ or the main thread handled the drag.
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadScrollbarDrag);
}
mScrollingWithAPZ = false;
UnsuppressDisplayport();

Просмотреть файл

@ -235,6 +235,11 @@ class AutoScrollChild extends JSWindowActorChild {
let content = this.document.defaultView;
this._lastFrame = content.performance.now();
content.requestAnimationFrame(this.autoscrollLoop);
const kAutoscroll = 15; // defined in mozilla/layers/ScrollInputMethods.h
Services.telemetry
.getHistogramById("SCROLL_INPUT_METHODS")
.add(kAutoscroll);
}
stopScroll() {
@ -309,11 +314,6 @@ class AutoScrollChild extends JSWindowActorChild {
this._scrollErrorX = desiredScrollX - actualScrollX;
}
const kAutoscroll = 15; // defined in mozilla/layers/ScrollInputMethods.h
Services.telemetry
.getHistogramById("SCROLL_INPUT_METHODS")
.add(kAutoscroll);
this._scrollable.scrollBy({
left: actualScrollX,
top: actualScrollY,