Bug 1362115 - don't emit a blob-image for contentless videos. r?kats
MozReview-Commit-ID: G7TONKvMiXn
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -446,22 +446,22 @@ public:
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override
{
nsRect area = Frame()->GetContentRectRelativeToSelf() + ToReferenceFrame();
HTMLVideoElement* element = static_cast<HTMLVideoElement*>(Frame()->GetContent());
nsIntSize videoSizeInPx;
if (NS_FAILED(element->GetVideoSize(&videoSizeInPx)) || area.IsEmpty()) {
- return false;
+ return true;
}
RefPtr<ImageContainer> container = element->GetImageContainer();
if (!container) {
- return false;
+ return true;
}
// Retrieve the size of the decoded video frame, before being scaled
// by pixel aspect ratio.
mozilla::gfx::IntSize frameSize = container->GetCurrentSize();
if (frameSize.width == 0 || frameSize.height == 0) {
// No image, or zero-sized image. Don't render.
return true;
@@ -479,17 +479,17 @@ public:
nsRect dest = nsLayoutUtils::ComputeObjectDestRect(area,
intrinsicSize,
aspectRatio,
Frame()->StylePosition());
gfxRect destGFXRect = Frame()->PresContext()->AppUnitsToGfxUnits(dest);
destGFXRect.Round();
if (destGFXRect.IsEmpty()) {
- return false;
+ return true;
}
VideoInfo::Rotation rotationDeg = element->RotationDegrees();
IntSize scaleHint(static_cast<int32_t>(destGFXRect.Width()),
static_cast<int32_t>(destGFXRect.Height()));
// scaleHint is set regardless of rotation, so swap w/h if needed.
SwapScaleWidthHeightForRotation(scaleHint, rotationDeg);
container->SetScaleHint(scaleHint);