Bug 1267510 part 2 - Add origin time invariant to DocumentTimeline. r=birtles

MozReview-Commit-ID: Kf7PzzAH9Tj

--HG--
extra : rebase_source : 1cb1ff9f06c778d55f8a4a6beedccba946a31fbc
This commit is contained in:
Mantaroh Yoshinaga 2016-06-27 08:09:31 +09:00
Родитель 63ef5e7f82
Коммит a9ead4dd43
3 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -88,7 +88,9 @@ DocumentTimeline::ToTimelineTime(const TimeStamp& aTimeStamp) const
return result; return result;
} }
result.SetValue(aTimeStamp - timing->GetNavigationStartTimeStamp()); result.SetValue(aTimeStamp
- timing->GetNavigationStartTimeStamp()
- mOriginTime);
return result; return result;
} }
@ -204,7 +206,7 @@ DocumentTimeline::ToTimeStamp(const TimeDuration& aTimeDuration) const
return result; return result;
} }
result = timing->GetNavigationStartTimeStamp() + aTimeDuration; result = timing->GetNavigationStartTimeStamp() + aTimeDuration + mOriginTime;
return result; return result;
} }

Просмотреть файл

@ -28,10 +28,11 @@ class DocumentTimeline final
, public nsARefreshObserver , public nsARefreshObserver
{ {
public: public:
explicit DocumentTimeline(nsIDocument* aDocument) DocumentTimeline(nsIDocument* aDocument, const TimeDuration& aOriginTime)
: AnimationTimeline(aDocument->GetParentObject()) : AnimationTimeline(aDocument->GetParentObject())
, mDocument(aDocument) , mDocument(aDocument)
, mIsObservingRefreshDriver(false) , mIsObservingRefreshDriver(false)
, mOriginTime(aOriginTime)
{ {
} }
@ -84,6 +85,8 @@ protected:
// iframe). // iframe).
mutable TimeStamp mLastRefreshDriverTime; mutable TimeStamp mLastRefreshDriverTime;
bool mIsObservingRefreshDriver; bool mIsObservingRefreshDriver;
TimeDuration mOriginTime;
}; };
} // namespace dom } // namespace dom

Просмотреть файл

@ -3241,7 +3241,7 @@ DocumentTimeline*
nsDocument::Timeline() nsDocument::Timeline()
{ {
if (!mDocumentTimeline) { if (!mDocumentTimeline) {
mDocumentTimeline = new DocumentTimeline(this); mDocumentTimeline = new DocumentTimeline(this, TimeDuration(0));
} }
return mDocumentTimeline; return mDocumentTimeline;