Bug 1846935 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Update on this:

The patch to enable MSD physics has not landed yet because it was found to regress [helper_mainthread_scroll_bug1662379.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_mainthread_scroll_bug1662379.html). I looked into that test failure.

The test scrolls a scrollable element, then performs an operation on it which triggers frame reconstruction, and checks that the frame reconstruction has the effect of resetting the scroll offset to zero.

The mechanism by which the frame reconstruction resets the scroll offset to zero is sending a [scroll position update](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/generic/nsGfxScrollFrame.cpp#293) to APZ with origin `ScrollOrigin::None`. This origin [cannot clobber](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/base/nsLayoutUtils.cpp#8796,8800) APZ scrolling, so there is a possibility of the scroll position update [being rejected](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5558-5562) if the user has scrolled the element in the meantime.

In the test, no user scrolling occurs at this time, but with MSD physics it seems that a small rounding error causes the [check for user scrolling](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5304-5307) to have a false positive.

I fixed this in [D193393](https://phabricator.services.mozilla.com/D193393) by using a more permissive check (using `COORDINATE_EPSILON`) for user scrolling.

Unfortunately, MSD physics seems to regress another test as well, [helper_relative_scroll_smoothness.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_relative_scroll_smoothness.html). I'm continuing to investigate that one.
Update on this:

The patch to enable MSD physics has not landed yet because it was found to regress [helper_mainthread_scroll_bug1662379.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_mainthread_scroll_bug1662379.html). I looked into that test failure.

The test scrolls a scrollable element, then performs an operation on it which triggers frame reconstruction, and checks that the frame reconstruction has the effect of resetting the scroll offset to zero. [Correction: the test actually [reparents](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_mainthread_scroll_bug1662379.html#83-88) the scrollable element, and it's the reparenting which has the effect of resetting the scroll offset.]

The mechanism by which the frame reconstruction resets the scroll offset to zero is sending a [scroll position update](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/generic/nsGfxScrollFrame.cpp#293) to APZ with origin `ScrollOrigin::None`. This origin [cannot clobber](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/base/nsLayoutUtils.cpp#8796,8800) APZ scrolling, so there is a possibility of the scroll position update [being rejected](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5558-5562) if the user has scrolled the element in the meantime.

In the test, no user scrolling occurs at this time, but with MSD physics it seems that a small rounding error causes the [check for user scrolling](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5304-5307) to have a false positive.

I fixed this in [D193393](https://phabricator.services.mozilla.com/D193393) by using a more permissive check (using `COORDINATE_EPSILON`) for user scrolling.

Unfortunately, MSD physics seems to regress another test as well, [helper_relative_scroll_smoothness.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_relative_scroll_smoothness.html). I'm continuing to investigate that one.
Update on this:

The patch to enable MSD physics has not landed yet because it was found to regress [helper_mainthread_scroll_bug1662379.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_mainthread_scroll_bug1662379.html). I looked into that test failure.

The test scrolls a scrollable element, then performs an operation on it which triggers frame reconstruction, and checks that the frame reconstruction has the effect of resetting the scroll offset to zero. [**Correction**: the test actually [reparents](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_mainthread_scroll_bug1662379.html#83-88) the scrollable element, and it's the reparenting which has the effect of resetting the scroll offset.]

The mechanism by which the frame reconstruction resets the scroll offset to zero is sending a [scroll position update](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/generic/nsGfxScrollFrame.cpp#293) to APZ with origin `ScrollOrigin::None`. This origin [cannot clobber](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/layout/base/nsLayoutUtils.cpp#8796,8800) APZ scrolling, so there is a possibility of the scroll position update [being rejected](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5558-5562) if the user has scrolled the element in the meantime.

In the test, no user scrolling occurs at this time, but with MSD physics it seems that a small rounding error causes the [check for user scrolling](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/src/AsyncPanZoomController.cpp#5304-5307) to have a false positive.

I fixed this in [D193393](https://phabricator.services.mozilla.com/D193393) by using a more permissive check (using `COORDINATE_EPSILON`) for user scrolling.

Unfortunately, MSD physics seems to regress another test as well, [helper_relative_scroll_smoothness.html](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/gfx/layers/apz/test/mochitest/helper_relative_scroll_smoothness.html). I'm continuing to investigate that one.

Back to Bug 1846935 Comment 3