зеркало из https://github.com/mozilla/gecko-dev.git
Bug 927349 part 7 - Factor out AnimationTimeline::GetRefreshDriver into a separate method; r=jwatt
This is in preparation for adding AnimationTimeline::FastForward in the next patch which will reuse this code.
This commit is contained in:
Родитель
c93cabd2c1
Коммит
7f2f1073ca
|
@ -55,17 +55,12 @@ AnimationTimeline::GetCurrentTimeStamp() const
|
|||
result = timing->GetNavigationStartTimeStamp();
|
||||
}
|
||||
|
||||
nsIPresShell* presShell = mDocument->GetShell();
|
||||
if (MOZ_UNLIKELY(!presShell)) {
|
||||
nsRefreshDriver* refreshDriver = GetRefreshDriver();
|
||||
if (!refreshDriver) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (MOZ_UNLIKELY(!presContext)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = presContext->RefreshDriver()->MostRecentRefresh();
|
||||
result = refreshDriver->MostRecentRefresh();
|
||||
// FIXME: We would like to assert that:
|
||||
// mLastCurrentTime.IsNull() || result >= mLastCurrentTime
|
||||
// but due to bug 1043078 this will not be the case when the refresh driver
|
||||
|
@ -104,5 +99,21 @@ AnimationTimeline::ToTimeStamp(const TimeDuration& aTimeDuration) const
|
|||
return result;
|
||||
}
|
||||
|
||||
nsRefreshDriver*
|
||||
AnimationTimeline::GetRefreshDriver() const
|
||||
{
|
||||
nsIPresShell* presShell = mDocument->GetShell();
|
||||
if (MOZ_UNLIKELY(!presShell)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (MOZ_UNLIKELY(!presContext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return presContext->RefreshDriver();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsIDocument.h"
|
||||
|
||||
struct JSContext;
|
||||
class nsRefreshDriver;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -26,6 +27,10 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~AnimationTimeline() { }
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnimationTimeline)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AnimationTimeline)
|
||||
|
||||
|
@ -47,8 +52,7 @@ public:
|
|||
|
||||
protected:
|
||||
TimeStamp GetCurrentTimeStamp() const;
|
||||
|
||||
virtual ~AnimationTimeline() { }
|
||||
nsRefreshDriver* GetRefreshDriver() const;
|
||||
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче