AutoscrollAnimation.h (1300B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_layers_AutocrollAnimation_h_ 8 #define mozilla_layers_AutocrollAnimation_h_ 9 10 #include "AsyncPanZoomAnimation.h" 11 12 namespace mozilla { 13 namespace layers { 14 15 class AsyncPanZoomController; 16 17 class AutoscrollAnimation : public AsyncPanZoomAnimation { 18 public: 19 AutoscrollAnimation(AsyncPanZoomController& aApzc, 20 const ScreenPoint& aAnchorLocation); 21 22 bool DoSample(FrameMetrics& aFrameMetrics, 23 const TimeDuration& aDelta) override; 24 25 bool HandleScrollOffsetUpdate( 26 const Maybe<CSSPoint>& aRelativeDelta) override { 27 // Autoscroll works using screen space coordinates, so there's no work we 28 // need to do to handle either a relative or an absolute scroll update. 29 return true; 30 } 31 32 void Cancel(CancelAnimationFlags aFlags) override; 33 34 private: 35 AsyncPanZoomController& mApzc; 36 ScreenPoint mAnchorLocation; 37 }; 38 39 } // namespace layers 40 } // namespace mozilla 41 42 #endif // mozilla_layers_AutoscrollAnimation_h_