mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1443231 - Ensure we are in the NOTHING state after a pinch gesture, if both fingers are lifted and no animation is triggered. r=kats
MozReview-Commit-ID: HexeLTlfbuq --HG-- extra : rebase_source : 6c9824a41e57e667b06571a0248dda887bc1adc8
This commit is contained in:
parent
57b922d77c
commit
816ef62275
@ -1565,6 +1565,14 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
|
||||
}
|
||||
} else {
|
||||
// Otherwise, handle the fingers being lifted.
|
||||
|
||||
// Some of the code paths below, like ScrollSnap() or HandleEndOfPan(),
|
||||
// may start an animation, but otherwise we want to end up in the NOTHING
|
||||
// state. To avoid state change notification churn, we use a
|
||||
// notification blocker.
|
||||
StateChangeNotificationBlocker blocker(this);
|
||||
SetState(NOTHING);
|
||||
|
||||
if (mZoomConstraints.mAllowZoom) {
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
|
||||
|
@ -265,6 +265,11 @@ public:
|
||||
EXPECT_EQ(FLING, mState);
|
||||
}
|
||||
|
||||
void AssertStateIsSmoothScroll() const {
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
EXPECT_EQ(SMOOTH_SCROLL, mState);
|
||||
}
|
||||
|
||||
void AssertNotAxisLocked() const {
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
EXPECT_EQ(PANNING, mState);
|
||||
|
@ -51,6 +51,8 @@ protected:
|
||||
aShouldTriggerPinch);
|
||||
}
|
||||
|
||||
apzc->AssertStateIsReset();
|
||||
|
||||
FrameMetrics fm = apzc->GetFrameMetrics();
|
||||
|
||||
if (aShouldTriggerPinch) {
|
||||
@ -81,6 +83,8 @@ protected:
|
||||
aShouldTriggerPinch);
|
||||
}
|
||||
|
||||
apzc->AssertStateIsReset();
|
||||
|
||||
fm = apzc->GetFrameMetrics();
|
||||
|
||||
if (aShouldTriggerPinch) {
|
||||
|
@ -65,3 +65,36 @@ TEST_F(APZCSnappingTester, Bug1265510)
|
||||
outer->AdvanceAnimationsUntilEnd();
|
||||
EXPECT_EQ(100.0f, outer->GetCurrentAsyncScrollOffset(AsyncPanZoomController::AsyncTransformConsumer::eForHitTesting).y);
|
||||
}
|
||||
|
||||
TEST_F(APZCSnappingTester, Snap_After_Pinch)
|
||||
{
|
||||
SCOPED_GFX_PREF(WebRenderHitTest, bool, false);
|
||||
|
||||
const char* layerTreeSyntax = "c";
|
||||
nsIntRegion layerVisibleRegion[] = {
|
||||
nsIntRegion(IntRect(0, 0, 100, 100)),
|
||||
};
|
||||
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
|
||||
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 100, 200));
|
||||
|
||||
// Set up some basic scroll snapping
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapTypeY = NS_STYLE_SCROLL_SNAP_TYPE_MANDATORY;
|
||||
snap.mScrollSnapIntervalY = Some(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
ScrollMetadata metadata = root->GetScrollMetadata(0);
|
||||
metadata.SetSnapInfo(ScrollSnapInfo(snap));
|
||||
root->SetScrollMetadata(metadata);
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration = MakeUnique<ScopedLayerTreeRegistration>(manager, 0, root, mcc);
|
||||
manager->UpdateHitTestingTree(0, root, false, 0, 0);
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
// Allow zooming
|
||||
apzc->UpdateZoomConstraints(ZoomConstraints(true, true, CSSToParentLayerScale(0.25f), CSSToParentLayerScale(4.0f)));
|
||||
|
||||
PinchWithPinchInput(apzc, ScreenIntPoint(50, 50), ScreenIntPoint(50, 50), 1.2);
|
||||
|
||||
apzc->AssertStateIsSmoothScroll();
|
||||
}
|
Loading…
Reference in New Issue
Block a user