b=574481; fix layers lifetime issues; part 6 - fix up some video frame bits; r=roc

This commit is contained in:
Vladimir Vukicevic 2010-08-06 22:09:18 -07:00
parent 635daa9eb0
commit 30c2b7b82c

View File

@ -187,6 +187,14 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
return nsnull;
nsRefPtr<ImageContainer> container = element->GetImageContainer();
// If we have a container with a different layer manager, try to hand
// off the container to the new one.
if (container && container->Manager() != aManager) {
// we don't care about the return type here -- if the set didn't take, it'll
// be handled when we next check the manager
container->SetLayerManager(aManager);
}
// If we have a container with the right layer manager already, we don't
// need to do anything here. Otherwise we need to set up a temporary
// ImageContainer, capture the video data and store it in the temp
@ -203,6 +211,10 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
// Get video from the existing container. It was created for a
// different layer manager, so we do fallback through cairo.
imageSurface = container->GetCurrentAsSurface(&cairoData.mSize);
if (!imageSurface) {
// we couldn't do fallback, so we've got nothing to do here
return nsnull;
}
cairoData.mSurface = imageSurface;
} else {
// We're probably printing.