ISize/BSize fix in CSW reflow draft
authorNeerja Pancholi <npancholi@mozilla.com>
Tue, 24 Oct 2017 13:27:41 -0700
changeset 698706 0627435343f6182691a7f7a016bc57ae87e0b778
parent 698705 a08ec1b7ef152738b62c855d3770ba3da3a72f95
child 698707 e44704fb0b5d82ec5557add0d5de6f9fcaf25719
push id89334
push userbmo:npancholi@mozilla.com
push dateThu, 16 Nov 2017 00:39:30 +0000
milestone59.0a1
ISize/BSize fix in CSW reflow MozReview-Commit-ID: KOYfHBU2Kwl
layout/generic/nsColumnSetWrapperFrame.cpp
--- a/layout/generic/nsColumnSetWrapperFrame.cpp
+++ b/layout/generic/nsColumnSetWrapperFrame.cpp
@@ -92,32 +92,31 @@ nsColumnSetWrapperFrame::Reflow(nsPresCo
   MOZ_ASSERT(aStatus.IsEmpty(), "Expecting outparam to be initially empty");
 
   if (IsFrameTreeTooDeep(aReflowInput, aDesiredSize, aStatus)) {
     return;
   }
 
   WritingMode wm = aReflowInput.GetWritingMode();
   LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
-
-  nscoord availableISize = NS_UNCONSTRAINEDSIZE;
+  borderPadding.ApplySkipSides(GetLogicalSkipSides(&aReflowInput));
+  
+  nscoord computedISize = NS_UNCONSTRAINEDSIZE;
   nscoord availableBSize = NS_UNCONSTRAINEDSIZE;
-  if (aReflowInput.AvailableISize() != NS_UNCONSTRAINEDSIZE) {
-    availableISize = aReflowInput.AvailableISize() - borderPadding.IStartEnd(wm);
+  if (aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE) {
+    computedISize = aReflowInput.ComputedISize();
   }
   if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) {
-    availableBSize = aReflowInput.AvailableISize() - borderPadding.IStartEnd(wm);
+    availableBSize = aReflowInput.AvailableBSize() - borderPadding.BStartEnd(wm);
   }
-  LogicalSize availableSpace(wm, availableISize, availableBSize);
+  LogicalSize availableSpace(wm, computedISize, availableBSize);
   nsSize containerSize = aReflowInput.ComputedSizeAsContainerIfConstrained();
 
   aDesiredSize.ClearSize();
 
-  RenumberList();
-
   LogicalPoint childOrigin(wm,
                            borderPadding.IStart(wm),
                            borderPadding.BStart(wm));
 
   nscoord columnSpanBottomMargin = 0;
 
   for (nsIFrame* childFrame : mFrames) {
     nsReflowStatus childStatus;
@@ -138,35 +137,29 @@ nsColumnSetWrapperFrame::Reflow(nsPresCo
     }
 
     ReflowChild(childFrame, aPresContext, childDesiredSize, childReflowInput,
                 childWm, childOrigin, containerSize, 0, childStatus);
 
     FinishReflowChild(childFrame, aPresContext, childDesiredSize,
                       &childReflowInput, childWm, childOrigin, containerSize, 0);
 
-    aDesiredSize.ISize(wm) = std::max(aDesiredSize.ISize(wm),
-                                      childDesiredSize.ISize(childWm));
     aDesiredSize.BSize(wm) += childDesiredSize.BSize(childWm);
     aStatus.MergeCompletionStatusFrom(childStatus);
 
     childOrigin.B(childWm) += childDesiredSize.BSize(childWm);
   }
 
-//  if (aDesiredSize.ISize(wm) == 0) {
-//    aDesiredSize.ISize(wm) = availableISize;
-//  }
-
-  aDesiredSize.ISize(wm) += borderPadding.IStartEnd(wm);
+  aDesiredSize.ISize(wm) = computedISize + borderPadding.IStartEnd(wm);
   aDesiredSize.BSize(wm) += borderPadding.BStartEnd(wm);
 
-//  if (aReflowInput.ComputedBSize() != NS_AUTOHEIGHT) {
-//    aDesiredSize.BSize(wm) = aReflowInput.ComputedBSize() +
-//                               borderPadding.BStartEnd(wm);
-//  }
+  if (aReflowInput.ComputedBSize() != NS_AUTOHEIGHT) {
+    aDesiredSize.BSize(wm) = aReflowInput.ComputedBSize() +
+                               borderPadding.BStartEnd(wm);
+  }
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize)
 }
 
 void
 nsColumnSetWrapperFrame::AppendFrames(ChildListID     aListID,
                                       nsFrameList&    aFrameList)
 {