Bug 921174 part 2: Use a separate nsReflowStatus for button frame's reflow vs. button contents frame's reflow. r=bz
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 26 Sep 2013 23:43:16 -0700
changeset 162776 7164978f006de148c4283e3de5bd143ed1ab3633
parent 162775 f8b7e4858ddd28643b69da9bcdbae429f6363f2d
child 162777 57288f5ade9d49188a242b26bfdd3d364b5ad9b0
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs921174
milestone27.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 921174 part 2: Use a separate nsReflowStatus for button frame's reflow vs. button contents frame's reflow. r=bz
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.h
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -184,43 +184,43 @@ nsHTMLButtonControlFrame::Reflow(nsPresC
   // !aReflowState.ShouldReflowAllKids() &&
   // !NS_SUBTREE_DIRTY(firstKid).
   // We'd need to cache our ascent for that, of course.
   
   nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();
   
   // Reflow the contents of the button.
   ReflowButtonContents(aPresContext, aDesiredSize, aReflowState, firstKid,
-                       focusPadding, aStatus);
+                       focusPadding);
 
   aDesiredSize.width = aReflowState.ComputedWidth();
 
   aDesiredSize.width += aReflowState.mComputedBorderPadding.LeftRight();
   aDesiredSize.height += aReflowState.mComputedBorderPadding.TopBottom();
 
   aDesiredSize.ascent +=
     aReflowState.mComputedBorderPadding.top + focusPadding.top;
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   ConsiderChildOverflow(aDesiredSize.mOverflowAreas, firstKid);
-  FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
 
   aStatus = NS_FRAME_COMPLETE;
+  FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize,
+                                 aReflowState, aStatus);
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
   return NS_OK;
 }
 
 void
 nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
                                                nsHTMLReflowMetrics& aDesiredSize,
                                                const nsHTMLReflowState& aButtonReflowState,
                                                nsIFrame* aFirstKid,
-                                               nsMargin aFocusPadding,
-                                               nsReflowStatus& aStatus)
+                                               nsMargin aFocusPadding)
 {
   nsSize availSize(aButtonReflowState.ComputedWidth(), NS_INTRINSICSIZE);
 
   // Indent the child inside us by the focus border. We must do this separate
   // from the regular border.
   availSize.width -= aFocusPadding.LeftRight();
   
   // See whether out availSize's width is big enough.  If it's smaller than our
@@ -242,20 +242,24 @@ nsHTMLButtonControlFrame::ReflowButtonCo
     xoffset -= extraleft;
     availSize.width += extraleft + extraright;
   }
   availSize.width = std::max(availSize.width,0);
   
   nsHTMLReflowState contentsReflowState(aPresContext, aButtonReflowState,
                                         aFirstKid, availSize);
 
+  nsReflowStatus contentsReflowStatus;
   ReflowChild(aFirstKid, aPresContext, aDesiredSize, contentsReflowState,
               xoffset,
               aFocusPadding.top + aButtonReflowState.mComputedBorderPadding.top,
-              0, aStatus);
+              0, contentsReflowStatus);
+  MOZ_ASSERT(NS_FRAME_IS_COMPLETE(contentsReflowStatus),
+             "We gave button-contents frame unconstrained available height, "
+             "so it should be complete");
 
   // Compute our desired height before vertically centering our children
   nscoord actualDesiredHeight = 0;
   if (aButtonReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
     actualDesiredHeight = aButtonReflowState.ComputedHeight();
   } else {
     actualDesiredHeight = aDesiredSize.height + aFocusPadding.TopBottom();
 
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -91,18 +91,17 @@ public:
   }
 
 protected:
   virtual bool IsInput() { return false; }
   void ReflowButtonContents(nsPresContext* aPresContext,
                             nsHTMLReflowMetrics& aDesiredSize,
                             const nsHTMLReflowState& aButtonReflowState,
                             nsIFrame* aFirstKid,
-                            nsMargin aFocusPadding,
-                            nsReflowStatus& aStatus);
+                            nsMargin aFocusPadding);
 
   nsButtonFrameRenderer mRenderer;
 };
 
 #endif