KeyboardScrollAction.h (1396B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_layers_KeyboardScrollAction_h 8 #define mozilla_layers_KeyboardScrollAction_h 9 10 #include <cstdint> // for uint8_t 11 12 #include "mozilla/ScrollTypes.h" 13 #include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM 14 15 namespace mozilla { 16 namespace layers { 17 18 /** 19 * This class represents a scrolling action to be performed on a scrollable 20 * layer. 21 */ 22 struct KeyboardScrollAction final { 23 public: 24 // clang-format off 25 MOZ_DEFINE_ENUM_WITH_BASE_AT_CLASS_SCOPE( 26 KeyboardScrollActionType, uint8_t, ( 27 eScrollCharacter, 28 eScrollLine, 29 eScrollPage, 30 eScrollComplete 31 )); 32 // clang-format on 33 34 static ScrollUnit GetScrollUnit(KeyboardScrollActionType aDeltaType); 35 36 KeyboardScrollAction(); 37 KeyboardScrollAction(KeyboardScrollActionType aType, bool aForward); 38 39 // The type of scroll to perform for this action 40 KeyboardScrollActionType mType; 41 // Whether to scroll forward or backward along the axis of this action type 42 bool mForward; 43 }; 44 45 } // namespace layers 46 } // namespace mozilla 47 48 #endif // mozilla_layers_KeyboardScrollAction_h