ScrollingInteractionContext.h (1278B)
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_ScrollingInteractionContext_h 8 #define mozilla_layers_ScrollingInteractionContext_h 9 10 #include "mozilla/EventForwards.h" 11 #include "mozilla/layers/ScrollableLayerGuid.h" 12 13 namespace mozilla { 14 namespace layers { 15 16 // The ScrollingInteractionContext is used to store minor details of the 17 // current scrolling interaction on the stack to avoid having to pass them 18 // though the callstack 19 class MOZ_STACK_CLASS ScrollingInteractionContext { 20 private: 21 static bool sScrollingToAnchor; 22 23 public: 24 // Functions to access downwards-propagated data 25 static bool IsScrollingToAnchor(); 26 27 // Constructor sets the data to be propagated downwards 28 explicit ScrollingInteractionContext(bool aScrollingToAnchor); 29 30 // Destructor restores the previous state 31 ~ScrollingInteractionContext(); 32 33 private: 34 bool mOldScrollingToAnchor; 35 }; 36 37 } // namespace layers 38 } // namespace mozilla 39 40 #endif /* mozilla_layers_ScrollingInteractionContext_h */