ScrollOrigin.h (3041B)
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_ScrollOrigin_h_ 6 #define mozilla_ScrollOrigin_h_ 7 8 #include "mozilla/DefineEnum.h" 9 10 namespace mozilla { 11 12 // A scroll origin is a bit of a combination of "what part of the code caused 13 // this scroll" and "what special properties does this scroll have, in the 14 // context of what caused it". See specific comments below. 15 MOZ_DEFINE_ENUM_CLASS_WITH_BASE_AND_TOSTRING( 16 ScrollOrigin, uint8_t, 17 ( 18 // This is used as an initial value for the "LastScrollOrigin" property 19 // on scrollable frames. It is not intended to be an actual scroll 20 // origin, but a sentinel value that indicates that there was no "last 21 // scroll". It is used similarly for the "LastSmoothScrollOrigin" 22 // property, to indicate no smooth scroll is in progress. 23 None, 24 25 // This is a default value that we use when we don't know of a more 26 // specific value that we can use. 27 NotSpecified, 28 // The scroll came from APZ code. 29 Apz, 30 // The scroll came from an attempt at restoring a scroll position saved 31 // in the bfcache or history. 32 Restore, 33 // The scroll came from a "relative" scroll method like ScrollBy, where 34 // the scroll destination is indicated by a delta from the current 35 // position instead of an absolute value. 36 Relative, 37 // The scroll came from an attempt by the main thread to re-clamp the 38 // scroll position after a reflow. 39 Clamp, 40 41 // The following scroll origins also are associated with prefs of the 42 // form 43 // general.smoothScroll.<origin>(.*) 44 // e.g. general.smoothScroll.lines indicates whether or not a scroll 45 // with origin Lines will be animated smoothly, and e.g. subprefs like 46 // general.smoothScroll.lines.durationMinMS control some of the 47 // animation timing behavior. 48 49 // The scroll came from some sort of input that's not one of the above 50 // or below values. Generally this means it came from a content-exposed 51 // API, like window.scrollTo, but may also be from other sources that 52 // don't need any particular special handling. 53 Other, 54 // The scroll was originated by pixel-scrolling input device (e.g. 55 // precision mouse wheel). 56 Pixels, 57 // The scroll was originated by a line-scrolling input device (e.g. 58 // up/down keyboard buttons). 59 Lines, 60 // The scroll was originated by a page-scrolling input device (e.g. 61 // pgup/ pgdn keyboard buttons). 62 Pages, 63 // The scroll was originated by a mousewheel that scrolls by lines. 64 MouseWheel, 65 // The scroll was originated by moving the scrollbars. 66 Scrollbars)); 67 68 } // namespace mozilla 69 70 #endif // mozilla_ScrollOrigin_h_