Bug 921174 part 1: Rename reflow state variables in nsHTMLButtonFrame, for clarity. r=bz
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 26 Sep 2013 23:43:15 -0700
changeset 162775 f8b7e4858ddd28643b69da9bcdbae429f6363f2d
parent 162774 bbdaf3ec9aae2796d5b555bbf9d48b623cb306ce
child 162776 7164978f006de148c4283e3de5bd143ed1ab3633
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 1: Rename reflow state variables in nsHTMLButtonFrame, for clarity. r=bz
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.h
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -207,82 +207,85 @@ nsHTMLButtonControlFrame::Reflow(nsPresC
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
   return NS_OK;
 }
 
 void
 nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
                                                nsHTMLReflowMetrics& aDesiredSize,
-                                               const nsHTMLReflowState& aReflowState,
+                                               const nsHTMLReflowState& aButtonReflowState,
                                                nsIFrame* aFirstKid,
                                                nsMargin aFocusPadding,
                                                nsReflowStatus& aStatus)
 {
-  nsSize availSize(aReflowState.ComputedWidth(), NS_INTRINSICSIZE);
+  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
   // intrinsic min width, that means that the kid wouldn't really fit; for a
   // better look in such cases we adjust the available width and our left
   // offset to allow the kid to spill left into our padding.
-  nscoord xoffset = aFocusPadding.left + aReflowState.mComputedBorderPadding.left;
-  nscoord extrawidth = GetMinWidth(aReflowState.rendContext) -
-    aReflowState.ComputedWidth();
+  nscoord xoffset = aFocusPadding.left +
+    aButtonReflowState.mComputedBorderPadding.left;
+  nscoord extrawidth = GetMinWidth(aButtonReflowState.rendContext) -
+    aButtonReflowState.ComputedWidth();
   if (extrawidth > 0) {
     nscoord extraleft = extrawidth / 2;
     nscoord extraright = extrawidth - extraleft;
     NS_ASSERTION(extraright >=0, "How'd that happen?");
     
     // Do not allow the extras to be bigger than the relevant padding
-    extraleft = std::min(extraleft, aReflowState.mComputedPadding.left);
-    extraright = std::min(extraright, aReflowState.mComputedPadding.right);
+    extraleft = std::min(extraleft, aButtonReflowState.mComputedPadding.left);
+    extraright = std::min(extraright, aButtonReflowState.mComputedPadding.right);
     xoffset -= extraleft;
     availSize.width += extraleft + extraright;
   }
   availSize.width = std::max(availSize.width,0);
   
-  nsHTMLReflowState reflowState(aPresContext, aReflowState, aFirstKid,
-                                availSize);
+  nsHTMLReflowState contentsReflowState(aPresContext, aButtonReflowState,
+                                        aFirstKid, availSize);
 
-  ReflowChild(aFirstKid, aPresContext, aDesiredSize, reflowState,
+  ReflowChild(aFirstKid, aPresContext, aDesiredSize, contentsReflowState,
               xoffset,
-              aFocusPadding.top + aReflowState.mComputedBorderPadding.top,
+              aFocusPadding.top + aButtonReflowState.mComputedBorderPadding.top,
               0, aStatus);
 
   // Compute our desired height before vertically centering our children
   nscoord actualDesiredHeight = 0;
-  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
-    actualDesiredHeight = aReflowState.ComputedHeight();
+  if (aButtonReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
+    actualDesiredHeight = aButtonReflowState.ComputedHeight();
   } else {
     actualDesiredHeight = aDesiredSize.height + aFocusPadding.TopBottom();
 
     // Make sure we obey min/max-height in the case when we're doing intrinsic
     // sizing (we get it for free when we have a non-intrinsic
-    // aReflowState.ComputedHeight()).  Note that we do this before adjusting
-    // for borderpadding, since mComputedMaxHeight and mComputedMinHeight are
-    // content heights.
+    // aButtonReflowState.ComputedHeight()).  Note that we do this before
+    // adjusting for borderpadding, since mComputedMaxHeight and
+    // mComputedMinHeight are content heights.
     actualDesiredHeight = NS_CSS_MINMAX(actualDesiredHeight,
-                                        aReflowState.mComputedMinHeight,
-                                        aReflowState.mComputedMaxHeight);
+                                        aButtonReflowState.mComputedMinHeight,
+                                        aButtonReflowState.mComputedMaxHeight);
   }
 
   // center child vertically in the content area
   nscoord yoff = (actualDesiredHeight - aFocusPadding.TopBottom() - aDesiredSize.height) / 2;
   if (yoff < 0) {
     yoff = 0;
   }
 
   // Place the child
-  FinishReflowChild(aFirstKid, aPresContext, &reflowState, aDesiredSize,
+  FinishReflowChild(aFirstKid, aPresContext, &contentsReflowState, aDesiredSize,
                     xoffset,
-                    yoff + aFocusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
+                    yoff + aFocusPadding.top +
+                      aButtonReflowState.mComputedBorderPadding.top,
+                    0);
 
   if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE)
     aDesiredSize.ascent = aFirstKid->GetBaseline();
 
   // Adjust the baseline by our offset (since we moved the child's
   // baseline by that much), and set our actual desired height.
   aDesiredSize.ascent += yoff;
   aDesiredSize.height = actualDesiredHeight;
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -89,17 +89,17 @@ public:
     return nsContainerFrame::IsFrameOfType(aFlags &
       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
 protected:
   virtual bool IsInput() { return false; }
   void ReflowButtonContents(nsPresContext* aPresContext,
                             nsHTMLReflowMetrics& aDesiredSize,
-                            const nsHTMLReflowState& aReflowState,
+                            const nsHTMLReflowState& aButtonReflowState,
                             nsIFrame* aFirstKid,
                             nsMargin aFocusPadding,
                             nsReflowStatus& aStatus);
 
   nsButtonFrameRenderer mRenderer;
 };
 
 #endif