Bug 1002632 part 1: Make an image document's refresh driver receive ticks from the image's clients, & disable its internal timer. r=bz

This commit is contained in:
Daniel Holbert 2014-05-01 09:31:54 -07:00
parent 662a3563fd
commit 1807829bf1
4 changed files with 23 additions and 1 deletions

View File

@ -218,6 +218,19 @@ SVGDocumentWrapper::SetCurrentTime(float aTime)
}
}
void
SVGDocumentWrapper::TickRefreshDriver()
{
nsCOMPtr<nsIPresShell> presShell;
mViewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
nsPresContext* presContext = presShell->GetPresContext();
if (presContext) {
presContext->RefreshDriver()->DoTick();
}
}
}
/** nsIStreamListener methods **/
/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt,

View File

@ -137,6 +137,7 @@ public:
void ResetAnimation();
float GetCurrentTime();
void SetCurrentTime(float aTime);
void TickRefreshDriver();
/**
* Force a layout flush of the underlying SVG document.

View File

@ -506,9 +506,10 @@ VectorImage::RequestRefresh(const TimeStamp& aTime)
return;
}
// TODO: Implement for b666446.
EvaluateAnimation();
mSVGDocumentWrapper->TickRefreshDriver();
if (mHasPendingInvalidation) {
SendInvalidationNotifications();
mHasPendingInvalidation = false;

View File

@ -862,6 +862,13 @@ nsRefreshDriver::EnsureTimerStarted(bool aAdjustingTimer)
return;
}
if (mPresContext->Document()->IsBeingUsedAsImage()) {
// Image documents receive ticks from clients' refresh drivers.
MOZ_ASSERT(!mActiveTimer,
"image document refresh driver should never have its own timer");
return;
}
// We got here because we're either adjusting the time *or* we're
// starting it for the first time. Add to the right timer,
// prehaps removing it from a previously-set one.