Bug 524180 - fire an event when async canvas draws finish. r=olli

This commit is contained in:
Joe Drew 2010-03-24 03:48:12 -07:00
parent d4c42c1218
commit 4a4ac6eb22

View File

@ -1125,6 +1125,18 @@ nsCanvasRenderingContext2D::Swap(mozilla::ipc::Shmem& aBack,
memcpy(mBackBuffer.get<unsigned char>(), mFrontBuffer.get<unsigned char>(),
mWidth * mHeight * 4);
// Notify listeners that we've finished drawing
nsCOMPtr<nsIContent> content = do_QueryInterface(mCanvasElement);
nsIDocument* ownerDoc = nsnull;
if (content)
ownerDoc = content->GetOwnerDoc();
if (ownerDoc && mCanvasElement) {
nsContentUtils::DispatchTrustedEvent(ownerDoc, mCanvasElement,
NS_LITERAL_STRING("MozAsyncCanvasRender"),
/* aCanBubble = */ PR_TRUE,
/* aCancelable = */ PR_TRUE);
}
return NS_OK;
}
#endif