Bug 1352863 - Add a GetPerpendicularDirection() function to DirectionUtils.h. r=kats
MozReview-Commit-ID: KATLVKvXCwI
--- a/gfx/layers/DirectionUtils.h
+++ b/gfx/layers/DirectionUtils.h
@@ -45,12 +45,18 @@ template <typename FromUnits, typename T
float GetAxisScale(ScrollDirection aDir, const ScaleFactors2D<FromUnits, ToUnits>& aValue) {
if (aDir == ScrollDirection::HORIZONTAL) {
return aValue.xScale;
} else {
return aValue.yScale;
}
}
+inline ScrollDirection GetPerpendicularDirection(ScrollDirection aDir) {
+ return aDir == ScrollDirection::HORIZONTAL
+ ? ScrollDirection::VERTICAL
+ : ScrollDirection::HORIZONTAL;
+}
+
} // namespace layers
} // namespace mozilla
#endif /* GFX_DIRECTIONUTILS_H */