Bug 1362115 - don't emit a blob-image for contentless videos. r?kats draft
authorAlexis Beingessner <a.beingessner@gmail.com>
Thu, 01 Feb 2018 13:59:10 -0500
changeset 751190 6b852377e0df2aecd93326f27891dd70d9873a0f
parent 751155 48def8fbcc6f08263d5970c61f74095b1129322b
child 751191 8f746f3cb53b33a01f04899df32b5560ed1bbb21
push id97890
push userbmo:a.beingessner@gmail.com
push dateMon, 05 Feb 2018 17:43:50 +0000
reviewerskats
bugs1362115
milestone60.0a1
Bug 1362115 - don't emit a blob-image for contentless videos. r?kats MozReview-Commit-ID: G7TONKvMiXn
layout/generic/nsVideoFrame.cpp
--- 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);