зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1749352) for causing GTest failures. CLOSED TREE
Backed out changeset 977e030270db (bug 1749352) Backed out changeset 8f8afd043413 (bug 1749352) Backed out changeset 550c693e5dea (bug 1749352) Backed out changeset c50f4c8331d3 (bug 1749352) Backed out changeset ba1013d34a9e (bug 1749352)
This commit is contained in:
Родитель
439765c954
Коммит
482513fd24
|
@ -2754,7 +2754,10 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
|||
}
|
||||
|
||||
RequestContentRepaint();
|
||||
ScrollSnapToDestination();
|
||||
|
||||
if (!aEvent.mFollowedByMomentum) {
|
||||
ScrollSnap();
|
||||
}
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -2763,11 +2766,17 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumStart(
|
|||
const PanGestureInput& aEvent) {
|
||||
APZC_LOG("%p got a pan-momentumstart in state %d\n", this, mState);
|
||||
|
||||
if (mState == SMOOTHMSD_SCROLL || mState == OVERSCROLL_ANIMATION) {
|
||||
if (mState == SMOOTHMSD_SCROLL) {
|
||||
// SMOOTHMSD_SCROLL scrolls are cancelled by pan gestures.
|
||||
CancelAnimation();
|
||||
}
|
||||
|
||||
if (mState == OVERSCROLL_ANIMATION) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
SetState(PAN_MOMENTUM);
|
||||
ScrollSnapToDestination();
|
||||
|
||||
// Call into OnPan in order to process any delta included in this event.
|
||||
OnPan(aEvent, FingersOnTouchpad::No);
|
||||
|
@ -6001,8 +6010,8 @@ void AsyncPanZoomController::ScrollSnapToDestination() {
|
|||
}
|
||||
|
||||
CSSPoint startPosition = Metrics().GetVisualScrollOffset();
|
||||
if (MaybeAdjustDeltaForScrollSnapping(ScrollUnit::DEVICE_PIXELS,
|
||||
predictedDelta, startPosition)) {
|
||||
if (MaybeAdjustDeltaForScrollSnapping(ScrollUnit::LINES, predictedDelta,
|
||||
startPosition)) {
|
||||
APZC_LOG(
|
||||
"%p fling snapping. friction: %f velocity: %f, %f "
|
||||
"predictedDelta: %f, %f position: %f, %f "
|
||||
|
|
|
@ -129,6 +129,10 @@ APZEventResult PanGesture(PanGestureInput::PanGestureType aType,
|
|||
Modifiers aModifiers = MODIFIER_NONE) {
|
||||
PanGestureInput input(aType, MillisecondsSinceStartup(aTime), aTime, aPoint,
|
||||
aDelta, aModifiers);
|
||||
if (aType == PanGestureInput::PANGESTURE_END) {
|
||||
input.mFollowedByMomentum = true;
|
||||
}
|
||||
|
||||
return aTarget->ReceiveInputEvent(input);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,57 +126,3 @@ TEST_F(APZCSnappingTesterMock, Snap_After_Pinch) {
|
|||
|
||||
apzc->AssertStateIsSmoothMsdScroll();
|
||||
}
|
||||
|
||||
TEST_F(APZCSnappingTesterMock, SnapOnPanEnd) {
|
||||
const char* treeShape = "x";
|
||||
nsIntRegion layerVisibleRegion[] = {
|
||||
nsIntRegion(IntRect(0, 0, 100, 100)),
|
||||
};
|
||||
CreateScrollData(treeShape, layerVisibleRegion);
|
||||
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
|
||||
CSSRect(0, 0, 100, 400));
|
||||
|
||||
// Set up two snap points, 30 and 100.
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
|
||||
snap.mSnapPositionY.AppendElement(30 * AppUnitsPerCSSPixel());
|
||||
snap.mSnapPositionY.AppendElement(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
// Save the scroll snap info on the root APZC.
|
||||
ModifyFrameMetrics(root, [&](ScrollMetadata& aSm, FrameMetrics& aMetrics) {
|
||||
aSm.SetSnapInfo(ScrollSnapInfo(snap));
|
||||
});
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration =
|
||||
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
// Send a series of pan gestures to scroll to position at 50.
|
||||
const ScreenIntPoint position = ScreenIntPoint(50, 30);
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_START, manager, position,
|
||||
ScreenPoint(0, 10), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_PAN, manager, position,
|
||||
ScreenPoint(0, 40), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_END, manager, position,
|
||||
ScreenPoint(0, 0), mcc->Time());
|
||||
|
||||
// Now a smooth animation has been triggered for snapping to 30.
|
||||
apzc->AssertStateIsSmoothMsdScroll();
|
||||
|
||||
apzc->AdvanceAnimationsUntilEnd();
|
||||
// The snapped position should be 30 rather than 100 because it's the nearest
|
||||
// snap point.
|
||||
EXPECT_EQ(
|
||||
apzc->GetCurrentAsyncScrollOffset(AsyncPanZoomController::eForHitTesting)
|
||||
.y,
|
||||
30);
|
||||
}
|
||||
|
|
|
@ -66,10 +66,8 @@ TEST_F(APZCSnappingOnMomentumTesterMock, Snap_On_Momentum) {
|
|||
PanGesture(PanGestureInput::PANGESTURE_END, manager, ScreenIntPoint(50, 80),
|
||||
ScreenPoint(0, 0), mcc->Time());
|
||||
|
||||
// After lifting the fingers, the velocity should be zero and a smooth
|
||||
// animation should have been triggered for scroll snap.
|
||||
EXPECT_EQ(apzc->GetVelocityVector().y, 0);
|
||||
apzc->AssertStateIsSmoothMsdScroll();
|
||||
// After lifting the fingers, the velocity should still be positive.
|
||||
EXPECT_GT(apzc->GetVelocityVector().y, 3.0);
|
||||
|
||||
mcc->AdvanceByMillis(5);
|
||||
|
||||
|
@ -95,83 +93,3 @@ TEST_F(APZCSnappingOnMomentumTesterMock, Snap_On_Momentum) {
|
|||
AsyncPanZoomController::AsyncTransformConsumer::eForHitTesting)
|
||||
.y);
|
||||
}
|
||||
|
||||
// Smililar to APZCSnappingTesterMock::SnapOnPanEnd but with momentum events.
|
||||
TEST_F(APZCSnappingOnMomentumTesterMock, SnapOnPanMomentumEnd) {
|
||||
const char* treeShape = "x";
|
||||
nsIntRegion layerVisibleRegion[] = {
|
||||
nsIntRegion(IntRect(0, 0, 100, 100)),
|
||||
};
|
||||
CreateScrollData(treeShape, layerVisibleRegion);
|
||||
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
|
||||
CSSRect(0, 0, 100, 400));
|
||||
|
||||
// Set up two snap points, 30 and 100.
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
|
||||
snap.mSnapPositionY.AppendElement(30 * AppUnitsPerCSSPixel());
|
||||
snap.mSnapPositionY.AppendElement(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
// Save the scroll snap info on the root APZC.
|
||||
// Also mark the root APZC as "root content", since APZC only allows
|
||||
// zooming on the root content APZC.
|
||||
ModifyFrameMetrics(root, [&](ScrollMetadata& aSm, FrameMetrics& aMetrics) {
|
||||
aSm.SetSnapInfo(ScrollSnapInfo(snap));
|
||||
aMetrics.SetIsRootContent(true);
|
||||
});
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration =
|
||||
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
|
||||
UpdateHitTestingTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
|
||||
|
||||
// Send a series of pan gestures that a pan-end event happens at 65 and some
|
||||
// pan momentum events happen subsequently.
|
||||
const ScreenIntPoint position = ScreenIntPoint(50, 30);
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_START, manager, position,
|
||||
ScreenPoint(0, 10), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_PAN, manager, position,
|
||||
ScreenPoint(0, 35), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_PAN, manager, position,
|
||||
ScreenPoint(0, 20), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_END, manager, position,
|
||||
ScreenPoint(0, 0), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
|
||||
// A smooth animation has been triggered by the pan-end event above.
|
||||
apzc->AssertStateIsSmoothMsdScroll();
|
||||
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_MOMENTUMSTART, manager, position,
|
||||
ScreenPoint(0, 10), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_MOMENTUMPAN, manager, position,
|
||||
ScreenPoint(0, 10), mcc->Time());
|
||||
mcc->AdvanceByMillis(5);
|
||||
|
||||
apzc->AdvanceAnimations(mcc->GetSampleTime());
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
|
||||
PanGesture(PanGestureInput::PANGESTURE_MOMENTUMEND, manager, position,
|
||||
ScreenPoint(0, 0), mcc->Time());
|
||||
|
||||
apzc->AdvanceAnimationsUntilEnd();
|
||||
EXPECT_EQ(
|
||||
apzc->GetCurrentAsyncScrollOffset(AsyncPanZoomController::eForHitTesting)
|
||||
.y,
|
||||
100);
|
||||
}
|
||||
|
|
|
@ -433,6 +433,7 @@ PanGestureInput::PanGestureInput()
|
|||
mUserDeltaMultiplierX(1.0),
|
||||
mUserDeltaMultiplierY(1.0),
|
||||
mHandledByAPZ(false),
|
||||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||
mOverscrollBehaviorAllowsSwipe(false),
|
||||
mSimulateMomentum(false),
|
||||
|
@ -452,6 +453,7 @@ PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
|||
mUserDeltaMultiplierX(1.0),
|
||||
mUserDeltaMultiplierY(1.0),
|
||||
mHandledByAPZ(false),
|
||||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||
mOverscrollBehaviorAllowsSwipe(false),
|
||||
mSimulateMomentum(false),
|
||||
|
|
|
@ -437,6 +437,10 @@ class PanGestureInput : public InputData {
|
|||
|
||||
bool mHandledByAPZ : 1;
|
||||
|
||||
// true if this is a PANGESTURE_END event that will be followed by a
|
||||
// PANGESTURE_MOMENTUMSTART event.
|
||||
bool mFollowedByMomentum : 1;
|
||||
|
||||
// If this is true, and this event started a new input block that couldn't
|
||||
// find a scrollable target which is scrollable in the horizontal component
|
||||
// of the scroll start direction, then this input block needs to be put on
|
||||
|
@ -464,6 +468,9 @@ class PanGestureInput : public InputData {
|
|||
bool mIsNoLineOrPageDelta : 1;
|
||||
|
||||
void SetHandledByAPZ(bool aHandled) { mHandledByAPZ = aHandled; }
|
||||
void SetFollowedByMomentum(bool aFollowed) {
|
||||
mFollowedByMomentum = aFollowed;
|
||||
}
|
||||
void SetRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(
|
||||
bool aRequires) {
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection =
|
||||
|
|
|
@ -3247,6 +3247,19 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
panEvent.SetLineOrPageDeltas(lineOrPageDelta.x, lineOrPageDelta.y);
|
||||
}
|
||||
|
||||
if (panEvent.mType == PanGestureInput::PANGESTURE_END) {
|
||||
// Check if there's a momentum start event in the event queue, so that we
|
||||
// can annotate this event.
|
||||
NSEvent* nextWheelEvent = [NSApp nextEventMatchingMask:NSEventMaskScrollWheel
|
||||
untilDate:[NSDate distantPast]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:NO];
|
||||
if (nextWheelEvent &&
|
||||
PanGestureTypeForEvent(nextWheelEvent) == PanGestureInput::PANGESTURE_MOMENTUMSTART) {
|
||||
panEvent.mFollowedByMomentum = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool canTriggerSwipe = [self shouldConsiderStartingSwipeFromEvent:theEvent] &&
|
||||
SwipeTracker::CanTriggerSwipe(panEvent);
|
||||
;
|
||||
|
|
|
@ -1219,6 +1219,7 @@ struct ParamTraits<mozilla::PanGestureInput>
|
|||
WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
|
||||
WriteParam(aMsg, aParam.mDeltaType);
|
||||
WriteParam(aMsg, aParam.mHandledByAPZ);
|
||||
WriteParam(aMsg, aParam.mFollowedByMomentum);
|
||||
WriteParam(
|
||||
aMsg,
|
||||
aParam
|
||||
|
@ -1243,6 +1244,8 @@ struct ParamTraits<mozilla::PanGestureInput>
|
|||
ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||
¶mType::SetHandledByAPZ) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||
¶mType::SetFollowedByMomentum) &&
|
||||
ReadBoolForBitfield(
|
||||
aMsg, aIter, aResult,
|
||||
¶mType::
|
||||
|
|
Загрузка…
Ссылка в новой задаче