tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AnimationTimelinesController.h (1730B)


      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 file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_AnimationTimelinesController_h
      8 #define mozilla_dom_AnimationTimelinesController_h
      9 
     10 #include "mozilla/LinkedList.h"
     11 
     12 namespace mozilla::dom {
     13 class DocumentTimeline;
     14 class ScrollTimeline;
     15 
     16 /**
     17 * The controller which keeps track of all timelines in a document. So basically
     18 * each document should have its own AnimationTimelinesController.
     19 */
     20 class AnimationTimelinesController final {
     21 public:
     22  AnimationTimelinesController() = default;
     23  ~AnimationTimelinesController() {
     24    // We expect the timelines should remove themself from the controller
     25    // already.
     26    MOZ_ASSERT(mDocumentTimelines.isEmpty());
     27    MOZ_ASSERT(mScrollTimelines.isEmpty());
     28  }
     29 
     30  void AddDocumentTimeline(DocumentTimeline& aTimeline);
     31  void AddScrollTimeline(ScrollTimeline& aTimeline);
     32 
     33  void WillRefresh();
     34  void UpdateLastRefreshDriverTime();
     35  void TriggerAllPendingAnimationsNow();
     36  void UpdateHiddenByContentVisibility();
     37  void TrySampleScrollTimelines();
     38 
     39 private:
     40  LinkedList<DocumentTimeline> mDocumentTimelines;
     41  // Note: we use a separate linked list for scroll timelines (and
     42  // view-timelines) because some utility functions don't need to traverse this
     43  // list for now. If all functions have to check both lists, we should merge
     44  // them.
     45  LinkedList<ScrollTimeline> mScrollTimelines;
     46 };
     47 
     48 }  // namespace mozilla::dom
     49 
     50 #endif  // mozilla_dom_AnimationTimelinesController_h