Bug 1401807 Part 1 - Give unconstrained block size when reflowing mPosterImage.
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
--- 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,