From 1460000399897d529f925928737669cd3712474f Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Fri, 16 Jan 2015 16:42:46 +0000 Subject: [PATCH] Bug 1042103 - Don't ignore events during overscroll. r=botond --- gfx/layers/apz/src/APZCTreeManager.cpp | 26 ------------------- gfx/layers/apz/src/APZUtils.h | 1 - gfx/layers/apz/src/AsyncPanZoomController.cpp | 11 ++++---- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 43f0ca869494..edf67fb6b44c 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -649,9 +649,6 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent, break; } } - if (hitResult == HitOverscrolledApzc) { - result = nsEventStatus_eConsumeNoDefault; - } return result; } @@ -772,9 +769,6 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput, outTransform, touchData.mScreenPoint); } } - if (mHitResultForInputBlock == HitOverscrolledApzc) { - result = nsEventStatus_eConsumeNoDefault; - } if (aInput.mType == MultiTouchInput::MULTITOUCH_END) { if (mTouchCount >= aInput.mTouches.Length()) { @@ -834,9 +828,6 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent, Matrix4x4 outTransform = transformToApzc * transformToGecko; aEvent.refPoint = TransformTo(outTransform, aEvent.refPoint); } - if (hitResult == HitOverscrolledApzc) { - result = nsEventStatus_eConsumeNoDefault; - } return result; } @@ -1195,8 +1186,6 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint, HitTestResult* aOutHit PixelCastJustification::ScreenIsParentLayerForRoot); nsRefPtr target = GetAPZCAtPoint(mRootNode, point, &hitResult); - // If we are in an overscrolled APZC, we should be returning nullptr. - MOZ_ASSERT(!(target && (hitResult == HitOverscrolledApzc))); if (aOutHitResult) { *aOutHitResult = hitResult; } @@ -1322,8 +1311,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode, // This walks the tree in depth-first, reverse order, so that it encounters // APZCs front-to-back on the screen. for (HitTestingTreeNode* node = aNode; node; node = node->GetPrevSibling()) { - AsyncPanZoomController* apzc = node->GetApzc(); - if (node->IsOutsideClip(aHitTestPoint)) { // If the point being tested is outside the clip region for this node // then we don't need to test against this node or any of its children. @@ -1342,10 +1329,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode, ParentLayerPoint childPoint = ViewAs(hitTestPointForChildLayers.ref(), PixelCastJustification::MovingDownToChildren); result = GetAPZCAtPoint(node->GetLastChild(), childPoint, aOutHitResult); - if (*aOutHitResult == HitOverscrolledApzc) { - // We matched an overscrolled APZC, abort. - return nullptr; - } } // If we didn't match anything in the subtree, check |node|. @@ -1365,15 +1348,6 @@ 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 (*aOutHitResult != HitNothing && apzc && apzc->IsOverscrolled()) { - APZCTM_LOG("Result is inside overscrolled APZC %p\n", apzc); - *aOutHitResult = HitOverscrolledApzc; - return nullptr; - } - if (*aOutHitResult != HitNothing) { if (result && !gfxPrefs::LayoutEventRegionsEnabled()) { // When event-regions are disabled, we treat scrollinfo layers as diff --git a/gfx/layers/apz/src/APZUtils.h b/gfx/layers/apz/src/APZUtils.h index b60347d549c6..8742589cab17 100644 --- a/gfx/layers/apz/src/APZUtils.h +++ b/gfx/layers/apz/src/APZUtils.h @@ -14,7 +14,6 @@ enum HitTestResult { HitNothing, HitLayer, HitDispatchToContentRegion, - HitOverscrolledApzc, }; } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index fb28129b4cfa..588d66d64362 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1146,6 +1146,7 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent case FLING: case ANIMATING_ZOOM: case SMOOTH_SCROLL: + case OVERSCROLL_ANIMATION: CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(); // Fall through. case NOTHING: { @@ -1226,8 +1227,8 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent) case OVERSCROLL_ANIMATION: // Should not receive a touch-move in the OVERSCROLL_ANIMATION state - // as touch blocks that begin in an overscrolled state - // are ignored. + // as touch blocks that begin in an overscrolled state cancel the + // animation. NS_WARNING("Received impossible touch in OnTouchMove"); break; } @@ -1310,9 +1311,9 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent) return nsEventStatus_eIgnore; case OVERSCROLL_ANIMATION: - // Should not receive a touch-move in the OVERSCROLL_ANIMATION state - // as touch blocks that begin in an overscrolled state - // are ignored. + // Should not receive a touch-end in the OVERSCROLL_ANIMATION state + // as touch blocks that begin in an overscrolled state cancel the + // animation. NS_WARNING("Received impossible touch in OnTouchEnd"); break; }