mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 18:55:30 +00:00
Bug 1570559 - Add a helper function APZCTreeManagerTester::UpdateHitTestingTree(). r=tnikkel
Depends on D44712 Differential Revision: https://phabricator.services.mozilla.com/D45082 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
20431125e7
commit
8bbdacfb8a
@ -63,6 +63,12 @@ class APZCTreeManagerTester : public APZCTesterBase {
|
||||
aLayer->SetScrollMetadata(metadata);
|
||||
}
|
||||
|
||||
// A convenience wrapper for manager->UpdateHitTestingTree().
|
||||
void UpdateHitTestingTree(uint32_t aPaintSequenceNumber = 0) {
|
||||
manager->UpdateHitTestingTree(root, /* is first paint = */ false,
|
||||
LayersId{0}, aPaintSequenceNumber);
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<Layer> > layers;
|
||||
RefPtr<LayerManager> lm;
|
||||
RefPtr<Layer> root;
|
||||
|
@ -47,7 +47,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
}
|
||||
|
||||
void CreateBug1117712LayerTree() {
|
||||
@ -178,7 +178,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
}
|
||||
};
|
||||
|
||||
@ -265,7 +265,7 @@ TEST_F(APZEventRegionsTester, Obscuration) {
|
||||
CreateObscuringLayerTree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> parent = ApzcOf(layers[1]);
|
||||
TestAsyncPanZoomController* child = ApzcOf(layers[2]);
|
||||
|
@ -147,8 +147,7 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
|
||||
// Now we have a root APZC that will match the page
|
||||
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0},
|
||||
paintSequenceNumber++);
|
||||
UpdateHitTestingTree(paintSequenceNumber++);
|
||||
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ApzcOf(root), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
@ -160,8 +159,7 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
// Now we have a sub APZC with a better fit
|
||||
SetScrollableFrameMetrics(layers[3],
|
||||
ScrollableLayerGuid::START_SCROLL_ID + 1);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0},
|
||||
paintSequenceNumber++);
|
||||
UpdateHitTestingTree(paintSequenceNumber++);
|
||||
EXPECT_NE(ApzcOf(root), ApzcOf(layers[3]));
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ApzcOf(layers[3]), hit.get());
|
||||
@ -179,8 +177,7 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
// Now test hit testing when we have two scrollable layers
|
||||
SetScrollableFrameMetrics(layers[4],
|
||||
ScrollableLayerGuid::START_SCROLL_ID + 2);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0},
|
||||
paintSequenceNumber++);
|
||||
UpdateHitTestingTree(paintSequenceNumber++);
|
||||
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ApzcOf(layers[4]), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
@ -218,7 +215,7 @@ TEST_F(APZHitTestingTester, HitTesting2) {
|
||||
CreateHitTesting2LayerTree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// At this point, the following holds (all coordinates in screen pixels):
|
||||
// layers[0] has content from (0,0)-(200,200), clipped by composition bounds
|
||||
@ -363,7 +360,7 @@ TEST_F(APZHitTestingTester, HitTesting3) {
|
||||
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<AsyncPanZoomController> hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||
EXPECT_EQ(ApzcOf(layers[1]), hit.get());
|
||||
@ -374,7 +371,7 @@ TEST_F(APZHitTestingTester, ComplexMultiLayerTree) {
|
||||
|
||||
CreateComplexMultiLayerTree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
/* The layer tree looks like this:
|
||||
|
||||
@ -464,7 +461,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnNewInputBlock) {
|
||||
|
||||
CreateSimpleScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
RefPtr<TestAsyncPanZoomController> apzcroot = ApzcOf(root);
|
||||
|
||||
// At this point, the following holds (all coordinates in screen pixels):
|
||||
@ -537,7 +534,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) {
|
||||
|
||||
CreateSimpleScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
TestAsyncPanZoomController* apzcroot = ApzcOf(root);
|
||||
|
||||
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(3));
|
||||
@ -567,7 +564,7 @@ TEST_F(APZHitTestingTester, TestForceDisableApz) {
|
||||
CreateSimpleScrollingLayer();
|
||||
DisableApzOn(root);
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
TestAsyncPanZoomController* apzcroot = ApzcOf(root);
|
||||
|
||||
ScreenPoint origin(100, 50);
|
||||
@ -614,7 +611,7 @@ TEST_F(APZHitTestingTester, TestForceDisableApz) {
|
||||
TEST_F(APZHitTestingTester, Bug1148350) {
|
||||
CreateBug1148350LayerTree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
MockFunction<void(std::string checkPointName)> check;
|
||||
{
|
||||
@ -644,7 +641,7 @@ TEST_F(APZHitTestingTester, Bug1148350) {
|
||||
|
||||
layers[0]->SetVisibleRegion(LayerIntRegion(LayerIntRect(0, 50, 200, 150)));
|
||||
layers[0]->SetBaseTransform(Matrix4x4::Translation(0, 50, 0));
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
TouchUp(manager, ScreenIntPoint(100, 100), mcc->Time());
|
||||
mcc->RunThroughDelayedTasks();
|
||||
@ -684,7 +681,7 @@ TEST_F(APZHitTestingTester, HitTestingRespectsScrollClip_Bug1257288) {
|
||||
|
||||
// Build the hit testing tree.
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Pan on a region that's inside layers[2]'s layer clip, but outside
|
||||
// its subframe metadata's scroll clip.
|
||||
|
@ -14,7 +14,7 @@ TEST_F(APZCTreeManagerTester, WheelInterruptedByMouseDrag) {
|
||||
// Set up a scrollable layer
|
||||
CreateSimpleScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
uint64_t dragBlockId = 0;
|
||||
|
@ -27,7 +27,7 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
SetScrollHandoff(layers[1], root);
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
rootApzc->GetFrameMetrics().SetIsRootContent(
|
||||
true); // make root APZC zoomable
|
||||
@ -53,7 +53,7 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
// No ScopedLayerTreeRegistration as that just needs to be done once per
|
||||
// test and this is the second layer tree for a particular test.
|
||||
MOZ_ASSERT(registration);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
SetScrollHandoff(layers[4], layers[3]);
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
}
|
||||
|
||||
// Creates a layer tree with a parent layer that is only scrollable
|
||||
@ -107,7 +107,7 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
SetScrollHandoff(layers[1], root);
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
SetScrollHandoff(layers[1], root);
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0},
|
||||
root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
rootApzc->GetScrollMetadata().SetHasScrollgrab(true);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ TEST_F(APZCSnappingTester, Bug1265510) {
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration =
|
||||
MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
TestAsyncPanZoomController* outer = ApzcOf(layers[0]);
|
||||
TestAsyncPanZoomController* inner = ApzcOf(layers[1]);
|
||||
@ -122,7 +122,7 @@ TEST_F(APZCSnappingTester, Snap_After_Pinch) {
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration =
|
||||
MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
|
@ -41,7 +41,7 @@ TEST_F(APZCSnappingOnMomentumTester, Snap_On_Momentum) {
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration =
|
||||
MakeUnique<ScopedLayerTreeRegistration>(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
|
@ -15,7 +15,7 @@ TEST_F(APZCTreeManagerTester, ScrollablePaintedLayers) {
|
||||
// both layers have the same scrollId
|
||||
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID);
|
||||
SetScrollableFrameMetrics(layers[2], ScrollableLayerGuid::START_SCROLL_ID);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
TestAsyncPanZoomController* nullAPZC = nullptr;
|
||||
// so they should have the same APZC
|
||||
@ -27,14 +27,14 @@ TEST_F(APZCTreeManagerTester, ScrollablePaintedLayers) {
|
||||
// Change the scrollId of layers[1], and verify the APZC changes
|
||||
SetScrollableFrameMetrics(layers[1],
|
||||
ScrollableLayerGuid::START_SCROLL_ID + 1);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
EXPECT_NE(ApzcOf(layers[1]), ApzcOf(layers[2]));
|
||||
|
||||
// Change the scrollId of layers[2] to match that of layers[1], ensure we get
|
||||
// the same APZC for both again
|
||||
SetScrollableFrameMetrics(layers[2],
|
||||
ScrollableLayerGuid::START_SCROLL_ID + 1);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
EXPECT_EQ(ApzcOf(layers[1]), ApzcOf(layers[2]));
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ TEST_F(APZCTreeManagerTester, Bug1068268) {
|
||||
CreatePotentiallyLeakingTree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
RefPtr<HitTestingTreeNode> root = manager->GetRootNode();
|
||||
RefPtr<HitTestingTreeNode> node2 = root->GetFirstChild()->GetFirstChild();
|
||||
RefPtr<HitTestingTreeNode> node5 = root->GetLastChild()->GetLastChild();
|
||||
@ -63,7 +63,7 @@ TEST_F(APZCTreeManagerTester, Bug1068268) {
|
||||
TEST_F(APZCTreeManagerTester, Bug1194876) {
|
||||
CreateBug1194876Tree();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
uint64_t blockId;
|
||||
nsTArray<ScrollableLayerGuid> targets;
|
||||
@ -103,7 +103,7 @@ TEST_F(APZCTreeManagerTester, Bug1198900) {
|
||||
// crash.
|
||||
CreateSimpleDTCScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
ScreenPoint origin(100, 50);
|
||||
ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
|
||||
@ -124,7 +124,7 @@ TEST_F(APZCTreeManagerTester, Bug1551582) {
|
||||
// bounds of 200x200, leading to a scroll range of (0,0,300,300).
|
||||
CreateSimpleScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Simulate the main thread scrolling to the end of the scroll range.
|
||||
ModifyFrameMetrics(root, [](FrameMetrics& aMetrics) {
|
||||
@ -132,7 +132,7 @@ TEST_F(APZCTreeManagerTester, Bug1551582) {
|
||||
aMetrics.SetScrollGeneration(1);
|
||||
aMetrics.SetScrollOffsetUpdateType(FrameMetrics::eMainThread);
|
||||
});
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Sanity check.
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
@ -145,7 +145,7 @@ TEST_F(APZCTreeManagerTester, Bug1551582) {
|
||||
ModifyFrameMetrics(root, [](FrameMetrics& aMetrics) {
|
||||
aMetrics.SetScrollableRect(CSSRect(0, 0, 400, 400));
|
||||
});
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Check that APZ has clamped the scroll offset to (200,200) for us.
|
||||
compositedScrollOffset = apzc->GetCompositedScrollOffset();
|
||||
@ -156,7 +156,7 @@ TEST_F(APZCTreeManagerTester, Bug1557424) {
|
||||
// bounds of 200x200, leading to a scroll range of (0,0,300,300).
|
||||
CreateSimpleScrollingLayer();
|
||||
ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc);
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Simulate the main thread scrolling to the end of the scroll range.
|
||||
ModifyFrameMetrics(root, [](FrameMetrics& aMetrics) {
|
||||
@ -164,7 +164,7 @@ TEST_F(APZCTreeManagerTester, Bug1557424) {
|
||||
aMetrics.SetScrollGeneration(1);
|
||||
aMetrics.SetScrollOffsetUpdateType(FrameMetrics::eMainThread);
|
||||
});
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Sanity check.
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
@ -177,7 +177,7 @@ TEST_F(APZCTreeManagerTester, Bug1557424) {
|
||||
ModifyFrameMetrics(root, [](FrameMetrics& aMetrics) {
|
||||
aMetrics.SetCompositionBounds(ParentLayerRect(0, 0, 300, 300));
|
||||
});
|
||||
manager->UpdateHitTestingTree(root, false, LayersId{0}, 0);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
// Check that APZ has clamped the scroll offset to (200,200) for us.
|
||||
compositedScrollOffset = apzc->GetCompositedScrollOffset();
|
||||
|
Loading…
Reference in New Issue
Block a user