Bug 1002632: 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 cbbca93467
commit a13cd034a9
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

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

View File

@ -492,9 +492,10 @@ VectorImage::GetWidth(int32_t* aWidth)
NS_IMETHODIMP_(void)
VectorImage::RequestRefresh(const mozilla::TimeStamp& aTime)
{
// TODO: Implement for b666446.
EvaluateAnimation();
mSVGDocumentWrapper->TickRefreshDriver();
if (mHasPendingInvalidation) {
SendInvalidationNotifications();
mHasPendingInvalidation = false;

View File

@ -832,6 +832,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.