Bug 1351783 part 13 - Add a function for determing if a ScrollSnapInfo has scroll snap points. r=botond
authorRyan Hunt <rhunt@eqrion.net>
Thu, 15 Jun 2017 03:52:34 -0400
changeset 600761 c4a493398777eac3d29ea203371e88e6c6b9d58e
parent 600760 70136b7cb54b75cd105f7d6e6a92d9dd0240162f
child 600762 a63081b75178ca54485cb63b38aee19938c56dbf
push id65868
push userbmo:rail@mozilla.com
push dateTue, 27 Jun 2017 20:33:55 +0000
reviewersbotond
bugs1351783
milestone56.0a1
Bug 1351783 part 13 - Add a function for determing if a ScrollSnapInfo has scroll snap points. r=botond MozReview-Commit-ID: 7Dj0RGfQFNC
gfx/layers/FrameMetrics.h
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -685,16 +685,22 @@ struct ScrollSnapInfo {
     return mScrollSnapTypeX == aOther.mScrollSnapTypeX &&
            mScrollSnapTypeY == aOther.mScrollSnapTypeY &&
            mScrollSnapIntervalX == aOther.mScrollSnapIntervalX &&
            mScrollSnapIntervalY == aOther.mScrollSnapIntervalY &&
            mScrollSnapDestination == aOther.mScrollSnapDestination &&
            mScrollSnapCoordinates == aOther.mScrollSnapCoordinates;
   }
 
+  bool HasScrollSnapping() const
+  {
+    return mScrollSnapTypeY != NS_STYLE_SCROLL_SNAP_TYPE_NONE ||
+           mScrollSnapTypeX != NS_STYLE_SCROLL_SNAP_TYPE_NONE;
+  }
+
   // The scroll frame's scroll-snap-type.
   // One of NS_STYLE_SCROLL_SNAP_{NONE, MANDATORY, PROXIMITY}.
   uint8_t mScrollSnapTypeX;
   uint8_t mScrollSnapTypeY;
 
   // The intervals derived from the scroll frame's scroll-snap-points.
   Maybe<nscoord> mScrollSnapIntervalX;
   Maybe<nscoord> mScrollSnapIntervalY;