Bug 1526749 - Drop SnappingEdgeCallback. r=botond
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 11 Feb 2019 23:45:17 +0000
changeset 516479 13d65407d068092274183015f18e27f003205fb2
parent 516478 dea533265a6c88aba8ad3e6f83d315b3a62076df
child 516480 7687579aa4ae0aa4739a08b012eebbd9e0d0a8a4
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1526749
milestone67.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 1526749 - Drop SnappingEdgeCallback. r=botond Depends on D19292 Differential Revision: https://phabricator.services.mozilla.com/D19293
layout/generic/ScrollSnap.cpp
--- a/layout/generic/ScrollSnap.cpp
+++ b/layout/generic/ScrollSnap.cpp
@@ -12,45 +12,29 @@
 #include "mozilla/Preferences.h"
 #include "nsLineLayout.h"
 
 namespace mozilla {
 
 using layers::ScrollSnapInfo;
 
 /**
- * Stores candidate snapping edges.
- */
-class SnappingEdgeCallback {
- public:
-  virtual void AddHorizontalEdge(nscoord aEdge) = 0;
-  virtual void AddVerticalEdge(nscoord aEdge) = 0;
-  virtual void AddHorizontalEdgeInterval(const nsRect& aScrollRange,
-                                         nscoord aInterval,
-                                         nscoord aOffset) = 0;
-  virtual void AddVerticalEdgeInterval(const nsRect& aScrollRange,
-                                       nscoord aInterval, nscoord aOffset) = 0;
-};
-
-/**
  * Keeps track of the current best edge to snap to. The criteria for
  * adding an edge depends on the scrolling unit.
  */
-class CalcSnapPoints : public SnappingEdgeCallback {
+class CalcSnapPoints final {
  public:
   CalcSnapPoints(nsIScrollableFrame::ScrollUnit aUnit,
                  const nsPoint& aDestination, const nsPoint& aStartPos);
-  virtual void AddHorizontalEdge(nscoord aEdge) override;
-  virtual void AddVerticalEdge(nscoord aEdge) override;
-  virtual void AddHorizontalEdgeInterval(const nsRect& aScrollRange,
-                                         nscoord aInterval,
-                                         nscoord aOffset) override;
-  virtual void AddVerticalEdgeInterval(const nsRect& aScrollRange,
-                                       nscoord aInterval,
-                                       nscoord aOffset) override;
+  void AddHorizontalEdge(nscoord aEdge);
+  void AddVerticalEdge(nscoord aEdge);
+  void AddHorizontalEdgeInterval(const nsRect& aScrollRange, nscoord aInterval,
+                                 nscoord aOffset);
+  void AddVerticalEdgeInterval(const nsRect& aScrollRange, nscoord aInterval,
+                               nscoord aOffset);
   void AddEdge(nscoord aEdge, nscoord aDestination, nscoord aStartPos,
                nscoord aScrollingDirection, nscoord* aBestEdge,
                bool* aEdgeFound);
   void AddEdgeInterval(nscoord aInterval, nscoord aMinPos, nscoord aMaxPos,
                        nscoord aOffset, nscoord aDestination, nscoord aStartPos,
                        nscoord aScrollingDirection, nscoord* aBestEdge,
                        bool* aEdgeFound);
   nsPoint GetBestEdge() const;
@@ -231,25 +215,25 @@ void CalcSnapPoints::AddEdgeInterval(nsc
   edge += aInterval;
   if (edge >= aMinPos && edge <= aMaxPos) {
     AddEdge(edge, aDestination, aStartPos, aScrollingDirection, aBestEdge,
             aEdgeFound);
   }
 }
 
 static void ProcessScrollSnapCoordinates(
-    SnappingEdgeCallback& aCallback,
+    CalcSnapPoints& aCalcSnapPoint,
     const nsTArray<nsPoint>& aScrollSnapCoordinates,
     const nsPoint& aScrollSnapDestination) {
   for (nsPoint snapCoords : aScrollSnapCoordinates) {
     // Make them relative to the scroll snap destination.
     snapCoords -= aScrollSnapDestination;
 
-    aCallback.AddVerticalEdge(snapCoords.x);
-    aCallback.AddHorizontalEdge(snapCoords.y);
+    aCalcSnapPoint.AddVerticalEdge(snapCoords.x);
+    aCalcSnapPoint.AddHorizontalEdge(snapCoords.y);
   }
 }
 
 Maybe<nsPoint> ScrollSnapUtils::GetSnapPointForDestination(
     const ScrollSnapInfo& aSnapInfo, nsIScrollableFrame::ScrollUnit aUnit,
     const nsRect& aScrollRange, const nsPoint& aStartPos,
     const nsPoint& aDestination) {
   if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapType::None &&