Bug 1401807 Part 1 - Give unconstrained block size when reflowing mPosterImage. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 27 Sep 2017 23:04:42 +0800
changeset 383493 dce12df1e58de9328c53f9fb54bb51d662d52840
parent 383492 6304aff270522a06d4bd5f269c2f549c241e1a13
child 383494 6db5435a16a4648ae969d0a2693936d99fedce97
push id32594
push userkwierso@gmail.com
push dateThu, 28 Sep 2017 22:49:33 +0000
treeherdermozilla-central@6dea0ee45b66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1401807
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1401807 Part 1 - Give unconstrained block size when reflowing mPosterImage. r=dholbert Also, added MOZ_ASSERT to ensure all the video frame's children are fully complete after reflowing (except for the mVideoControls special case on Android). This fixed aStatus.IsEmpty() assertion for the test case added in Part 2. MozReview-Commit-ID: HKze4EZoaJY
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -316,16 +316,18 @@ nsVideoFrame::Reflow(nsPresContext* aPre
     nsSize oldChildSize = child->GetSize();
 
     if (child->GetContent() == mPosterImage) {
       // Reflow the poster frame.
       nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);
       ReflowOutput kidDesiredSize(aReflowInput);
       WritingMode wm = imageFrame->GetWritingMode();
       LogicalSize availableSize = aReflowInput.AvailableSize(wm);
+      availableSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
+
       LogicalSize cbSize = aMetrics.Size(aMetrics.GetWritingMode()).
                              ConvertTo(wm, aMetrics.GetWritingMode());
       ReflowInput kidReflowInput(aPresContext,
                                        aReflowInput,
                                        imageFrame,
                                        availableSize,
                                        &cbSize);
 
@@ -335,16 +337,20 @@ nsVideoFrame::Reflow(nsPresContext* aPre
           nsRect(nsPoint(borderPadding.left, borderPadding.top),
                  nsSize(aReflowInput.ComputedWidth(),
                         aReflowInput.ComputedHeight()));
       }
       kidReflowInput.SetComputedWidth(posterRenderRect.width);
       kidReflowInput.SetComputedHeight(posterRenderRect.height);
       ReflowChild(imageFrame, aPresContext, kidDesiredSize, kidReflowInput,
                   posterRenderRect.x, posterRenderRect.y, 0, aStatus);
+      MOZ_ASSERT(aStatus.IsFullyComplete(),
+                 "We gave our child unconstrained available block-size, "
+                 "so it should be complete!");
+
       FinishReflowChild(imageFrame, aPresContext,
                         kidDesiredSize, &kidReflowInput,
                         posterRenderRect.x, posterRenderRect.y, 0);
 
 // Android still uses XUL media controls & hence needs this XUL-friendly
 // custom reflow code. This will go away in bug 1310907.
 #ifdef ANDROID
     } else if (child->GetContent() == mVideoControls) {
@@ -367,16 +373,19 @@ nsVideoFrame::Reflow(nsPresContext* aPre
 
       ReflowInput kidReflowInput(aPresContext,
                                        aReflowInput,
                                        child,
                                        availableSize);
       ReflowOutput kidDesiredSize(kidReflowInput);
       ReflowChild(child, aPresContext, kidDesiredSize, kidReflowInput,
                   borderPadding.left, borderPadding.top, 0, aStatus);
+      MOZ_ASSERT(aStatus.IsFullyComplete(),
+                 "We gave our child unconstrained available block-size, "
+                 "so it should be complete!");
 
       if (child->GetContent() == mVideoControls && isBSizeShrinkWrapping) {
         // Resolve our own BSize based on the controls' size in the same axis.
         contentBoxBSize = myWM.IsOrthogonalTo(wm) ?
           kidDesiredSize.ISize(wm) : kidDesiredSize.BSize(wm);
       }
 
       FinishReflowChild(child, aPresContext,