mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 12:20:56 +00:00
Bug 1856691: Change AsyncPanZoomController::StartAnimation to take already_AddRefed instead of raw pointer. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D189969
This commit is contained in:
parent
5ca62d63cc
commit
8081d7f085
@ -1272,7 +1272,7 @@ void AsyncPanZoomController::StartAutoscroll(const ScreenPoint& aPoint) {
|
||||
CancelAnimation();
|
||||
|
||||
SetState(AUTOSCROLL);
|
||||
StartAnimation(new AutoscrollAnimation(*this, aPoint));
|
||||
StartAnimation(do_AddRef(new AutoscrollAnimation(*this, aPoint)));
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::StopAutoscroll() {
|
||||
@ -2113,8 +2113,8 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) {
|
||||
|
||||
nsPoint initialPosition =
|
||||
CSSPoint::ToAppUnits(Metrics().GetVisualScrollOffset());
|
||||
StartAnimation(
|
||||
new SmoothScrollAnimation(*this, initialPosition, scrollOrigin));
|
||||
StartAnimation(do_AddRef(
|
||||
new SmoothScrollAnimation(*this, initialPosition, scrollOrigin)));
|
||||
}
|
||||
|
||||
// Convert velocity from ParentLayerPoints/ms to ParentLayerPoints/s and then
|
||||
@ -2583,8 +2583,8 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(
|
||||
|
||||
nsPoint initialPosition =
|
||||
CSSPoint::ToAppUnits(Metrics().GetVisualScrollOffset());
|
||||
StartAnimation(new WheelScrollAnimation(*this, initialPosition,
|
||||
aEvent.mDeltaType));
|
||||
StartAnimation(do_AddRef(new WheelScrollAnimation(
|
||||
*this, initialPosition, aEvent.mDeltaType)));
|
||||
}
|
||||
// Convert velocity from ParentLayerPoints/ms to ParentLayerPoints/s and
|
||||
// then to appunits/second.
|
||||
@ -3832,10 +3832,10 @@ ParentLayerPoint AsyncPanZoomController::AttemptFling(
|
||||
ScrollSnapToDestination();
|
||||
if (mState != SMOOTHMSD_SCROLL) {
|
||||
SetState(FLING);
|
||||
AsyncPanZoomAnimation* fling =
|
||||
RefPtr<AsyncPanZoomAnimation> fling =
|
||||
GetPlatformSpecificState()->CreateFlingAnimation(*this, aHandoffState,
|
||||
PLPPI);
|
||||
StartAnimation(fling);
|
||||
StartAnimation(fling.forget());
|
||||
}
|
||||
|
||||
return residualVelocity;
|
||||
@ -3973,7 +3973,7 @@ void AsyncPanZoomController::SmoothScrollTo(
|
||||
animation->UpdateDestinationAndSnapTargets(
|
||||
GetFrameTime().Time(), destination, velocity,
|
||||
std::move(aDestination.mTargetIds), aTriggeredByScript);
|
||||
StartAnimation(animation.get());
|
||||
StartAnimation(animation.forget());
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::SmoothMsdScrollTo(
|
||||
@ -3997,12 +3997,12 @@ void AsyncPanZoomController::SmoothMsdScrollTo(
|
||||
Metrics().GetZoom();
|
||||
}
|
||||
|
||||
StartAnimation(new SmoothMsdScrollAnimation(
|
||||
StartAnimation(do_AddRef(new SmoothMsdScrollAnimation(
|
||||
*this, Metrics().GetVisualScrollOffset(), initialVelocity,
|
||||
aDestination.mPosition,
|
||||
StaticPrefs::layout_css_scroll_behavior_spring_constant(),
|
||||
StaticPrefs::layout_css_scroll_behavior_damping_ratio(),
|
||||
std::move(aDestination.mTargetIds), aTriggeredByScript));
|
||||
std::move(aDestination.mTargetIds), aTriggeredByScript)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4015,7 +4015,8 @@ void AsyncPanZoomController::StartOverscrollAnimation(
|
||||
ParentLayerPoint velocity = aVelocity;
|
||||
AdjustDeltaForAllowedScrollDirections(velocity,
|
||||
GetOverscrollableDirections());
|
||||
StartAnimation(new OverscrollAnimation(*this, velocity, aOverscrollSideBits));
|
||||
StartAnimation(
|
||||
do_AddRef(new OverscrollAnimation(*this, velocity, aOverscrollSideBits)));
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::CallDispatchScroll(
|
||||
@ -4134,7 +4135,8 @@ void AsyncPanZoomController::RestoreOverscrollAmount(
|
||||
mY.RestoreOverscroll(aOverscroll.y);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::StartAnimation(AsyncPanZoomAnimation* aAnimation) {
|
||||
void AsyncPanZoomController::StartAnimation(
|
||||
already_AddRefed<AsyncPanZoomAnimation> aAnimation) {
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
mAnimation = aAnimation;
|
||||
mLastSampleTime = GetFrameTime();
|
||||
@ -6099,9 +6101,9 @@ void AsyncPanZoomController::ZoomToRect(const ZoomTarget& aZoomTarget,
|
||||
endZoomToMetrics.SetVisualScrollOffset(rect.TopLeft());
|
||||
endZoomToMetrics.RecalculateLayoutViewportOffset();
|
||||
|
||||
StartAnimation(new ZoomAnimation(
|
||||
StartAnimation(do_AddRef(new ZoomAnimation(
|
||||
*this, Metrics().GetVisualScrollOffset(), Metrics().GetZoom(),
|
||||
endZoomToMetrics.GetVisualScrollOffset(), endZoomToMetrics.GetZoom()));
|
||||
endZoomToMetrics.GetVisualScrollOffset(), endZoomToMetrics.GetZoom())));
|
||||
|
||||
RequestContentRepaint(RepaintUpdateType::eUserAction);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ class AsyncPanZoomController {
|
||||
*/
|
||||
bool HasTreeManager(const APZCTreeManager* aTreeManager) const;
|
||||
|
||||
void StartAnimation(AsyncPanZoomAnimation* aAnimation);
|
||||
void StartAnimation(already_AddRefed<AsyncPanZoomAnimation> aAnimation);
|
||||
|
||||
/**
|
||||
* Cancels any currently running animation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user