зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1457586 - Simplify Axis::UpdateWithTouchAtDevicePoint() by removing the aAdditionalDelta parameter. r=mstange
MozReview-Commit-ID: CBBPhfRkl97 Depends on D7653 Differential Revision: https://phabricator.services.mozilla.com/D7654 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
da60c1b550
Коммит
f288db2097
|
@ -1501,8 +1501,8 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||
// UpdateWithTouchAtDevicePoint() acquires the tree lock, so
|
||||
// it cannot be called while the mRecursiveMutex lock is held.
|
||||
if (!allowZoom) {
|
||||
mX.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.x, 0, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, 0, aEvent.mTime);
|
||||
mX.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.x, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime);
|
||||
}
|
||||
|
||||
if (!gfxPrefs::APZAllowZooming()) {
|
||||
|
@ -2453,8 +2453,14 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent, bool
|
|||
// size and position. We need to do so even if this is a momentum pan (i.e.
|
||||
// aFingersOnTouchpad == false); in that case the "with touch" part is not
|
||||
// really appropriate, so we may want to rethink this at some point.
|
||||
mX.UpdateWithTouchAtDevicePoint(aEvent.mLocalPanStartPoint.x, logicalPanDisplacement.x, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalPanStartPoint.y, logicalPanDisplacement.y, aEvent.mTime);
|
||||
// Note that we have to make all simulated positions relative to
|
||||
// Axis::GetPos(), because the current position is an invented position, and
|
||||
// because resetting the position to the mouse position (e.g.
|
||||
// aEvent.mLocalStartPoint) would mess up velocity calculation. (This is
|
||||
// the only caller of UpdateWithTouchAtDevicePoint() for pan events, so
|
||||
// there is no risk of other calls resetting the position.)
|
||||
mX.UpdateWithTouchAtDevicePoint(mX.GetPos() + logicalPanDisplacement.x, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(mY.GetPos() + logicalPanDisplacement.y, aEvent.mTime);
|
||||
|
||||
HandlePanningUpdate(physicalPanDisplacement);
|
||||
|
||||
|
@ -2891,8 +2897,8 @@ AsyncPanZoomController::StartPanning(const ParentLayerPoint& aStartPoint) {
|
|||
|
||||
void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(const MultiTouchInput& aEvent) {
|
||||
ParentLayerPoint point = GetFirstTouchPoint(aEvent);
|
||||
mX.UpdateWithTouchAtDevicePoint(point.x, 0, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(point.y, 0, aEvent.mTime);
|
||||
mX.UpdateWithTouchAtDevicePoint(point.x, aEvent.mTime);
|
||||
mY.UpdateWithTouchAtDevicePoint(point.y, aEvent.mTime);
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::AttemptScroll(ParentLayerPoint& aStartPoint,
|
||||
|
|
|
@ -71,7 +71,7 @@ float Axis::ToLocalVelocity(float aVelocityInchesPerMs) const {
|
|||
return localVelocity.Length();
|
||||
}
|
||||
|
||||
void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, ParentLayerCoord aAdditionalDelta, uint32_t aTimestampMs) {
|
||||
void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, uint32_t aTimestampMs) {
|
||||
// mVelocityQueue is controller-thread only
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
|
@ -88,7 +88,7 @@ void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, ParentLayerCoord
|
|||
return;
|
||||
}
|
||||
|
||||
float newVelocity = mAxisLocked ? 0.0f : (float)(mVelocitySamplePos - aPos + aAdditionalDelta) / (float)(aTimestampMs - mVelocitySampleTimeMs);
|
||||
float newVelocity = mAxisLocked ? 0.0f : (float)(mVelocitySamplePos - aPos) / (float)(aTimestampMs - mVelocitySampleTimeMs);
|
||||
|
||||
newVelocity = ApplyFlingCurveToVelocity(newVelocity);
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ public:
|
|||
/**
|
||||
* Notify this Axis that a new touch has been received, including a timestamp
|
||||
* for when the touch was received. This triggers a recalculation of velocity.
|
||||
* This can also used for pan gesture events. For those events, the "touch"
|
||||
* location is stationary and the scroll displacement is passed in as
|
||||
* aAdditionalDelta.
|
||||
* This can also used for pan gesture events. For those events, |aPos| is
|
||||
* an invented position corresponding to the mouse position plus any
|
||||
* accumulated displacements over the course of the pan gesture.
|
||||
*/
|
||||
void UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, ParentLayerCoord aAdditionalDelta, uint32_t aTimestampMs);
|
||||
void UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, uint32_t aTimestampMs);
|
||||
|
||||
protected:
|
||||
float ApplyFlingCurveToVelocity(float aVelocity) const;
|
||||
|
@ -251,6 +251,13 @@ public:
|
|||
virtual const char* Name() const = 0;
|
||||
|
||||
protected:
|
||||
// A position along the axis, used during input event processing to
|
||||
// track velocities (and for touch gestures, to track the length of
|
||||
// the gesture). For touch events, this represents the position of
|
||||
// the finger (or in the case of two-finger scrolling, the midpoint
|
||||
// of the two fingers). For pan gesture events, this represents an
|
||||
// invented position corresponding to the mouse position at the start
|
||||
// of the pan, plus deltas representing the displacement of the pan.
|
||||
ParentLayerCoord mPos;
|
||||
|
||||
// mVelocitySampleTimeMs and mVelocitySamplePos are the time and position
|
||||
|
|
Загрузка…
Ссылка в новой задаче