ScrollSnapTargetId.h (1083B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef mozilla_ScrollSnapTargetId_h_ 6 #define mozilla_ScrollSnapTargetId_h_ 7 8 #include <cstdint> 9 10 #include "Units.h" 11 #include "nsPoint.h" 12 #include "nsTArray.h" 13 14 namespace mozilla { 15 16 // The id for each scroll snap target element to track the last snapped element. 17 // 0 means it wasn't snapped on the last scroll operation. 18 enum class ScrollSnapTargetId : uintptr_t { 19 None = 0, 20 }; 21 inline constexpr bool IsEnumCase(ScrollSnapTargetId) { return true; } 22 23 struct ScrollSnapTargetIds { 24 CopyableTArray<ScrollSnapTargetId> mIdsOnX; 25 CopyableTArray<ScrollSnapTargetId> mIdsOnY; 26 bool operator==(const ScrollSnapTargetIds&) const = default; 27 }; 28 29 struct SnapDestination { 30 nsPoint mPosition; 31 ScrollSnapTargetIds mTargetIds; 32 }; 33 34 struct CSSSnapDestination { 35 CSSPoint mPosition; 36 ScrollSnapTargetIds mTargetIds; 37 }; 38 39 } // namespace mozilla 40 41 #endif // mozilla_ScrollSnapTargetId_h_