Bug 1401807 Part 3 - Use a local reflow status when reflowing nsVideoFrame's children. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 27 Sep 2017 23:27:25 +0800
changeset 383495 6fad485bf9640d263dc0dc9c432c16818ab7879b
parent 383494 6db5435a16a4648ae969d0a2693936d99fedce97
child 383496 8dad665a3b1ae9c7e269fe8e401e7967b03f74ab
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 3 - Use a local reflow status when reflowing nsVideoFrame's children. r=dholbert This ensures the video frame's reflow status is not affect by its children's reflow result. MozReview-Commit-ID: 4WwLFyIyV4q
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -309,16 +309,17 @@ nsVideoFrame::Reflow(nsPresContext* aPre
 
   nsMargin borderPadding = aReflowInput.ComputedPhysicalBorderPadding();
 
   // Reflow the child frames. We may have up to three: an image
   // frame (for the poster image), a container frame for the controls,
   // and a container frame for the caption.
   for (nsIFrame* child : mFrames) {
     nsSize oldChildSize = child->GetSize();
+    nsReflowStatus childStatus;
 
     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;
@@ -336,18 +337,18 @@ nsVideoFrame::Reflow(nsPresContext* aPre
         posterRenderRect =
           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(),
+                  posterRenderRect.x, posterRenderRect.y, 0, childStatus);
+      MOZ_ASSERT(childStatus.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
@@ -372,18 +373,18 @@ nsVideoFrame::Reflow(nsPresContext* aPre
       availableSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
 
       ReflowInput kidReflowInput(aPresContext,
                                        aReflowInput,
                                        child,
                                        availableSize);
       ReflowOutput kidDesiredSize(kidReflowInput);
       ReflowChild(child, aPresContext, kidDesiredSize, kidReflowInput,
-                  borderPadding.left, borderPadding.top, 0, aStatus);
-      MOZ_ASSERT(aStatus.IsFullyComplete(),
+                  borderPadding.left, borderPadding.top, 0, childStatus);
+      MOZ_ASSERT(childStatus.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);
       }
@@ -417,16 +418,18 @@ nsVideoFrame::Reflow(nsPresContext* aPre
 
   aMetrics.SetOverflowAreasToDesiredBounds();
 
   FinishAndStoreOverflow(&aMetrics);
 
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                  ("exit nsVideoFrame::Reflow: size=%d,%d",
                   aMetrics.Width(), aMetrics.Height()));
+
+  MOZ_ASSERT(aStatus.IsEmpty(), "This type of frame can't be split.");
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
 }
 
 class nsDisplayVideo : public nsDisplayItem {
 public:
   nsDisplayVideo(nsDisplayListBuilder* aBuilder, nsVideoFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame)
   {