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 @@ + + + + + + Async key scrolling test, helper page + + + + + + + Async key scrolling test + +
+ + diff --git a/gfx/layers/apz/test/mochitest/mochitest.ini b/gfx/layers/apz/test/mochitest/mochitest.ini index 0696805561e2..b15a68c9cc9f 100644 --- a/gfx/layers/apz/test/mochitest/mochitest.ini +++ b/gfx/layers/apz/test/mochitest/mochitest.ini @@ -18,6 +18,7 @@ helper_iframe_pan.html helper_iframe1.html helper_iframe2.html + helper_key_scroll.html helper_long_tap.html helper_scroll_inactive_perspective.html helper_scroll_inactive_zindex.html @@ -53,6 +54,7 @@ [test_group_zoom.html] skip-if = (toolkit != 'android') # only android supports zoom [test_interrupted_reflow.html] +[test_key_scroll.html] [test_layerization.html] skip-if = (os == 'android') # wheel events not supported on mobile [test_scroll_inactive_bug1190112.html] diff --git a/gfx/layers/apz/test/mochitest/test_key_scroll.html b/gfx/layers/apz/test/mochitest/test_key_scroll.html new file mode 100644 index 000000000000..7dc32673ef75 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/test_key_scroll.html @@ -0,0 +1,41 @@ + + + + + + Async key scrolling test + + + + + + + Async key scrolling test + +