From a9ead4dd43b33627c8fdddd56a186e122d28fbae Mon Sep 17 00:00:00 2001 From: Mantaroh Yoshinaga Date: Mon, 27 Jun 2016 08:09:31 +0900 Subject: [PATCH] Bug 1267510 part 2 - Add origin time invariant to DocumentTimeline. r=birtles MozReview-Commit-ID: Kf7PzzAH9Tj --HG-- extra : rebase_source : 1cb1ff9f06c778d55f8a4a6beedccba946a31fbc --- dom/animation/DocumentTimeline.cpp | 6 ++++-- dom/animation/DocumentTimeline.h | 5 ++++- dom/base/nsDocument.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dom/animation/DocumentTimeline.cpp b/dom/animation/DocumentTimeline.cpp index c689704815cf..ba99aa0b025b 100644 --- a/dom/animation/DocumentTimeline.cpp +++ b/dom/animation/DocumentTimeline.cpp @@ -88,7 +88,9 @@ DocumentTimeline::ToTimelineTime(const TimeStamp& aTimeStamp) const return result; } - result.SetValue(aTimeStamp - timing->GetNavigationStartTimeStamp()); + result.SetValue(aTimeStamp + - timing->GetNavigationStartTimeStamp() + - mOriginTime); return result; } @@ -204,7 +206,7 @@ DocumentTimeline::ToTimeStamp(const TimeDuration& aTimeDuration) const return result; } - result = timing->GetNavigationStartTimeStamp() + aTimeDuration; + result = timing->GetNavigationStartTimeStamp() + aTimeDuration + mOriginTime; return result; } diff --git a/dom/animation/DocumentTimeline.h b/dom/animation/DocumentTimeline.h index df4ce3f9eec4..a388897aa038 100644 --- a/dom/animation/DocumentTimeline.h +++ b/dom/animation/DocumentTimeline.h @@ -28,10 +28,11 @@ class DocumentTimeline final , public nsARefreshObserver { public: - explicit DocumentTimeline(nsIDocument* aDocument) + DocumentTimeline(nsIDocument* aDocument, const TimeDuration& aOriginTime) : AnimationTimeline(aDocument->GetParentObject()) , mDocument(aDocument) , mIsObservingRefreshDriver(false) + , mOriginTime(aOriginTime) { } @@ -84,6 +85,8 @@ protected: // iframe). mutable TimeStamp mLastRefreshDriverTime; bool mIsObservingRefreshDriver; + + TimeDuration mOriginTime; }; } // namespace dom diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 2582fd504fae..5e82fcc673a0 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -3241,7 +3241,7 @@ DocumentTimeline* nsDocument::Timeline() { if (!mDocumentTimeline) { - mDocumentTimeline = new DocumentTimeline(this); + mDocumentTimeline = new DocumentTimeline(this, TimeDuration(0)); } return mDocumentTimeline;