mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 998246 part 4 - Add currentTime member to AnimationTimeline; r=bz
This commit is contained in:
parent
d34164be16
commit
8343e66e73
@ -6,6 +6,10 @@
|
||||
#include "AnimationTimeline.h"
|
||||
#include "mozilla/dom/AnimationTimelineBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -21,5 +25,28 @@ AnimationTimeline::WrapObject(JSContext* aCx)
|
||||
return AnimationTimelineBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
Nullable<double>
|
||||
AnimationTimeline::GetCurrentTime() const
|
||||
{
|
||||
Nullable<double> result; // Default ctor initializes to null
|
||||
|
||||
nsIPresShell* presShell = mDocument->GetShell();
|
||||
if (!presShell)
|
||||
return result;
|
||||
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (!presContext)
|
||||
return result;
|
||||
|
||||
nsRefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
|
||||
if (!timing)
|
||||
return result;
|
||||
|
||||
TimeStamp now = presContext->RefreshDriver()->MostRecentRefresh();
|
||||
result.SetValue(timing->TimeStampToDOMHighRes(now));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
nsISupports* GetParentObject() const { return mDocument; }
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
Nullable<double> GetCurrentTime() const;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
[Pref="dom.animations-api.core.enabled"]
|
||||
interface AnimationTimeline {
|
||||
// readonly attribute double? currentTime;
|
||||
readonly attribute double? currentTime;
|
||||
// AnimationPlayer play (optional TimedItem? source = null);
|
||||
// sequence<AnimationPlayer> getAnimationPlayers ();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user