mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
c0f8394d7d
We want to time animations from when their first frame is painted. However, interruptible reflow complicates this since, for a given set of pending animations, some may be painted whilst others are not. To simplify this we simply force an uninterruptible reflow when we have animations that are waiting to start.
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_PendingPlayerTracker_h
|
|
#define mozilla_dom_PendingPlayerTracker_h
|
|
|
|
#include "mozilla/dom/AnimationPlayer.h"
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "nsIDocument.h"
|
|
#include "nsTHashtable.h"
|
|
|
|
class nsIFrame;
|
|
|
|
namespace mozilla {
|
|
|
|
class PendingPlayerTracker MOZ_FINAL
|
|
{
|
|
public:
|
|
explicit PendingPlayerTracker(nsIDocument* aDocument)
|
|
: mDocument(aDocument)
|
|
{ }
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingPlayerTracker)
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(PendingPlayerTracker)
|
|
|
|
void AddPlayPending(dom::AnimationPlayer& aPlayer);
|
|
void RemovePlayPending(dom::AnimationPlayer& aPlayer);
|
|
bool IsWaitingToPlay(dom::AnimationPlayer const& aPlayer) const;
|
|
|
|
// Causes any pending players to resume at |aReadyTime| by first
|
|
// fast-forwarding their timeline to the corresponding time.
|
|
void StartPendingPlayers(const TimeStamp& aReadyTime);
|
|
bool HasPendingPlayers() const { return mPlayPendingSet.Count() > 0; }
|
|
|
|
private:
|
|
~PendingPlayerTracker() { }
|
|
|
|
void EnsurePaintIsScheduled();
|
|
|
|
typedef nsTHashtable<nsRefPtrHashKey<dom::AnimationPlayer>>
|
|
AnimationPlayerSet;
|
|
|
|
AnimationPlayerSet mPlayPendingSet;
|
|
nsCOMPtr<nsIDocument> mDocument;
|
|
};
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_dom_PendingPlayerTracker_h
|