Bug 1119497 - Don't continue searching if we hit a layer that has no containing APZC. r=botond

This commit is contained in:
Kartikaya Gupta 2015-01-10 10:55:47 -05:00
Родитель 15fa271733
Коммит a64136480e
2 изменённых файлов: 36 добавлений и 4 удалений

Просмотреть файл

@ -1373,7 +1373,7 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
}
// 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",
Stringify(aHitTestPoint).c_str(),
hitTestPointForChildLayers ? Stringify(hitTestPointForChildLayers.ref()).c_str() : "nil",
@ -1392,14 +1392,14 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
// 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
// (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);
*aOutHitResult = OverscrolledApzc;
return nullptr;
}
if (result) {
if (!gfxPrefs::LayoutEventRegionsEnabled()) {
if (*aOutHitResult != NoApzcHit) {
if (result && !gfxPrefs::LayoutEventRegionsEnabled()) {
// When event-regions are disabled, we treat scrollinfo layers as
// regular scrollable layers. Unfortunately, their "hit region" (which
// we create from the composition bounds) is their full area, and they

Просмотреть файл

@ -2551,6 +2551,25 @@ protected:
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
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);
}
};
TEST_F(APZEventRegionsTester, HitRegionImmediateResponse) {
@ -2643,6 +2662,19 @@ TEST_F(APZEventRegionsTester, Obscuration) {
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);
}
class TaskRunMetrics {
public:
TaskRunMetrics()