Bug 1704080 - Add AsyncPanZoomController::GetScrollableDirections. r=botond
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Thu, 20 May 2021 09:45:19 +0000
changeset 580231 71069fb39ec104e97e73fa5ba0b9b026574f54eb
parent 580230 9a9ea6e86e2c5672613fdbbc9d5138b2b4357177
child 580232 24335aad5608d7612d476378fa0e014803248319
push id143447
push userhikezoe.birchill@mozilla.com
push dateThu, 20 May 2021 09:47:51 +0000
treeherderautoland@24335aad5608 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1704080
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1704080 - Add AsyncPanZoomController::GetScrollableDirections. r=botond Differential Revision: https://phabricator.services.mozilla.com/D115425
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3567,16 +3567,29 @@ ScrollDirections AsyncPanZoomController:
 
   if (mY.CanScroll() && mY.OverscrollBehaviorAllowsOverscrollEffect()) {
     result += ScrollDirection::eVertical;
   }
 
   return result;
 }
 
+ScrollDirections AsyncPanZoomController::GetScrollableDirections() const {
+  ScrollDirections result;
+  RecursiveMutexAutoLock lock(mRecursiveMutex);
+
+  if (mX.CanScroll()) {
+    result += ScrollDirection::eHorizontal;
+  }
+  if (mY.CanScroll()) {
+    result += ScrollDirection::eVertical;
+  }
+  return result;
+}
+
 void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) {
   if (!StaticPrefs::apz_overscroll_enabled()) {
     return;
   }
 
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   // Do not go into overscroll in a direction in which we have no room to
   // scroll to begin with.
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -516,16 +516,19 @@ class AsyncPanZoomController {
 
   // Return the directions in which this APZC allows handoff (as governed by
   // overscroll-behavior).
   ScrollDirections GetAllowedHandoffDirections() const;
 
   // Return the directions in which this APZC allows overscrolling.
   ScrollDirections GetOverscrollableDirections() const;
 
+  // Return the directions in which this APZC allows scrolling.
+  ScrollDirections GetScrollableDirections() const;
+
   // Return whether or not a scroll delta will be able to scroll in either
   // direction.
   bool CanScroll(const ParentLayerPoint& aDelta) const;
 
   // Return whether or not a scroll delta will be able to scroll in either
   // direction with wheel.
   bool CanScrollWithWheel(const ParentLayerPoint& aDelta) const;