diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 968cc70cff1c..0d9bf14ac8bf 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -852,6 +852,8 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer, // Note that the async scroll offset is in ParentLayer pixels aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(), "asyncScrollOffset", apzc->GetCurrentAsyncScrollOffset(AsyncPanZoomController::eForHitTesting)); + aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(), "hasAsyncKeyScrolled", + apzc->TestHasAsyncKeyScrolled()); } if (newApzc) { diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 78516e07b6f6..90002ce5a3b0 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -737,6 +737,7 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId, mAPZCId(sAsyncPanZoomControllerCount++), mSharedLock(nullptr), mAsyncTransformAppliedToContent(false), + mTestHasAsyncKeyScrolled(false), mCheckerboardEventLock("APZCBELock") { if (aGestures == USE_GESTURE_DETECTOR) { @@ -1703,6 +1704,9 @@ AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) // Report the type of scroll action to telemetry ReportKeyboardScrollAction(aEvent.mAction); + // Mark that this APZC has async key scrolled + mTestHasAsyncKeyScrolled = true; + // Calculate the destination for this keyboard scroll action CSSPoint destination = GetKeyboardDestination(aEvent.mAction); nsIScrollableFrame::ScrollUnit scrollUnit = KeyboardScrollAction::GetScrollUnit(aEvent.mAction.mType); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 548cb897c739..3272c200caf9 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -1215,6 +1215,14 @@ private: * and assertion purposes only. */ public: + /** + * Gets whether this APZC has performed async key scrolling. + */ + bool TestHasAsyncKeyScrolled() const + { + return mTestHasAsyncKeyScrolled; + } + /** * Set an extra offset for testing async scrolling. */ @@ -1252,8 +1260,9 @@ private: LayerToParentLayerScale mTestAsyncZoom; // Flag to track whether or not the APZ transform is not used. This // flag is recomputed for every composition frame. - bool mAsyncTransformAppliedToContent; - + bool mAsyncTransformAppliedToContent : 1; + // Flag to track whether or not this APZC has ever async key scrolled. + bool mTestHasAsyncKeyScrolled : 1; /* =================================================================== * The functions and members in this section are used for checkerboard diff --git a/gfx/layers/apz/test/mochitest/apz_test_utils.js b/gfx/layers/apz/test/mochitest/apz_test_utils.js index a8ea4e9ec70f..79ec6e62faca 100644 --- a/gfx/layers/apz/test/mochitest/apz_test_utils.js +++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js @@ -275,6 +275,10 @@ function isApzEnabled() { return enabled; } +function isKeyApzEnabled() { + return isApzEnabled() && SpecialPowers.getBoolPref("apz.keyboard.enabled"); +} + // Despite what this function name says, this does not *directly* run the // provided continuation testFunction. Instead, it returns a function that // can be used to run the continuation. The extra level of indirection allows diff --git a/gfx/layers/apz/test/mochitest/helper_key_scroll.html b/gfx/layers/apz/test/mochitest/helper_key_scroll.html new file mode 100644 index 000000000000..ba7658560c6d --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_key_scroll.html @@ -0,0 +1,107 @@ + + + +
+ +