From 4cf9495b2a77b10dcfa6ef07ae68d5f9be8de433 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 1 Apr 2016 08:02:25 -0400 Subject: [PATCH] Bug 1251638 - Don't clamp the displayport to the scrollable rect on the compositor side. r=botond The clamping already happens on the content side, in nsLayoutUtils::GetDisplayPort and friends. The clamping there is more accurate as it reflects the latest main- thread information about the size of the page and position of the displayport base rect, which the compositor thread does not have. Since we are not clamping the displayport on the compositor side, it can "slosh around" a bit more and ends up sending a few more repaint requests when scrolling near the edges of the scrollable frame. This causes some gtests to fail because of the "extra" repaint requests. Disabling the velocity bias removes the sloshing around and fixes the test failures. MozReview-Commit-ID: JgBDi0M3Wtt --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 4 ++-- gfx/layers/apz/test/gtest/TestHitTesting.cpp | 2 ++ gfx/layers/apz/test/gtest/TestPanning.cpp | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 729a32cf40ff..52d8ccd8a037 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2834,8 +2834,8 @@ const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort( displayPort.MoveBy((compositionSize.width - displayPort.width)/2.0f, (compositionSize.height - displayPort.height)/2.0f); - // Make sure the displayport remains within the scrollable rect. - displayPort = displayPort.MoveInsideAndClamp(scrollableRect) - scrollOffset; + // Make the displayport relative to the scroll offset + displayPort = displayPort - scrollOffset; APZC_LOG_FM(aFrameMetrics, "Calculated displayport as (%f %f %f %f) from velocity %s paint time %f metrics", diff --git a/gfx/layers/apz/test/gtest/TestHitTesting.cpp b/gfx/layers/apz/test/gtest/TestHitTesting.cpp index 6232d9b0f492..de2b17deb5f0 100644 --- a/gfx/layers/apz/test/gtest/TestHitTesting.cpp +++ b/gfx/layers/apz/test/gtest/TestHitTesting.cpp @@ -162,6 +162,8 @@ TEST_F(APZHitTestingTester, HitTesting1) { // A more involved hit testing test that involves css and async transforms. TEST_F(APZHitTestingTester, HitTesting2) { + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests + CreateHitTesting2LayerTree(); ScopedLayerTreeRegistration registration(manager, 0, root, mcc); diff --git a/gfx/layers/apz/test/gtest/TestPanning.cpp b/gfx/layers/apz/test/gtest/TestPanning.cpp index 8d701d15aeba..835079e65bbc 100644 --- a/gfx/layers/apz/test/gtest/TestPanning.cpp +++ b/gfx/layers/apz/test/gtest/TestPanning.cpp @@ -80,6 +80,7 @@ protected: TEST_F(APZCPanningTester, Pan) { SCOPED_GFX_PREF(TouchActionEnabled, bool, false); + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests DoPanTest(true, true, mozilla::layers::AllowedTouchBehavior::NONE); } @@ -93,22 +94,26 @@ TEST_F(APZCPanningTester, Pan) { // events. TEST_F(APZCPanningTester, PanWithTouchActionAuto) { SCOPED_GFX_PREF(TouchActionEnabled, bool, true); + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests DoPanTest(true, true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN); } TEST_F(APZCPanningTester, PanWithTouchActionNone) { SCOPED_GFX_PREF(TouchActionEnabled, bool, true); + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests DoPanTest(false, false, 0); } TEST_F(APZCPanningTester, PanWithTouchActionPanX) { SCOPED_GFX_PREF(TouchActionEnabled, bool, true); + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests DoPanTest(false, true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN); } TEST_F(APZCPanningTester, PanWithTouchActionPanY) { SCOPED_GFX_PREF(TouchActionEnabled, bool, true); + SCOPED_GFX_PREF(APZVelocityBias, float, 0.0); // Velocity bias can cause extra repaint requests DoPanTest(true, true, mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN); }