зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119497 - Don't continue searching if we hit a layer that has no containing APZC. r=botond
This commit is contained in:
Родитель
79146a788a
Коммит
2c4a8779e8
|
@ -1348,7 +1348,7 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't match anything in the subtree, check |node|.
|
// If we didn't match anything in the subtree, check |node|.
|
||||||
if (!result) {
|
if (*aOutHitResult == NoApzcHit) {
|
||||||
APZCTM_LOG("Testing ParentLayer point %s (Layer %s) against node %p\n",
|
APZCTM_LOG("Testing ParentLayer point %s (Layer %s) against node %p\n",
|
||||||
Stringify(aHitTestPoint).c_str(),
|
Stringify(aHitTestPoint).c_str(),
|
||||||
hitTestPointForChildLayers ? Stringify(hitTestPointForChildLayers.ref()).c_str() : "nil",
|
hitTestPointForChildLayers ? Stringify(hitTestPointForChildLayers.ref()).c_str() : "nil",
|
||||||
|
@ -1367,14 +1367,14 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
|
||||||
// If we are overscrolled, and the point matches us or one of our children,
|
// If we are overscrolled, and the point matches us or one of our children,
|
||||||
// the result is inside an overscrolled APZC, inform our caller of this
|
// the result is inside an overscrolled APZC, inform our caller of this
|
||||||
// (callers typically ignore events targeted at overscrolled APZCs).
|
// (callers typically ignore events targeted at overscrolled APZCs).
|
||||||
if (result && apzc && apzc->IsOverscrolled()) {
|
if (*aOutHitResult != NoApzcHit && apzc && apzc->IsOverscrolled()) {
|
||||||
APZCTM_LOG("Result is inside overscrolled APZC %p\n", apzc);
|
APZCTM_LOG("Result is inside overscrolled APZC %p\n", apzc);
|
||||||
*aOutHitResult = OverscrolledApzc;
|
*aOutHitResult = OverscrolledApzc;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (*aOutHitResult != NoApzcHit) {
|
||||||
if (!gfxPrefs::LayoutEventRegionsEnabled()) {
|
if (result && !gfxPrefs::LayoutEventRegionsEnabled()) {
|
||||||
// When event-regions are disabled, we treat scrollinfo layers as
|
// When event-regions are disabled, we treat scrollinfo layers as
|
||||||
// regular scrollable layers. Unfortunately, their "hit region" (which
|
// regular scrollable layers. Unfortunately, their "hit region" (which
|
||||||
// we create from the composition bounds) is their full area, and they
|
// we create from the composition bounds) is their full area, and they
|
||||||
|
|
|
@ -2552,6 +2552,25 @@ protected:
|
||||||
rootApzc = ApzcOf(root);
|
rootApzc = ApzcOf(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateBug1119497LayerTree() {
|
||||||
|
const char* layerTreeSyntax = "c(tt)";
|
||||||
|
// LayerID 0 12
|
||||||
|
// 0 is the root and doesn't have an APZC
|
||||||
|
// 1 is behind 2 and does have an APZC
|
||||||
|
// 2 entirely covers 1 and should take all the input events
|
||||||
|
nsIntRegion layerVisibleRegions[] = {
|
||||||
|
nsIntRegion(nsIntRect(0, 0, 100, 100)),
|
||||||
|
nsIntRegion(nsIntRect(0, 0, 100, 100)),
|
||||||
|
nsIntRegion(nsIntRect(0, 0, 100, 100)),
|
||||||
|
};
|
||||||
|
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegions, nullptr, lm, layers);
|
||||||
|
|
||||||
|
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1);
|
||||||
|
|
||||||
|
registration = MakeUnique<ScopedLayerTreeRegistration>(0, root, mcc);
|
||||||
|
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateBug1117712LayerTree() {
|
void CreateBug1117712LayerTree() {
|
||||||
const char* layerTreeSyntax = "c(c(t)t)";
|
const char* layerTreeSyntax = "c(c(t)t)";
|
||||||
// LayerID 0 1 2 3
|
// LayerID 0 1 2 3
|
||||||
|
@ -2679,6 +2698,19 @@ TEST_F(APZEventRegionsTester, Obscuration) {
|
||||||
EXPECT_EQ(HitTestResult::ApzcHitRegion, result);
|
EXPECT_EQ(HitTestResult::ApzcHitRegion, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(APZEventRegionsTester, Bug1119497) {
|
||||||
|
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
|
||||||
|
|
||||||
|
CreateBug1119497LayerTree();
|
||||||
|
|
||||||
|
HitTestResult result;
|
||||||
|
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(ScreenPoint(50, 50), &result);
|
||||||
|
// We should hit layers[2], so |result| will be ApzcHitRegion but there's no
|
||||||
|
// actual APZC in that parent chain, so |hit| should be nullptr.
|
||||||
|
EXPECT_EQ(nullptr, hit.get());
|
||||||
|
EXPECT_EQ(HitTestResult::ApzcHitRegion, result);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(APZEventRegionsTester, Bug1117712) {
|
TEST_F(APZEventRegionsTester, Bug1117712) {
|
||||||
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
|
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче