зеркало из https://github.com/mozilla/gecko-dev.git
Bug 998246 part 4 - Add currentTime member to AnimationTimeline; r=bz
This commit is contained in:
Родитель
248c1facd0
Коммит
3312bd13c9
|
@ -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 ();
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче