зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1117712 - Gtest. r=botond
This commit is contained in:
Родитель
1d53f9edf6
Коммит
98ceec6992
|
@ -2551,6 +2551,42 @@ protected:
|
|||
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
void CreateBug1117712LayerTree() {
|
||||
const char* layerTreeSyntax = "c(c(t)t)";
|
||||
// LayerID 0 1 2 3
|
||||
// 0 is the root
|
||||
// 1 is a container layer whose sole purpose to make a non-empty ancestor
|
||||
// transform for 2, so that 2's screen-to-apzc and apzc-to-gecko
|
||||
// transforms are different from 3's.
|
||||
// 2 is a small layer that is the actual target
|
||||
// 3 is a big layer obscuring 2 with a dispatch-to-content region
|
||||
nsIntRegion layerVisibleRegions[] = {
|
||||
nsIntRegion(nsIntRect(0, 0, 100, 100)),
|
||||
nsIntRegion(nsIntRect(0, 0, 0, 0)),
|
||||
nsIntRegion(nsIntRect(0, 0, 10, 10)),
|
||||
nsIntRegion(nsIntRect(0, 0, 100, 100)),
|
||||
};
|
||||
Matrix4x4 layerTransforms[] = {
|
||||
Matrix4x4(),
|
||||
Matrix4x4::Translation(50, 0, 0),
|
||||
Matrix4x4(),
|
||||
Matrix4x4(),
|
||||
};
|
||||
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegions, layerTransforms, lm, layers);
|
||||
|
||||
SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 10, 10));
|
||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 100, 100));
|
||||
|
||||
EventRegions regions(nsIntRegion(nsIntRect(0, 0, 10, 10)));
|
||||
layers[2]->SetEventRegions(regions);
|
||||
regions.mHitRegion = nsIntRegion(nsIntRect(0, 0, 100, 100));
|
||||
regions.mDispatchToContentHitRegion = nsIntRegion(nsIntRect(0, 0, 100, 100));
|
||||
layers[3]->SetEventRegions(regions);
|
||||
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(0, root, mcc);
|
||||
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(APZEventRegionsTester, HitRegionImmediateResponse) {
|
||||
|
@ -2643,6 +2679,28 @@ TEST_F(APZEventRegionsTester, Obscuration) {
|
|||
EXPECT_EQ(HitTestResult::ApzcHitRegion, result);
|
||||
}
|
||||
|
||||
TEST_F(APZEventRegionsTester, Bug1117712) {
|
||||
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
|
||||
|
||||
CreateBug1117712LayerTree();
|
||||
|
||||
TestAsyncPanZoomController* apzc2 = ApzcOf(layers[2]);
|
||||
|
||||
// These touch events should hit the dispatch-to-content region of layers[3]
|
||||
// and so get queued with that APZC as the tentative target.
|
||||
int time = 0;
|
||||
uint64_t inputBlockId = 0;
|
||||
Tap(manager, 55, 5, time, 100, nullptr, &inputBlockId);
|
||||
// But now we tell the APZ that really it hit layers[2], and expect the tap
|
||||
// to be delivered at the correct coordinates.
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(55, 5), 0, apzc2->GetGuid())).Times(1);
|
||||
|
||||
nsTArray<ScrollableLayerGuid> targets;
|
||||
targets.AppendElement(apzc2->GetGuid());
|
||||
manager->SetTargetAPZC(inputBlockId, targets);
|
||||
while (mcc->RunThroughDelayedTasks()); // this runs the tap event
|
||||
}
|
||||
|
||||
class TaskRunMetrics {
|
||||
public:
|
||||
TaskRunMetrics()
|
||||
|
|
Загрузка…
Ссылка в новой задаче