@@ -142,67 +142,6 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
142
142
rootApzc = ApzcOf (root);
143
143
}
144
144
145
- void CreateScrollgrabLayerTree (bool makeParentScrollable = true ) {
146
- const char * treeShape = " x(x)" ;
147
- LayerIntRect layerVisibleRect[] = {
148
- LayerIntRect (0 , 0 , 100 , 100 ), // scroll-grabbing parent
149
- LayerIntRect (0 , 20 , 100 , 80 ) // child
150
- };
151
- CreateScrollData (treeShape, layerVisibleRect);
152
- float parentHeight = makeParentScrollable ? 120 : 100 ;
153
- SetScrollableFrameMetrics (root, ScrollableLayerGuid::START_SCROLL_ID,
154
- CSSRect (0 , 0 , 100 , parentHeight));
155
- SetScrollableFrameMetrics (layers[1 ],
156
- ScrollableLayerGuid::START_SCROLL_ID + 1 ,
157
- CSSRect (0 , 0 , 100 , 800 ));
158
- SetScrollHandoff (layers[1 ], root);
159
- registration = MakeUnique<ScopedLayerTreeRegistration>(LayersId{0 }, mcc);
160
- UpdateHitTestingTree ();
161
- rootApzc = ApzcOf (root);
162
- rootApzc->GetScrollMetadata ().SetHasScrollgrab (true );
163
- }
164
-
165
- void TestFlingAcceleration () {
166
- // Jack up the fling acceleration multiplier so we can easily determine
167
- // whether acceleration occured.
168
- const float kAcceleration = 100 .0f ;
169
- SCOPED_GFX_PREF_FLOAT (" apz.fling_accel_base_mult" , kAcceleration );
170
- SCOPED_GFX_PREF_FLOAT (" apz.fling_accel_min_fling_velocity" , 0.0 );
171
- SCOPED_GFX_PREF_FLOAT (" apz.fling_accel_min_pan_velocity" , 0.0 );
172
-
173
- RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf (layers[1 ]);
174
-
175
- // Pan once, enough to fully scroll the scrollgrab parent and then scroll
176
- // and fling the child.
177
- QueueMockHitResult (ScrollableLayerGuid::START_SCROLL_ID + 1 );
178
- Pan (manager, 70 , 40 );
179
-
180
- // Give the fling animation a chance to start.
181
- SampleAnimationsOnce ();
182
-
183
- float childVelocityAfterFling1 = childApzc->GetVelocityVector ().y ;
184
-
185
- // Pan again.
186
- QueueMockHitResult (ScrollableLayerGuid::START_SCROLL_ID + 1 );
187
- Pan (manager, 70 , 40 );
188
-
189
- // Give the fling animation a chance to start.
190
- // This time it should be accelerated.
191
- SampleAnimationsOnce ();
192
-
193
- float childVelocityAfterFling2 = childApzc->GetVelocityVector ().y ;
194
-
195
- // We should have accelerated once.
196
- // The division by 2 is to account for friction.
197
- EXPECT_GT (childVelocityAfterFling2,
198
- childVelocityAfterFling1 * kAcceleration / 2 );
199
-
200
- // We should not have accelerated twice.
201
- // The division by 4 is to account for friction.
202
- EXPECT_LE (childVelocityAfterFling2,
203
- childVelocityAfterFling1 * kAcceleration * kAcceleration / 4 );
204
- }
205
-
206
145
void TestCrossApzcAxisLock () {
207
146
SCOPED_GFX_PREF_INT (" apz.axis_lock.mode" , 1 );
208
147
@@ -567,62 +506,6 @@ TEST_F(APZScrollHandoffTester, SimultaneousFlings) {
567
506
parent2->AssertStateIsFling ();
568
507
}
569
508
570
- #ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
571
- TEST_F (APZScrollHandoffTester, Scrollgrab) {
572
- SCOPED_GFX_PREF_BOOL (" apz.allow_immediate_handoff" , true );
573
-
574
- // Set up the layer tree
575
- CreateScrollgrabLayerTree ();
576
-
577
- RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf (layers[1 ]);
578
-
579
- // Pan on the child, enough to fully scroll the scrollgrab parent (20 px)
580
- // and leave some more (another 15 px) for the child.
581
- Pan (childApzc, 80 , 45 );
582
-
583
- // Check that the parent and child have scrolled as much as we expect.
584
- EXPECT_EQ (20 , rootApzc->GetFrameMetrics ().GetVisualScrollOffset ().y );
585
- EXPECT_EQ (15 , childApzc->GetFrameMetrics ().GetVisualScrollOffset ().y );
586
- }
587
- #endif
588
-
589
- TEST_F (APZScrollHandoffTester, ScrollgrabFling) {
590
- SCOPED_GFX_PREF_BOOL (" apz.allow_immediate_handoff" , true );
591
- SCOPED_GFX_PREF_FLOAT (" apz.fling_min_velocity_threshold" , 0 .0f );
592
-
593
- // Set up the layer tree
594
- CreateScrollgrabLayerTree ();
595
-
596
- RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf (layers[1 ]);
597
-
598
- // Pan on the child, not enough to fully scroll the scrollgrab parent.
599
- Pan (childApzc, 80 , 70 );
600
-
601
- // Check that it is the scrollgrab parent that's in a fling, not the child.
602
- rootApzc->AssertStateIsFling ();
603
- childApzc->AssertStateIsReset ();
604
- }
605
-
606
- TEST_F (APZScrollHandoffTesterMock, ScrollgrabFlingAcceleration1) {
607
- SCOPED_GFX_PREF_BOOL (" apz.allow_immediate_handoff" , true );
608
- SCOPED_GFX_PREF_FLOAT (" apz.fling_min_velocity_threshold" , 0 .0f );
609
- CreateScrollgrabLayerTree (true /* make parent scrollable */ );
610
-
611
- // Note: Usually, fling acceleration does not work across handoff, because our
612
- // fling acceleration code does not propagate the "fling cancel velocity"
613
- // across handoff. However, this test sets apz.fling_min_velocity_threshold to
614
- // zero, so the "fling cancel velocity" is allowed to be zero, and fling
615
- // acceleration succeeds, almost by accident.
616
- TestFlingAcceleration ();
617
- }
618
-
619
- TEST_F (APZScrollHandoffTesterMock, ScrollgrabFlingAcceleration2) {
620
- SCOPED_GFX_PREF_BOOL (" apz.allow_immediate_handoff" , true );
621
- SCOPED_GFX_PREF_FLOAT (" apz.fling_min_velocity_threshold" , 0 .0f );
622
- CreateScrollgrabLayerTree (false /* do not make parent scrollable */ );
623
- TestFlingAcceleration ();
624
- }
625
-
626
509
TEST_F (APZScrollHandoffTester, ImmediateHandoffDisallowed_Pan) {
627
510
SCOPED_GFX_PREF_BOOL (" apz.allow_immediate_handoff" , false );
628
511
0 commit comments